Ejemplo n.º 1
0
        public fThemNhanVien(bool isAdd = true, CNhanVien nv = null, fNhanVien.sendMessage send = null)
        {
            InitializeComponent();

            //XtraMessageBox.Show(DateTime.Now.GetDateTimeFormats()[5]);

            if (isAdd == false && nv == null)
            {
                XtraMessageBox.Show("ERROR : Dữ liệu không được cung cấp để thực hiện hành động !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            }
            if (isAdd == true)
            {
                table = LoadNV();
                Text  = "Thêm nhân viên";
            }
            else
            {
                editNV = nv;
                Text   = "Sửa thông tin nhân viên";
            }
            add    = isAdd;
            sendNV = send;

            Init();
        }
Ejemplo n.º 2
0
        private void BtnSua_ItemClick(object sender, ItemClickEventArgs e)
        {
            int       rowIndex   = gvMain.FocusedRowHandle;
            DataRow   fNV        = BUS_NhanVien.TimNV(gvMain.GetRowCellValue(rowIndex, "Employee_ID").ToString());
            string    _MaNV      = fNV.Field <string>("Employee_ID");
            string    _TenNV     = fNV.Field <string>("Employee_Name");
            bool      _GioiTinh  = fNV.Field <bool>("Sex");
            string    _DiaChi    = fNV.Field <string>("Address");
            string    _DienThoai = fNV.Field <string>("O_Tel");
            string    _DiDong    = fNV.Field <string>("Mobile");
            DateTime  _NgaySinh  = fNV.Field <DateTime>("Birthday");
            string    _BoPhan    = fNV.Field <string>("Department_ID");
            string    _QuanLy    = fNV.Field <string>("Manager_ID");
            string    _ChucVu    = fNV.Field <string>("Description");
            string    _Email     = fNV.Field <string>("Email");
            bool      _ConQL     = fNV.Field <bool>("Active");
            CNhanVien nv         = new CNhanVien
            {
                MaNV      = _MaNV,
                TenNV     = _TenNV,
                GioiTinh  = _GioiTinh,
                DiaChi    = _DiaChi,
                DienThoai = _DienThoai,
                DiDong    = _DiDong,
                NgaySinh  = _NgaySinh,
                BoPhan    = _BoPhan,
                QuanLy    = _QuanLy,
                ChucVu    = _ChucVu,
                Email     = _Email,
                ConQL     = _ConQL
            };
            fThemNhanVien sua = new fThemNhanVien(false, nv, LoadData);

            sua.ShowDialog();
        }
Ejemplo n.º 3
0
        private void xlThem()
        {
            CNhanVien nv = new CNhanVien
                               (txtMa.Text,
                               txtTen.Text,
                               bool.Parse(radioGioiTinh.EditValue.ToString()),
                               txtDiaChi.Text,
                               txtDienThoai.Text,
                               txtDiDong.Text,
                               (deNgaySinh.Text == "" ? DateTime.Now : DateTime.Parse(deNgaySinh.Text)),
                               (gleBoPhan.Text == "" ? "" : gleBoPhan.EditValue.ToString()),
                               (gleQuanLy.Text == "" ? "" : gleQuanLy.EditValue.ToString()),
                               txtChucVu.Text,
                               txtEmail.Text,
                               checkConQL.Checked);

            nv.completeObject();
            BUS_NhanVien.ThemNV(nv);
            sendNV?.Invoke();

            Action.Module     = "Nhân Viên";
            Action.ActionName = "Sửa";
            Action.Reference  = txtMa.Text;
            Action.LuuThongTin();

            this.Close();
        }
Ejemplo n.º 4
0
 public static void SuaNV(CNhanVien nv)
 {
     try
     {
         NhanVien dao = new NhanVien();
         dao.SuaNV(nv);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        public void ThemNV(CNhanVien nv)
        {
            Provider dao = new Provider();

            try
            {
                dao.Connect();
                string      sql  = "EMPLOYEE_Insert";
                CommandType type = CommandType.StoredProcedure;
                dao.ExeCuteNonQuery(type, sql,
                                    new SqlParameter {
                    ParameterName = "@Employee_ID", Value = nv.MaNV
                },
                                    new SqlParameter {
                    ParameterName = "@FirtName", Value = nv.FirtName
                },
                                    new SqlParameter {
                    ParameterName = "@LastName", Value = nv.LastName
                },
                                    new SqlParameter {
                    ParameterName = "@Employee_Name", Value = nv.TenNV
                },
                                    new SqlParameter {
                    ParameterName = "@Alias", Value = nv.Alias
                },
                                    new SqlParameter {
                    ParameterName = "@Sex", Value = nv.GioiTinh
                },
                                    new SqlParameter {
                    ParameterName = "@Address", Value = nv.DiaChi
                },
                                    new SqlParameter {
                    ParameterName = "@Country_ID", Value = nv.Country_ID
                },
                                    new SqlParameter {
                    ParameterName = "@H_Tel", Value = nv.H_Tel
                },
                                    new SqlParameter {
                    ParameterName = "@O_Tel", Value = nv.DienThoai
                },
                                    new SqlParameter {
                    ParameterName = "@Mobile", Value = nv.DiDong
                },
                                    new SqlParameter {
                    ParameterName = "@Fax", Value = nv.Fax
                },
                                    new SqlParameter {
                    ParameterName = "@Email", Value = nv.Email
                },
                                    new SqlParameter {
                    ParameterName = "@Birthday", Value = nv.NgaySinh
                },
                                    new SqlParameter {
                    ParameterName = "@Married", Value = nv.Married
                },
                                    new SqlParameter {
                    ParameterName = "@Position_ID", Value = nv.Position_ID
                },
                                    new SqlParameter {
                    ParameterName = "@JobTitle_ID", Value = nv.JobTitle_ID
                },
                                    new SqlParameter {
                    ParameterName = "@Branch_ID", Value = nv.Branch_ID
                },
                                    new SqlParameter {
                    ParameterName = "@Department_ID", Value = nv.BoPhan
                },
                                    new SqlParameter {
                    ParameterName = "@Team_ID", Value = nv.Team_ID
                },
                                    new SqlParameter {
                    ParameterName = "@PersonalTax_ID", Value = nv.PersonalTax_ID
                },
                                    new SqlParameter {
                    ParameterName = "@City_ID", Value = nv.City_ID
                },
                                    new SqlParameter {
                    ParameterName = "@District_ID", Value = nv.District_ID
                },
                                    new SqlParameter {
                    ParameterName = "@Manager_ID", Value = nv.QuanLy
                },
                                    new SqlParameter {
                    ParameterName = "@EmployeeType", Value = nv.EmployeeType
                },
                                    new SqlParameter {
                    ParameterName = "@BasicSalary", Value = nv.BasicSalary
                },
                                    new SqlParameter {
                    ParameterName = "@Advance", Value = nv.Advance
                },
                                    new SqlParameter {
                    ParameterName = "@AdvanceOther", Value = nv.AdvanceOther
                },
                                    new SqlParameter {
                    ParameterName = "@Commission", Value = nv.Commission
                },
                                    new SqlParameter {
                    ParameterName = "@Discount", Value = nv.Discount
                },
                                    new SqlParameter {
                    ParameterName = "@ProfitRate", Value = nv.ProfitRate
                },
                                    new SqlParameter {
                    ParameterName = "@IsPublic", Value = nv.IsPublic
                },
                                    new SqlParameter {
                    ParameterName = "@CreatedBy", Value = nv.CreatedBy
                },
                                    new SqlParameter {
                    ParameterName = "@CreatedDate", Value = nv.CreatedDate
                },
                                    new SqlParameter {
                    ParameterName = "@ModifiedBy", Value = nv.ModifiedBy
                },
                                    new SqlParameter {
                    ParameterName = "@ModifiedDate", Value = nv.ModifiedDate
                },
                                    new SqlParameter {
                    ParameterName = "@OwnerID", Value = nv.OwnerID
                },
                                    new SqlParameter {
                    ParameterName = "@Description", Value = nv.ChucVu
                },
                                    new SqlParameter {
                    ParameterName = "@Sorted", Value = nv.Sorted
                },
                                    new SqlParameter {
                    ParameterName = "@Active", Value = nv.ConQL
                });
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                dao.DisConnect();
            }
        }