Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var addGroup = new frmAddGroup(this, Utilities.Enums.Mode.Create, 0, _userInfo);

            addGroup.MdiParent = this.MdiParent;
            //addGroup.Show(this.Owner);
            addGroup.Show();
        }
Beispiel #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DataGridViewRow dr = grvGroup.SelectedRows[0];
            int             selectedGroupID = (Int32)dr.Cells[1].Value;
            var             addGroup        = new frmAddGroup(this, Utilities.Enums.Mode.Edit, selectedGroupID, _userInfo);

            addGroup.Show(this.Owner);
        }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //delete all current user of this Group before add new ones
            UserInGroupFactory.DeleteUserInGroupByGroupID(_groupID);
            //add selected user into groups
            try
            {
                foreach (DataGridViewRow dr in grvUser.Rows)
                {
                    if (dr.Cells[0].Value + "" == "True")
                    {
                        int userID = new Int32();
                        userID = (Int32)dr.Cells[1].Value;
                        tblUserInGroup userInGroup = new tblUserInGroup();
                        userInGroup.GroupID = _groupID;
                        userInGroup.UserID  = userID;
                        UserInGroupFactory.Insert(userInGroup);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(ConstantInfo.MESSAGE_ADD_USER_IN_GROUP_FAIL);
                return;
            }

            MessageBox.Show(ConstantInfo.MESSAGE_ADD_USER_IN_GROUP_SUCESSFULLY);
            // Bind the lastest to the parrent
            _parent.BindData();
            //Form[] listForm = this.Owner.OwnedForms;
            //foreach (Form form in listForm)
            //{
            //  if (form.Name == "frmAddGroup")
            //  {
            //    ((frmAddGroup)form).BindData();
            //  }
            //}
            _parent.Show();
            _parent.Focus();
            this.Close();
        }
Beispiel #4
0
 private void grvGroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0 && grvGroup.SelectedRows.Count == 1) // Only select one row
         {
             var dr = grvGroup.SelectedRows[0];
             var selectedGroupID = (Int32)dr.Cells[1].Value;
             var addGroup        = new frmAddGroup(this, Utilities.Enums.Mode.Edit, selectedGroupID, _userInfo);
             addGroup.Show(this.Owner);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.ToString());
         if (GlobalInfo.IsDebug)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }