private void ItemClickEventHandler_Edit(object sender, EventArgs e) { // 25 isEditting gan bang true //isEditting = true; isAction = "Edit"; state = MenuState.Update; if (gridViewRowClick == true) { Set4Object(); //Disable this.Enabled = false; // // Truyen object LOC to DELEGATE F_EMPLOYEE_Details FRM = new F_EMPLOYEE_Details(); FRM.EMP = this.EMP; FRM.isAction = this.isAction; FRM.myFinished += this.finished; FRM.Show(); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Lưu ý "; args.Text = "Vui lòng click vào đầu dòng cần chỉnh sửa . Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } }
private void ItemClickEventHandler_View(object sender, EventArgs e) { // 23 Gán state UPdate cho tat ca cac nut state = MenuState.Update; //24 Edit hoặc update nên isNew gán bằng false //isNew = false; // 25 isEditting gan bang true //isEditting = true; isAction = "View"; // 26 COntrols gỡ bỏ trạng thái đọc cho phép nhập liệu //ControlsReadOnly(false); //Disable this.Enabled = false; // // Truyen object LOC to DELEGATE F_EMPLOYEE_Details F_EMP_Dtl = new F_EMPLOYEE_Details(); F_EMP_Dtl.isAction = this.isAction; F_EMP_Dtl.EMP = this.EMP; F_EMP_Dtl.myFinished += this.finished; F_EMP_Dtl.Show(); }
public F_CUSTOMER_Details() { InitializeComponent(); Load += (s, e) => { action_EndForm1.Add_Status(false); action_EndForm1.Delete_Status(false); action_EndForm1.Update_Status(false); action_EndForm1.Save_Status(true); action_EndForm1.View_Status(false); action_EndForm1.Close_Status(true); //if(isEditting == true) if (isAction == "Edit") { Set4Controls(); //lkeLoaiDN.ReadOnly = true; } else if (isAction == "Add") { txtID.ReadOnly = true; } }; chkBan.CheckedChanged += (s, e) => { if (chkBan.CheckState == CheckState.Checked) { chkHotro.CheckState = CheckState.Unchecked; } else { chkHotro.CheckState = CheckState.Checked; } }; chkHotro.CheckedChanged += (s, e) => { if (chkHotro.CheckState == CheckState.Checked) { chkBan.CheckState = CheckState.Unchecked; } else { chkBan.CheckState = CheckState.Checked; } }; lkeTenNV.EditValueChanged += (s, e) => { //DataRowView row = lkeTenNV.Properties.GetDataSourceRowByKeyValue(lkeTenNV.EditValue) as DataRowView; DataRowView row = lkeTenNV.Properties.GetRowByKeyValue(lkeTenNV.EditValue) as DataRowView; txtSdt.Text = row["EMPMobile"].ToString(); txtEmailNV.Text = row["EMPEmail"].ToString(); }; lkeTenNV.ButtonClick += (s, e) => { if (e.Button.Index == 1) { //Diable form this.Enabled = false; // F_EMPLOYEE_Details FRM = new F_EMPLOYEE_Details(); FRM.myFinished += this.finished; FRM.isAction = "Add"; FRM.Show(); } }; lkeLoaiDN.ButtonClick += (s, e) => { if (e.Button.Index == 1) { //Diable form this.Enabled = false; // F_CUSTOMERTYPE_Details FRM = new F_CUSTOMERTYPE_Details(); FRM.myFinished += this.finished; FRM.isAction = "Add"; FRM.Show(); } }; //txtMavung.ButtonClick += (s, e) => //{ // if (e.Button.Index == 1) // { // //Diable form // this.Enabled = false; // // // F_LOCATION_Details FRM = new F_LOCATION_Details(); // FRM.myFinished += this.finished; // FRM.isAction = "Add"; // FRM.Show(); // } //}; lkeLoaiDN.EditValueChanged += (s, e) => { //XtraMessageBox.Show("Chnageg text"); //Bán if (lkeLoaiDN.EditValue.ToString() == "L01") { layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutControlItem22.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; layoutControlItem23.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; lkeMaDN.Properties.DataSource = CUSBUS.CUSTOMER_LIST_SAPB1(); lkeMaDN.Properties.DisplayMember = "CardCode"; lkeMaDN.Properties.ValueMember = "CardCode"; } //Hỗ trợ else if (lkeLoaiDN.EditValue.ToString() == "L02") { layoutControlItem22.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutControlItem23.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; //lkeMaDN.Properties.ReadOnly = true; //txtTenDN.ReadOnly = true; //F_CREATE_CUSTOMER FCC = new Class.F_CREATE_CUSTOMER(); //FCC.Show(); if (isAction == "Add") { if (CUSBUS.MAX_CUSTOMER_CODE() < 10) { txtMaDN2.Text = "HT00" + CUSBUS.MAX_CUSTOMER_CODE().ToString(); } else if (CUSBUS.MAX_CUSTOMER_CODE() < 100 && CUSBUS.MAX_CUSTOMER_CODE() > 9) { txtMaDN2.Text = "HT0" + CUSBUS.MAX_CUSTOMER_CODE().ToString(); } else { txtMaDN2.Text = "HT" + CUSBUS.MAX_CUSTOMER_CODE().ToString(); } } } }; lkeMaDN.EditValueChanged += (s, e) => { DataRowView row = lkeMaDN.GetSelectedDataRow() as DataRowView; txtTenDN.Text = row["CardName"].ToString(); txtDiaChiDN.Text = row["Address"].ToString(); }; lkeProvinceName.EditValueChanged += (s, e) => { DataRowView row = lkeProvinceName.GetSelectedDataRow() as DataRowView; txtMavung.Text = row["LOCName"].ToString(); }; chkKHViphaLAB.CheckedChanged += (s, e) => { if (chkKHViphaLAB.CheckState == CheckState.Checked) { CUS.CUSTViphaLAB = true; } else if (chkKHViphaLAB.CheckState == CheckState.Checked) { CUS.CUSTViphaLAB = false; } }; //Action_EndForm action_EndForm1.Add(new DevExpress.XtraBars.ItemClickEventHandler(ItemClickEventHandler_Add)); action_EndForm1.Update(new DevExpress.XtraBars.ItemClickEventHandler(ItemClickEventHandler_Update)); action_EndForm1.Close(new DevExpress.XtraBars.ItemClickEventHandler(ItemClickEventHandler_Close)); action_EndForm1.Save(new DevExpress.XtraBars.ItemClickEventHandler(ItemClickEventHandler_Save)); }