Exemple #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.RowCount > 0 && dgv.CurrentRow != null)
                {
                    string pCode = dgv.Rows[dgv.CurrentRow.Index].Cells[0].Value.ToString();
                    employee = employeeBLL.GetById(pCode);
                    frmAddAccount frm = new frmAddAccount();
                    frm.ShowDialog();

                    //reload data
                    Display();
                    SetUIChanges();
                }
            }
            catch (Exception)
            {
                string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString();
                if (code == "-532462766")
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM292"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                }
                return;
            }
        }
Exemple #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            pStatusAddEmployee = true;
            frmAddAccount frmAdd = new frmAddAccount();

            frmAdd.ShowDialog();

            //Reload data
            Display();
            SetUIChanges();
            pStatusAddEmployee = false;
        }
Exemple #3
0
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgv.RowCount > 0 && dgv.CurrentRow != null)
                {
                    string pCode = dgv.Rows[dgv.CurrentRow.Index].Cells[0].Value.ToString();
                    employee = employeeBLL.GetById(pCode);
                    frmAddAccount frm = new frmAddAccount();
                    frm.ShowDialog();

                    //reload data
                    Display();
                    SetUIChanges();
                }
            }
            catch (Exception)
            {
                string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString();
                if (code == "-532462766")
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM292"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                }
                return;
            }
            //try
            //{
            //    #region
            //    pStatusAddEmployee = false; //case: edit
            //    int dgvRowIndex = e.RowIndex;
            //    string[] arrDate = new string[3];

            //    if (dgv.RowCount > 0 && dgv.CurrentRow != null)
            //    {
            //        employee.EmployeeId = dgv["EmployeeId", dgvRowIndex].Value.ToString();
            //        employee.EmployeeCode = dgv["EmployeeCode", dgvRowIndex].Value.ToString();
            //        employee.EmployeeName = dgv["EmployeeName", dgvRowIndex].Value.ToString();
            //        employee.UserName = dgv["UserName", dgvRowIndex].Value.ToString();
            //        //employee.Gender = int.Parse(dgv["IntGender", dgvRowIndex].Value.ToString());
            //        employee.BirthDate = DateTime.Parse(dgv["BirthDate", dgvRowIndex].Value.ToString());

            //        employee.PhoneNumber = dgv["PhoneNumber", dgvRowIndex].Value.ToString();
            //        employee.Email = dgv["Email", dgvRowIndex].Value.ToString();
            //        employee.Address = dgv["Address", dgvRowIndex].Value.ToString();
            //        //employee.EmployeeType.EmployeeTypeId = dgv["EmployeeTypeId", dgvRowIndex].Value.ToString();
            //        employee.EmployeeType.EmployeeTypeName = dgv["EmployeeTypeName", dgvRowIndex].Value.ToString();
            //        employee.Country.CountryId = dgv["CountryId", dgvRowIndex].Value.ToString();
            //        employee.Country.CountryName = dgv["CountryName", dgvRowIndex].Value.ToString();
            //        //employee.IsDelete = int.Parse(dgv["IntIsDelete", dgvRowIndex].Value.ToString());
            //        employee.HourlyWages = decimal.Parse(dgv["HourlyWages", dgvRowIndex].Value.ToString());
            //        employee.Notes = dgv["Notes", dgvRowIndex].Value.ToString();

            //        employee.CreatedDate = DateTime.Parse(dgv["CreatedDate", dgvRowIndex].Value.ToString());
            //        employee.Password = dgv["Password", dgvRowIndex].Value.ToString();
            //        employee.UpdatedDate = DateTime.Parse(dgv["UpdatedDate", dgvRowIndex].Value.ToString());

            //        employee.Image = employeeBLL.GetImage(employee.EmployeeId);

            //        frmAddAccount frm = new frmAddAccount();
            //        frm.ShowDialog();
            //        //Reload data
            //        Display();
            //        SetUIChanges();

            //    }
            //    #endregion
            //}
            //catch (Exception)
            //{
            //    /*
            //    string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString();
            //    if (code == "-532462766")
            //    {
            //        CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM292"),
            //                  Common.clsLanguages.GetResource("CRM11"),
            //                  Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
            //                  Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            //    }
            //    return;
            //     */
            //}
        }