示例#1
0
 private void CancelData(bool isCancel)
 {
     try
     {
         string msg;
         if (isCancel)
         {
             msg = MessageCode.CFM0003;
         }
         else
         {
             msg = MessageCode.CFM0004;
         }
         if (rMessageBox.ShowConfirmation(this, msg) == DialogResult.Yes)
         {
             vmMas.CancelUser(user, isCancel);
             if (isCancel)
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0004);
             }
             else
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0005);
             }
             this.IsDataChange = true;
             user = vmMas.GetUser(user.ID);
             RetriveData();
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
 }
示例#2
0
        private void RetriveData()
        {
            try
            {
                if (user == null)
                {
                    user               = new sp_MAS101_GetUser_Result();
                    user.CRT_DATE      = DateTime.Now;
                    this.ToolBarSwitch = "2122222222";
                    CtrlUtil.EnableControls(true, txtID);
                }
                else if (user.DEL_ID.IsNull())
                {
                    this.ToolBarSwitch = "2122222102";
                    CtrlUtil.EnableControls(false, txtID);
                }
                else
                {
                    this.ToolBarSwitch = "2022222012";
                    CtrlUtil.EnableControls(false, txtID);
                }

                CtrlUtil.EnableControls(user.DEL_ID.IsNull(), cboPreName, cboDivision, cboSubDivision, cboPosition, cboGroup);
                CtrlUtil.EnableControls(user.DEL_ID.IsNull(), txtFName_En, txtLName_En, txtFName_Th, txtLName_Th, txtNickName, txtIDCard, dtBirthDate, dtStartDate, txtPassword, txtRegistrationNo, txtLabSupervisorNo);

                user.PASS     = null;
                bs.DataSource = user;
            }
            catch (Exception ex)
            {
                rMessageBox.ShowException(this, ex);
            }
        }
示例#3
0
 private void SaveData()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (ValidateBeforeSave())
         {
             if (rMessageBox.ShowConfirmation(this, MessageCode.CFM0001) == DialogResult.Yes)
             {
                 string ID = vmMas.SaveUser(user);
                 rMessageBox.ShowInfomation(this, MessageCode.INF0002);
                 this.IsDataChange = true;
                 user = vmMas.GetUser(ID);
                 RetriveData();
             }
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
示例#4
0
 private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         SelectedData      = gvDetail.GetDataBound(e.RowIndex) as sp_MAS101_GetUser_Result;
         this.DialogResult = DialogResult.OK;
     }
 }
示例#5
0
 public string SaveUser(sp_MAS101_GetUser_Result user)
 {
     if (!user.PASS.IsNull())
     {
         user.PASS = Encryption.GetMd5Hash(user.PASS);
     }
     return(service.SaveUser(user));
 }
示例#6
0
 private void gvResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         sp_MAS101_GetUser_Result user = gvResult.Rows[e.RowIndex].DataBoundItem as sp_MAS101_GetUser_Result;
         MAS101_UserEntry         dlg  = new MAS101_UserEntry(user);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             LoadData();
         }
     }
 }
示例#7
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            string txt    = txtSearch.Text.ToUpper();
            var    result = userList.Where(x => x.FULLNAME_TH.Contains(txt) || x.FULLNAME_EN.ToUpper().Contains(txt) || x.DIVISION_NAME.ToUpper().Contains(txt) || x.SUBDIVISION_NAME.ToUpper().Contains(txt) || x.POSITION_NAME.ToUpper().Contains(txt) || x.ID.ToString().Contains(txt)).ToList();

            gvDetail.DataSource = new SortableBindingList <sp_MAS101_GetUser_Result>(result);

            if (result.Count == 1)
            {
                SelectedData = result[0];
            }
            else
            {
                SelectedData = null;
            }
        }
示例#8
0
 public MAS101_UserEntry(sp_MAS101_GetUser_Result user)
 {
     InitializeComponent();
     this.user = user;
 }
示例#9
0
 public void CancelUser(sp_MAS101_GetUser_Result data, bool ISCANCEL)
 {
     service.CancelUser(data, ISCANCEL);
 }