private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int selectedrow = gridItemDetail.FocusedRowHandle; if (selectedrow > 0) { DataRow dr = gridItemDetail.GetDataRow(selectedrow); string _value = dr["BrandCode"].ToString(); if (Class.App.ConfirmDeletion("Bạn chắc muốn xóa thông tin Chi nhánh này không ? \n Lưu ý: Mọi thông tin Phòng ban, Nhóm, Nhân Viên thuộc chi nhánh này sẽ bị xóa hết !") == DialogResult.No) { return; } Class.DanhMuc_ChiNhanh dmcn = new Class.DanhMuc_ChiNhanh(); dmcn.BranchCode = _value; if (dmcn.Delete()) { Class.App.DeleteSuccessfully(); Load_ChiNhanh(); } else { Class.App.DeleteNotSuccessfully(); } } }
private void Call_info_toCBO() { Class.DanhMuc_ChiNhanh cn = new Class.DanhMuc_ChiNhanh(); DataTable dtcn = cn.Danhsachchinhanh(); cboOldBranch.Properties.DataSource = dtcn; cboOldBranch.Properties.ValueMember = "BranchCode"; cboOldBranch.Properties.DisplayMember = "BranchName"; cboNewBranch.Properties.DataSource = dtcn; cboNewBranch.Properties.ValueMember = "BranchCode"; cboNewBranch.Properties.DisplayMember = "BranchName"; Class.DanhMuc_PhongBan pb = new Class.DanhMuc_PhongBan(); DataTable dtpb = pb.GetAllList_DEPARTMENT(); cboOldDepartment.Properties.DataSource = dtpb; cboOldDepartment.Properties.ValueMember = "DepartmentCode"; cboOldDepartment.Properties.DisplayMember = "DepartmentName"; // cboNewDepartment.Properties.DataSource = dtpb; // cboNewDepartment.Properties.ValueMember = "DepartmentCode"; // cboNewDepartment.Properties.DisplayMember = "DepartmentName"; Class.Danhmuc_Chucvu cv = new Class.Danhmuc_Chucvu(); DataTable dtcv = cv.GetAlllist_Position();; txtNewPosition.Properties.Items.Clear(); txtOldPosition.Properties.Items.Clear(); for (int i = 0; i < dtcv.Rows.Count; i++) { txtNewPosition.Properties.Items.Add(dtcv.Rows[i]["PositionName"].ToString()); txtOldPosition.Properties.Items.Add(dtcv.Rows[i]["PositionName"].ToString()); } }
public void GetList_Branch() { Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh(); DataTable dt = dm.Danhsachchinhanh(); txtBranchName.Properties.DataSource = dt; txtBranchName.Properties.DisplayMember = "BranchName"; txtBranchName.Properties.ValueMember = "BranchCode"; }
private void btnUpdateNew_Click(object sender, EventArgs e) { if (txtBranchCode.Text.Length < 1 || txtBranchName.Text.Length < 1) { Class.App.InputNotAccess(); return; } Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh(); dm.BranchCode = txtBranchCode.Text; dm.BranchName = txtBranchName.Text; dm.Address = txtAddress.Text; dm.Phone = txtPhone.Text; dm.Fax = txtFax.Text; dm.MinimumSalary = txtMinimumSalary.Value; dm.PersonName = txtPersonName.Text; dm.Quantity = int.Parse(txtQuantity.Text); dm.FactQuantity = int.Parse(txtFactQuantity.Text); dm.Description = txtDescription.Text; if (txtBranchCode.Enabled == true) { if (dm.Insert()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } else { if (dm.Update()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } //if (_reCallFunction == "frmDanhSachChiNhanh") //{ // (this.Owner as frmDanhMuc_ChiNhanh). //} if (_reCallFunction == "frmDanhSachNhanVien") { (this.Owner as frmDanhSachNhanVien).loaddsCocautochuc(); } txtBranchCode.Enabled = true; txtBranchCode.Text = call_Code_New(); }
private string call_Code_New() { txtBranchCode.Text = ""; txtBranchName.Text = ""; txtAddress.Text = ""; txtPhone.Text = ""; txtFax.Text = ""; txtMinimumSalary.Value = 0; txtPersonName.Text = ""; txtFactQuantity.Text = "0"; txtQuantity.Text = "0"; txtDescription.Text = ""; this.Text = "Thêm Chi nhánh"; Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh(); return(dm.GetNewCode()); }
private void call_info(string Form_name, string code) { Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh(); DataTable dt = dm.GetBranchByCode(code); txtBranchCode.Text = dt.Rows[0]["BranchCode"].ToString(); txtBranchName.Text = dt.Rows[0]["BranchName"].ToString(); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtPhone.Text = dt.Rows[0]["Phone"].ToString(); txtFax.Text = dt.Rows[0]["Fax"].ToString(); txtMinimumSalary.Value = (decimal)dt.Rows[0]["MinimumSalary"]; txtPersonName.Text = dt.Rows[0]["PersonName"].ToString(); txtQuantity.Text = dt.Rows[0]["Quantity"].ToString(); txtFactQuantity.Text = dt.Rows[0]["FactQuantity"].ToString(); txtDescription.Text = dt.Rows[0]["Description"].ToString(); }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtBranchCode.Text.Length < 1 || txtBranchName.Text.Length < 1) { Class.App.InputNotAccess(); return; } Class.DanhMuc_ChiNhanh dm = new Class.DanhMuc_ChiNhanh(); dm.BranchCode = txtBranchCode.Text; dm.BranchName = txtBranchName.Text; dm.Address = txtAddress.Text; dm.Phone = txtPhone.Text; dm.Fax = txtFax.Text; dm.MinimumSalary = txtMinimumSalary.Value; dm.PersonName = txtPersonName.Text; dm.Quantity = int.Parse(txtQuantity.Text); dm.FactQuantity = int.Parse(txtFactQuantity.Text); dm.Description = txtDescription.Text; if (txtBranchCode.Enabled == true) { if (dm.Insert()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } else { if (dm.Update()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } Load_ChiNhanh(); txtBranchCode.Text = call_Code_New(); txtBranchCode.Enabled = true; }
private void Load_ChiNhanh() { Class.DanhMuc_ChiNhanh dmcn = new Class.DanhMuc_ChiNhanh(); gridItem.DataSource = dmcn.Danhsachchinhanh(); }