Пример #1
0
        //提交修改后的信息
        private void btnYes_Click(object sender, EventArgs e)
        {
            //验证信息
            if (this.txtTeamLeader.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入正确信息", "系统提示");
                this.txtTeamLeader.Focus();
            }
            ;
            //封装要修改的对象
            T_Group objGroup = new T_Group()
            {
                F_TeamLeader = this.txtTeamLeader.Text.Trim(),
                F_Telephone  = this.txtTelephone.Text.Trim(),
                F_Number     = int.Parse(this.txtNumber.Text.Trim()),
                F_MuDistrict = this.txtMuDistrict.Text.Trim(),
                F_Address    = this.txtAddress.Text.Trim(),
                F_Date       = Convert.ToDateTime(this.txtDate.Text),
                F_District   = this.txtDistrict.Text.Trim()
            };

            //从数据库或数据源中修改

            //保存当前以修改的对象
            this.Tag          = objGroup;
            this.DialogResult = DialogResult.OK;//返回修改值
            this.Close();
        }
Пример #2
0
        public virtual T_Group GetGroup(int groupID)
        {
            T_Group result = GroupDA.GetByPKey(new T_Group()
            {
                GroupID = groupID, IsDeleted = false
            });

            return(result);
        }
Пример #3
0
        public virtual ResultM New(T_Group model, string userID)
        {
            ResultM result = new ResultM();

            model.CreatedBy      = userID;
            model.LastModifiedBy = userID;
            result.Affected      = GroupDA.Add(model);

            return(result);
        }
Пример #4
0
        public virtual ResultM Delete(int groupID, string currentUserID)
        {
            ResultM result = new ResultM();
            T_Group data   = GetGroup(groupID);

            data.IsDeleted   = true;
            data.DeletedBy   = currentUserID;
            data.DeletedTime = DateTime.Now;
            result.Affected  = GroupDA.Edit(data);
            return(result);
        }
Пример #5
0
 public EditGroup(T_Group objGroup)
 {
     InitializeComponent();
     //显示要修改的小组信息
     this.txtTeamLeader.Text = objGroup.F_TeamLeader;
     this.txtTelephone.Text  = objGroup.F_Telephone;
     this.txtNumber.Text     = objGroup.F_Number.ToString();
     this.txtDate.Text       = objGroup.F_Date.ToShortDateString();
     this.txtAddress.Text    = objGroup.F_Address;
     this.txtMuDistrict.Text = objGroup.F_MuDistrict;
     this.txtDistrict.Text   = objGroup.F_District;
 }
Пример #6
0
        public virtual ResultM Edit(T_Group model, string userID)
        {
            ResultM result = new ResultM();

            T_Group data = GetGroup(model.GroupID);

            data.GroupName        = model.GroupName;
            data.Description      = model.Description;
            data.State            = model.State;
            data.LastModifiedBy   = userID;
            data.LastModifiedTime = DateTime.Now;

            result.Affected = GroupDA.Edit(data);

            return(result);
        }
Пример #7
0
 private void redimPreserve(ref T_Group[] groups, int size)
 {
     if (size == 0)
     {
         groups = null;
     }
     else
     {
         if (groups == null)
         {
             groups = new T_Group[size];
         }
         else if (groups.Length == 0)
         {
             groups = new T_Group[size];
         }
         else
         {
             T_Group[] newArray = new T_Group[size];
             Array.Copy(groups, newArray, groups.Length);
             for (var t = groups.Length; t < newArray.Length; t++)
             {
                 newArray[t] = new T_Group();
             }
             groups = newArray;
         }
     }
 }
Пример #8
0
 public GroupVM()
 {
     TemData = new T_Group();
 }
Пример #9
0
        public int Add(T_Group model)
        {
            string sql = @"INSERT INTO T_Group(GroupName,Description,CreatedBy,LastModifiedBy) VALUES([GroupName],[Description],[CreatedBy],[LastModifiedBy])";

            return(template.Execute(sql, model));
        }