using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using ICSSoft.Frame.User.BLL; using ICSSoft.Base.Language.Tool; using ICSSoft.Base.UserControl.MessageControl; using System.Data.SqlClient; using ICSSoft.Base.Config.AppConfig; using ICSSoft.Base.Report.Filter; using ICSSoft.Base.Config.DBHelper; using ICSSoft.Base.UserControl.FormControl; using ICSSoft.Base.ReferForm.AppReferForm; using ICSSoft.Base.Lable.PrintTool; using ICSSoft.Frame.Data.DAL; using ICSSoft.Frame.Data.BLL; using ICSSoft.Frame.Data.Entity; namespace ICSSoft.Frame.APP { public partial class FormICSTeamGroupAdd : DevExpress.XtraEditors.XtraForm { bool add = false; public FormICSTeamGroupAdd() { InitializeComponent(); add = true; lblTitle.Text = "新增"; txtMUSERName.Text = AppConfig.UserName; txtMTIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } public FormICSTeamGroupAdd(string id) { InitializeComponent(); add = false; lblTitle.Text = "修改"; LoadData(id); } private void LoadData(string id) { ICSSGroup info = ICSTeamGroupBLL.SelectByID(id); if (info == null) { throw new Exception("该数据已被删除!"); } txtTeamGroupCode.Text = info.SGroup; txtTeamGroupDesc.Text = info.SGroupDESC; txtMUSERName.Text = info.MUSERName; txtMTIME.Text = info.MTIME.ToString("yyyy-MM-dd HH:mm:ss"); txtTeamGroupCode.Properties.ReadOnly = true; } #region 关闭 private void btnClose_Click(object sender, EventArgs e) { this.Close(); this.DialogResult = DialogResult.Cancel; } private void btnCancle_Click(object sender, EventArgs e) { this.Close(); this.DialogResult = DialogResult.Cancel; } #endregion private void btnOK_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtTeamGroupCode.Text)) { throw new Exception("组代码为必填项"); } if (string.IsNullOrWhiteSpace(txtTeamGroupDesc.Text)) { throw new Exception("组描述为必填项"); } ICSSGroup g = new ICSSGroup(); g.SGroup = txtTeamGroupCode.Text.Trim().ToUpper(); g.SGroupDESC = txtTeamGroupDesc.Text.Trim().ToUpper(); g.MUSER = AppConfig.UserCode; g.MUSERName = AppConfig.UserName; g.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss"); g.WorkPoint = AppConfig.WorkPointCode; ICSTeamGroupBLL.Edit(g); ICSBaseSimpleCode.AppshowMessageBox(lblTitle.Text + "成功"); } catch (Exception ex) { ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } } } }