//tab.Name = "tcMain"; //XtraTabPage tabPage = new XtraTabPage(); public void AddEvent() { if (data.BsMain == null) { return; } lc = data.FrmMain.Controls.Find("lcMain", true)[0] as LayoutControl; drMaster = (data.BsMain.Current as DataRowView).Row; // Nút tính ngày kết thúc SimpleButton btnNgayKT = new SimpleButton(); btnNgayKT.Name = "btnNgayKT"; //phai co name cua control btnNgayKT.Text = "Tính ngày KT"; LayoutControlItem lci1 = lc.AddItem("", btnNgayKT); lci1.Name = "cusNgayKT"; //phai co name cua item, bat buoc phai co "cus" phai truoc btnNgayKT.Click += new EventHandler(btnNgayKT_Click); // ----------------------- // Nút lấy dữ liệu ngày nghỉ SimpleButton btnNapDL = new SimpleButton(); btnNapDL.Name = "btnNapDL"; //phai co name cua control btnNapDL.Text = "Nạp lịch nghỉ"; LayoutControlItem lci2 = lc.AddItem("", btnNapDL); lci2.Name = "cusNapDL"; //phai co name cua item, bat buoc phai co "cus" phai truoc btnNapDL.Click += new EventHandler(btnNapDL_Click); // ----------------------- if (drMaster == null) { return; } if (drMaster.RowState == DataRowState.Deleted) { return; } data.FrmMain.Shown += new EventHandler(FrmMain_Shown); chkIsCT = data.FrmMain.Controls.Find("IsCT", true)[0] as CheckEdit; if (chkIsCT != null) { chkIsCT.EditValueChanged += new EventHandler(chkIsCT_EditValueChanged); } dateNgayKT = data.FrmMain.Controls.Find("NgayKTKhoa", true)[0] as DateEdit; dateNgayBD = data.FrmMain.Controls.Find("NgayBDKhoa", true)[0] as DateEdit; GluMaGioHoc = data.FrmMain.Controls.Find("MaGioHoc", true)[0] as GridLookUpEdit; calSobuoi = data.FrmMain.Controls.Find("SoBuoi", true)[0] as CalcEdit; gvNgayNghi = (data.FrmMain.Controls.Find("TLNgayNghiLop", true)[0] as GridControl).MainView as GridView; // Tab thời hạn thanh toán của lớp doanh nghiệp tab = data.FrmMain.Controls.Find("tcMain", true)[0] as XtraTabControl; GluMaGioHoc.EditValueChanged += new EventHandler(GluMaGioHoc_EditValueChanged); dateNgayBD.EditValueChanged += new EventHandler(dateNgayBD_EditValueChanged); calSobuoi.EditValueChanged += new EventHandler(calSobuoi_EditValueChanged); gvNgayNghi.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gvNgayNghi_CellValueChanged); data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(data.BsMain, new EventArgs()); }
public frmNumpad(Control control) { InitializeComponent(); #region Key events this.Load += new EventHandler(frmKeyboard_Load); this.Deactivate += new EventHandler(frmNumpad_Deactivate); this.btnKey0.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey1.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey2.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey3.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey4.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey5.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey6.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey7.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey8.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey9.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyBack.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyClear.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyDot.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyComma.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyDone.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyExit.MouseDown += new MouseEventHandler(btnKey_MouseDown); #endregion this.editControl = control; edit = numView; }
private void frmNumpad_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (this.editControl != null) { if (!string.IsNullOrEmpty(numView.Text)) { this.editControl.Text = Convert.ToString(numView.EditValue); if (this.editControl is CalcEdit) { CalcEdit tbase = (CalcEdit)this.editControl; tbase.EditValue = numView.EditValue; } else if (this.editControl is TextEdit) { TextEdit tbase = (TextEdit)this.editControl; tbase.Text = numView.Text; } } } this.Value = numView.EditValue == null ? 0 : Convert.ToDecimal(numView.EditValue); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
void CreditAmountRepo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Down || e.KeyCode == Keys.Right || e.KeyCode == Keys.Left || e.KeyCode == Keys.Up) { CalcEdit cedit = sender as CalcEdit; if (cedit.Text == string.Empty) { cedit.Text = "0.00"; } if (Convert.ToDouble(cedit.Text) <= Math.Abs(Convert.ToDouble(DiffAmount.Text))) { Dtreceipt.Rows[crgridrowsel]["CreditAmount"] = Convert.ToDouble(cedit.Text); sumcreditamount = Convert.ToDouble(Dtreceipt.AsEnumerable().Sum(x => x.Field <double>("CreditAmount"))); CreditBox.Text = sumcreditamount.ToString("#,##0.00"); UpdateSumBill(); } else { //Dtreceipt.Rows[crgridrowsel]["CreditAmount"] = 0; cedit.Value = 0; MessageBox.Show("ยอดชำระไม่ถูกต้อง!"); } } //throw new NotImplementedException(); }
public void AddEvent() { //if (data.BsMain.Current == null) // return; lc = data.FrmMain.Controls.Find("LcMain", true)[0] as LayoutControl; gluMaNL = data.FrmMain.Controls.Find("MaNL", true)[0] as GridLookUpEdit; gluMaNL.EditValueChanged += new EventHandler(gluMaNL_EditValueChanged); calSobo = data.FrmMain.Controls.Find("SoLuong", true)[0] as CalcEdit; calSobo.EditValueChanged += new EventHandler(calSobo_EditValueChanged); raHTMUA = data.FrmMain.Controls.Find("HTMua", true)[0] as RadioGroup; if (raHTMUA != null) { raHTMUA.EditValueChanged += new EventHandler(raHTMUA_EditValueChanged); } CalThucThu = data.FrmMain.Controls.Find("ThucNop", true)[0] as CalcEdit; CalThucThu.EditValueChanged += new EventHandler(CalThucThu_EditValueChanged); data.FrmMain.Shown += new EventHandler(FrmMain_Shown); data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(data.BsMain, new EventArgs()); //GridControl gc = data.FrmMain.Controls.Find("gcMain",true)[0] as GridControl; //gc.MainView[0] gv = (data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; //gv = (data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; gvvt = (data.FrmMain.Controls.Find("DTCL", true)[0] as GridControl).MainView as GridView; gv.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gv_CellValueChanged); }
void CalThucThu_EditValueChanged(object sender, EventArgs e) { CalcEdit cal = sender as CalcEdit; if (cal.Properties.ReadOnly) { return; } DataSet ds = data.BsMain.DataSource as DataSet; if (ds == null) { return; } if (data.BsMain.Current == null) { return; } drMaster = (data.BsMain.Current as DataRowView).Row; DataView dv = new DataView(ds.Tables[1]); dv.RowFilter = string.Format("MTNLID = '{0}'", drMaster["MTNLID"].ToString()); decimal Tien = (decimal)cal.EditValue; if (Tien == 0 && dv.Count > 0) { for (int i = 0; i < dv.Count; i++) { dv[i].Row["STDaNop"] = 0; dv[i].Row["TienTT"] = 0; dv[i].Row["SBDuocHoc"] = dv[i].Row["SoBuoiChuyen"]; dv[i].Row["TCPhanBo"] = 0; } } }
/// <summary> /// 当输入时控制调价比 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void calcEditTJQB_EditValueChanged(object sender, EventArgs e) { CalcEdit ce = sender as CalcEdit; if (ce.Name == "calcEditTJQB") { if (this.calcEditTJQB.Value == 0) { this.calcEditTJZC.Enabled = true; this.calcEditTJSB.Enabled = true; this.calcEditTJCL.Enabled = true; this.calcEditTJRG.Enabled = true; this.calcEditTJJX.Enabled = true; } else { this.calcEditTJZC.Enabled = false; this.calcEditTJSB.Enabled = false; this.calcEditTJCL.Enabled = false; this.calcEditTJRG.Enabled = false; this.calcEditTJJX.Enabled = false; } } else { if (this.calcEditTJZC.Value == 0 && this.calcEditTJSB.Value == 0 && this.calcEditTJCL.Value == 0 && this.calcEditTJJX.Value == 0 && this.calcEditTJRG.Value == 0) { this.calcEditTJQB.Enabled = true; } else { this.calcEditTJQB.Enabled = false; } } }
public ToolBarCalcEdit(Codon codon, object caller) : base(new PopupContainerControl()) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; try { if (codon.Properties.Contains("class")) { this.menuCommand = (ISpinEditCommand) codon.AddIn.CreateObject(codon.Properties["class"]); if (this.menuCommand != null) { this.menuCommand.ID = codon.Id; this.menuCommand.Owner = this; this.menuCommand.Codon = codon; } } } catch (Exception exception) { LoggingService.Error(exception); } this.calcEdit = new CalcEdit(); this.calcEdit.Width = 200; this.calcEdit.EditValue = 1; this.calcEdit.Text = "计算器"; base.Control.Controls.Add(this.calcEdit); this.UpdateStatus(); this.UpdateText(); }
/// <summary> /// 创建计算器 /// </summary> /// <param name="captain">标签</param> /// <param name="prop">属性</param> /// <param name="max_length">最大长度</param> /// <param name="precision">小数位数</param> /// <returns></returns> public LayoutControlItem CreateCalcItem(string captain, string prop, int max_length = 10, int precision = 8, bool is_readonly = false) { LayoutControlItem item = new LayoutControlItem(); if (max_length < precision) { max_length = precision; } CalcEdit calcEdit = new CalcEdit(); calcEdit.DataBindings.Add("EditValue", bindingSource, prop); calcEdit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo), new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Clear) }); calcEdit.Properties.MaxLength = max_length; calcEdit.Properties.Precision = precision; calcEdit.Properties.ReadOnly = is_readonly; calcEdit.Properties.NullValuePrompt = captain; calcEdit.Properties.NullValuePromptShowForEmptyValue = true; calcEdit.Properties.ShowNullValuePromptWhenFocused = true; item.Control = calcEdit; item.Text = captain; return(item); }
public void addNumFromTo(QueryBuilder filter, string opLeft, CalcEdit FromCalc, CalcEdit ToCalc) { if (FromCalc.EditValue != null) { filter.add(opLeft, Operator.GreaterEqual, FromCalc.Value, DbType.Decimal); } if (ToCalc.EditValue != null) { filter.add(opLeft, Operator.LessEqual, ToCalc.Value, DbType.Decimal); } }
void calSobuoi_EditValueChanged(object sender, EventArgs e) { CalcEdit cal = sender as CalcEdit; if (cal.Properties.ReadOnly) { return; } dateNgayKT.EditValue = null; //XtraMessageBox.Show("sdfsfsd"); }
protected virtual CalcEdit CreateSpinEditControl(ModuleFieldInfo fieldInfo) { var calcEdit = new CalcEdit { Name = string.Format(CONSTANTS.TEXTINPUT_NAME_FORMAT, fieldInfo.FieldName), Tag = fieldInfo, EnterMoveNextControl = true }; calcEdit.Properties.AllowNullInput = DefaultBoolean.True; return(calcEdit); }
static void CalcCtrl_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (!(e.KeyChar == (char)Keys.Back || e.KeyChar == (char)Keys.Delete)) { CalcEdit ctrl = sender as CalcEdit; if ((ctrl.Text.Length >= ctrl.Properties.MaxLength) && (ctrl.SelectionLength == 0 || ctrl.SelectedText == ",")) { e.Handled = true; } } }
internal void KeyDownProcess(object sender) { KeyPressEventArgs keyarg; LabelControl btn = (LabelControl)sender; string cmd = Convert.ToString(btn.Tag); string key = btn.Text; switch (cmd) { case "Done": if (this.editControl != null) { if (!string.IsNullOrEmpty(numView.Text)) { this.editControl.Text = Convert.ToString(numView.EditValue); if (this.editControl is CalcEdit) { CalcEdit tbase = (CalcEdit)this.editControl; tbase.EditValue = numView.EditValue; } else if (this.editControl is TextEdit) { TextEdit tbase = (TextEdit)this.editControl; tbase.Text = numView.Text; } } } this.Value = numView.EditValue == null ? 0 : Convert.ToDecimal(numView.EditValue); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); break; case "Exit": this.Close(); break; case "Clear": numView.Text = ""; break; case "Back": keyarg = new KeyPressEventArgs('\x8'); edit.SendKey(edit, keyarg); break; default: keyarg = new KeyPressEventArgs(key[0]); edit.SendKey(edit, keyarg); break; } }
void TienTN_EditValueChanged(object sender, EventArgs e) { CalcEdit calc = sender as CalcEdit; if (calc.Properties.ReadOnly) { return; } drMaster = (data.BsMain.Current as DataRowView).Row; if (drMaster.RowState == DataRowState.Deleted) { return; } }
private void qtyEdit_Validating(object sender, CancelEventArgs e) { WBSline_boi node = gvRelationDetail.GetFocusedRow() as WBSline_boi; CalcEdit edit = sender as CalcEdit; decimal qty = edit.Value; if (node != null) { if (qty < 0) { //edit.ErrorText = "数量不可为负数"; gvRelationDetail.SetColumnError(gvRelationDetail.FocusedColumn, "数量不可为负数"); e.Cancel = true; return; } List <WBSline_boi> lstExceptFocusedRow = viewModel.boq.AllRelationList.FindAll(m => m.ItemNo == node.ItemNo && m.WBSLineNo != node.WBSLineNo); ContractBoi originBoi = viewModel.originContractBoiList.Find(m => m.ItemNo == node.ItemNo); if (lstExceptFocusedRow != null && lstExceptFocusedRow.Count > 0) //如果存在其他相同合同项,判断相同合同项 { decimal remainQty = 0, remainAmount = 0; lstExceptFocusedRow.ForEach(m => { remainQty = remainQty + ObjectHelper.GetDefaultDecimal(m.Qty); remainAmount = remainAmount + ObjectHelper.GetDefaultDecimal(m.Amount); }); remainQty = ObjectHelper.GetDefaultDecimal(originBoi.CtrctQty) - remainQty; remainAmount = ObjectHelper.GetDefaultDecimal(originBoi.CtrctAmount) - remainAmount; if (remainQty - ObjectHelper.GetDefaultDecimal(edit.EditValue) < 0) { gvRelationDetail.SetColumnError(gvRelationDetail.FocusedColumn, "该项的关联数量总值大于该项合同清单数量的总值,请核对后再输入"); //edit.ErrorText = "该项的关联数量总值大于该项合同清单数量的总值,请核对后再输入"; e.Cancel = true; } } else { decimal remainQty = 0, remainAmount = 0; remainQty = ObjectHelper.GetDefaultDecimal(originBoi.CtrctQty); remainAmount = ObjectHelper.GetDefaultDecimal(originBoi.CtrctAmount); if (remainQty - ObjectHelper.GetDefaultDecimal(edit.EditValue) < 0) { gvRelationDetail.SetColumnError(gvRelationDetail.FocusedColumn, "该项的关联数量总值大于该项合同清单数量的总值,请核对后再输入"); //edit.ErrorText = "该项的关联数量总值大于该项合同清单数量的总值,请核对后再输入"; e.Cancel = true; } } } }
public void AddEvent() { gvMain = (data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; ckHoaHong = data.FrmMain.Controls.Find("DaChiHH", true) [0] as CheckEdit; ckHoaHong.EditValueChanged += new EventHandler(ckHoaHong_EditValueChanged); calTienHH = data.FrmMain.Controls.Find("DaChi", true)[0] as CalcEdit; LayoutControl lcMain = data.FrmMain.Controls.Find("lcMain", true)[0] as LayoutControl; SimpleButton btnXuatFile = new SimpleButton(); btnXuatFile.Text = "Xuất ra Excel"; btnXuatFile.Name = "btnXuatFile"; btnXuatFile.Click += new EventHandler(btnXuatFile_Click); LayoutControlItem lci2 = lcMain.AddItem("", btnXuatFile); lci2.Name = "cusXuatFile"; }
// LayoutControl lc; public void AddEvent() { raHinhThuc = data.FrmMain.Controls.Find("HinhThuc", true)[0] as RadioGroup; raHinhThuc.EditValueChanged += new EventHandler(raHinhThuc_EditValueChanged); lc = data.FrmMain.Controls.Find("LcMain", true)[0] as LayoutControl; gv = (data.FrmMain.Controls.Find("GcMain", true)[0] as GridControl).MainView as GridView; raNghiepVu = data.FrmMain.Controls.Find("NghiepVu", true)[0] as RadioGroup; raNghiepVu.EditValueChanged += new EventHandler(raNghiepVu_EditValueChanged); raHTChuyen = data.FrmMain.Controls.Find("HTChuyen", true)[0] as RadioGroup; raHTChuyen.EditValueChanged += new EventHandler(raHTChuyen_EditValueChanged); data.FrmMain.Shown += new EventHandler(FrmMain_Shown); btnDK = data.FrmMain.Controls.Find("HVDK", true)[0] as ButtonEdit; btnCho = data.FrmMain.Controls.Find("DKChoLop", true)[0] as ButtonEdit; btnPhChi = data.FrmMain.Controls.Find("PhieuChi", true)[0] as ButtonEdit; calTLHoan = data.FrmMain.Controls.Find("TLHoan", true)[0] as CalcEdit; calSoTien = data.FrmMain.Controls.Find("SoTienHoan", true)[0] as CalcEdit; mahv = data.FrmMain.Controls.Find("MaHV", true)[0] as GridLookUpEdit; mahv.Popup += new EventHandler(mahv_Popup); malopht = data.FrmMain.Controls.Find("MaLopHT", true)[0] as GridLookUpEdit; hvnhan = data.FrmMain.Controls.Find("HVNhan", true)[0] as GridLookUpEdit; ngaynghi = data.FrmMain.Controls.Find("NgayCL", true)[0] as DateEdit; sbbaoluu = data.FrmMain.Controls.Find("SoBuoiBL", true)[0] as SpinEdit; ttdong = data.FrmMain.Controls.Find("TTDong", true)[0] as CalcEdit; sotienbl = data.FrmMain.Controls.Find("TienBL", true)[0] as CalcEdit; // lg = data.FrmMain.Controls.Find("Root",true)[0] as LayoutGroup; // lc = data.FrmMain.Controls.Find("lcMain",true)[0] as LayoutControl; if (data.BsMain.Current == null) { return; } drMaster = (data.BsMain.Current as DataRowView).Row; if (drMaster.RowState == DataRowState.Deleted) { return; } data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(data.BsMain, new EventArgs()); }
void calSoBo_EditValueChanged(object sender, EventArgs e) { CalcEdit cal = sender as CalcEdit; if (cal.Properties.ReadOnly) { return; } DataSet ds = data.BsMain.DataSource as DataSet; if (ds == null) { return; } DataRow drCurrent; if (data.BsMain.Current == null) { DataTable dt0 = ds.Tables[0]; DataView dv0 = new DataView(dt0); dv0.RowStateFilter = DataViewRowState.Added | DataViewRowState.ModifiedCurrent; if (dv0.Count == 0) { return; } drCurrent = dv0[0].Row; } else { drCurrent = (data.BsMain.Current as DataRowView).Row; } drCurrent["SoLuong"] = cal.EditValue; DataTable dtQT = ds.Tables[1]; DataView dvQT = new DataView(dtQT); dvQT.RowFilter = "HVID = '" + drCurrent["HVID"].ToString() + "'"; foreach (DataRowView drv in dvQT) { if (drv["isQT"].ToString().ToUpper().Equals("FALSE")) { drv["SL"] = cal.EditValue; } } }
public frmTime(Control control, DateTime time) { InitializeComponent(); #region Key events this.Load += new EventHandler(frmKeyboard_Load); this.Deactivate += new EventHandler(frmNumpad_Deactivate); _time = time; numHour.EditValueChanging += new ChangingEventHandler(numYear_EditValueChanging); numHour.EditValueChanged += new EventHandler(numYear_EditValueChanged); numMinute.EditValueChanging += new ChangingEventHandler(numMonth_EditValueChanging); numMinute.EditValueChanged += new EventHandler(numMonth_EditValueChanged); numSecond.EditValueChanging += new ChangingEventHandler(numSecond_EditValueChanging); numHour.GotFocus += new EventHandler(numYear_GotFocus); numMinute.GotFocus += new EventHandler(numMonth_GotFocus); numSecond.GotFocus += new EventHandler(numDay_GotFocus); this.btnKey0.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey1.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey2.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey3.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey4.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey5.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey6.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey7.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey8.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKey9.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyBack.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyClear.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyDot.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyComma.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyDone.MouseDown += new MouseEventHandler(btnKey_MouseDown); this.btnKeyExit.MouseDown += new MouseEventHandler(btnKey_MouseDown); #endregion this.editControl = control; edit = numHour; }
public void AddEvent() { lcMain = data.FrmMain.Controls.Find("lcMain", true) [0] as LayoutControl; SimpleButton btnGetDA = new SimpleButton(); btnGetDA.Name = "btnGetDA"; btnGetDA.Text = " Lấy dự án "; LayoutControlItem lci = lcMain.AddItem("", btnGetDA); lci.Name = "btnGet"; btnGetDA.Click += new EventHandler(btnGetDA_Click); grDA = (data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; SoTT = data.FrmMain.Controls.Find("SoTTrinh", true) [0] as TextEdit; soho = data.FrmMain.Controls.Find("TSoHo", true)[0] as SpinEdit; sold = data.FrmMain.Controls.Find("TSoLDTH", true)[0] as SpinEdit; vonvay = data.FrmMain.Controls.Find("TVonVay", true)[0] as CalcEdit; grNV = data.FrmMain.Controls.Find("NguonVon_TenBP", true) [0] as GridLookUpEdit; grNV.Popup += new EventHandler(grNV_Popup); }
public void AddEvent() { lcMain = data.FrmMain.Controls.Find("lcMain", true) [0] as LayoutControl; SimpleButton btnCalc = new SimpleButton(); btnCalc.Name = "btnCalc"; btnCalc.Text = " Tính tiền phí "; LayoutControlItem lci = lcMain.AddItem("", btnCalc); lci.Name = "lcibtnCal"; btnCalc.Click += new EventHandler(btnCalc_Click); TienTN = data.FrmMain.Controls.Find("TienTN", true) [0] as CalcEdit; TienTN.EditValueChanged += new EventHandler(TienTN_EditValueChanged); gluHoVay = data.FrmMain.Controls.Find("HoVay", true)[0] as GridLookUpEdit; gluHoVay.CloseUp += new DevExpress.XtraEditors.Controls.CloseUpEventHandler(gluHoVay_CloseUp); data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(data.BsMain, new EventArgs()); }
private void InitAdditionalFields() { LabelControl labelSecondName = new LabelControl() { Text = "Отчество", Location = new Point(labelControl1.Location.X, 90) }; this.groupMain.Controls.Add(labelSecondName); TextEdit editSecondName = new TextEdit() { Location = new Point(textEdit1.Location.X, 87), Size = textEdit1.Size }; editSecondName.DataBindings.Add(new Binding("EditValue", bindingSource, "t_employeeSecondName", true)); this.groupMain.Controls.Add(editSecondName); LabelControl labelSalary = new LabelControl() { Text = "Зарплата", Location = new Point(labelControl1.Location.X, 115) }; this.groupMain.Controls.Add(labelSalary); CalcEdit editSalary = new CalcEdit() { Location = new Point(textEdit1.Location.X, 112), Size = textEdit1.Size }; editSalary.DataBindings.Add(new Binding("EditValue", bindingSource, "t_employeeSalary", true)); this.groupMain.Controls.Add(editSalary); LabelControl labelDepartment = new LabelControl() { Text = "Департамент", Location = new Point(labelControl3.Location.X, 60) }; this.groupMain.Controls.Add(labelDepartment); LookUpEdit editDepartment = new LookUpEdit() { Location = new Point(lookUpEdit.Location.X, 57), Size = lookUpEdit.Size }; editDepartment.Properties.Columns.Add(new LookUpColumnInfo("t_departmentName", "Департамент")); editDepartment.Properties.DataSource = Context.t_department.ToList(); editDepartment.DataBindings.Add(new Binding("EditValue", bindingSource, "t_department", true)); this.groupMain.Controls.Add(editDepartment); LabelControl labelHobbies = new LabelControl() { Text = "Увлечения", Location = new Point(labelControl3.Location.X, 90) }; this.groupMain.Controls.Add(labelHobbies); TextEdit editHobbies = new TextEdit() { Location = new Point(lookUpEdit.Location.X, 87), Size = lookUpEdit.Size }; editHobbies.DataBindings.Add(new Binding("EditValue", bindingSource, "t_eployeeHobbies", true)); this.groupMain.Controls.Add(editHobbies); SimpleButton additional = new SimpleButton() { Text = "Изменение навыков", Location = new Point(5, 5), AutoSize = true }; additional.Click += (sender, e) => { using (AddAdditional adds = new AddAdditional()) { adds.Initialize(Context.t_skill.ToList(), this.detailGridControl1.DataSource as List<t_skill>, "t_skillName"); var res = adds.ShowDialog(); if (res == DialogResult.OK) { var col = (adds.listBoxInEntity.DataSource as List<t_skill>).Except((Entity as t_employee).t_employeeSkills.ToList()); if (col.Count() > 0) { foreach (var skill in col) { (Entity as t_employee).t_employeeSkills.Add(skill); } } else { col = (Entity as t_employee).t_employeeSkills.ToList().Except((adds.listBoxInEntity.DataSource as List<t_skill>)); foreach (var skill in col) { (Entity as t_employee).t_employeeSkills.Remove(skill); } } Context.SaveChangesAsync(); this.detailGridControl1.DataSource = (Entity as t_employee).t_employeeSkills.ToList(); } } }; this.panelAditionalButtons.Controls.Add(additional); }
private void InitializeComponent() { this.lMarking = new Label(); this.teMarking = new TextEdit(); this.lLenght = new Label(); this.lHeight = new Label(); this.lWidth = new Label(); this.ceLenght = new CalcEdit(); this.ceHeight = new CalcEdit(); this.ceWidth = new CalcEdit(); this.cbeStatus = new ComboBoxEdit(); this.lStatus = new Label(); this.meComment = new MemoEdit(); this.lComment = new Label(); this.bOK = new Button(); this.blTop = new AtBevel(); this.ceWeight = new CalcEdit(); this.lWeight = new Label(); this.atBevel1 = new AtBevel(); this.atBevel2 = new AtBevel(); this.atBevel3 = new AtBevel(); this.teRow = new TextEdit(); this.label1 = new Label(); this.teCell = new TextEdit(); this.label2 = new Label(); this.atBevel4 = new AtBevel(); this.teMarking.Properties.BeginInit(); this.ceLenght.Properties.BeginInit(); this.ceHeight.Properties.BeginInit(); this.ceWidth.Properties.BeginInit(); this.cbeStatus.Properties.BeginInit(); this.meComment.Properties.BeginInit(); this.ceWeight.Properties.BeginInit(); this.teRow.Properties.BeginInit(); this.teCell.Properties.BeginInit(); this.SuspendLayout(); this.lMarking.AutoSize = true; this.lMarking.Location = new Point(3, 14); this.lMarking.Name = "lMarking"; this.lMarking.Size = new Size(70, 13); this.lMarking.TabIndex = 0; this.lMarking.Text = "Маркировка"; this.teMarking.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.teMarking.Location = new Point(101, 11); this.teMarking.Name = "teMarking"; this.teMarking.Size = new Size(131, 20); this.teMarking.TabIndex = 1; this.lLenght.AutoSize = true; this.lLenght.Location = new Point(3, 50); this.lLenght.Name = "lLenght"; this.lLenght.Size = new Size(40, 13); this.lLenght.TabIndex = 2; this.lLenght.Text = "Длина"; this.lHeight.AutoSize = true; this.lHeight.Location = new Point(3, 76); this.lHeight.Name = "lHeight"; this.lHeight.Size = new Size(45, 13); this.lHeight.TabIndex = 4; this.lHeight.Text = "Высота"; this.lWidth.AutoSize = true; this.lWidth.Location = new Point(3, 102); this.lWidth.Name = "lWidth"; this.lWidth.Size = new Size(46, 13); this.lWidth.TabIndex = 6; this.lWidth.Text = "Ширина"; this.ceLenght.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.ceLenght.Location = new Point(101, 47); this.ceLenght.Name = "ceLenght"; this.ceLenght.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.ceLenght.Size = new Size(131, 20); this.ceLenght.TabIndex = 8; this.ceHeight.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.ceHeight.Location = new Point(101, 73); this.ceHeight.Name = "ceHeight"; this.ceHeight.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.ceHeight.Size = new Size(131, 20); this.ceHeight.TabIndex = 9; this.ceWidth.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.ceWidth.Location = new Point(101, 99); this.ceWidth.Name = "ceWidth"; this.ceWidth.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.ceWidth.Size = new Size(131, 20); this.ceWidth.TabIndex = 10; this.cbeStatus.AllowDrop = true; this.cbeStatus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.cbeStatus.Location = new Point(101, 161); this.cbeStatus.Name = "cbeStatus"; this.cbeStatus.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.cbeStatus.Properties.Items.AddRange(new object[5] { (object)"sdf", (object)"s", (object)"df", (object)"sd", (object)"f" }); this.cbeStatus.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; this.cbeStatus.Size = new Size(131, 20); this.cbeStatus.TabIndex = 11; this.lStatus.AutoSize = true; this.lStatus.Location = new Point(3, 164); this.lStatus.Name = "lStatus"; this.lStatus.Size = new Size(41, 13); this.lStatus.TabIndex = 12; this.lStatus.Text = "Статус"; this.meComment.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; this.meComment.Location = new Point(6, 272); this.meComment.Name = "meComment"; this.meComment.Size = new Size(226, 69); this.meComment.TabIndex = 13; this.lComment.AutoSize = true; this.lComment.Location = new Point(3, 256); this.lComment.Name = "lComment"; this.lComment.Size = new Size(77, 13); this.lComment.TabIndex = 14; this.lComment.Text = "Комментарий"; this.bOK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.bOK.FlatStyle = FlatStyle.Flat; this.bOK.Location = new Point(157, 357); this.bOK.Name = "bOK"; this.bOK.Size = new Size(75, 23); this.bOK.TabIndex = 15; this.bOK.Text = "Ок"; this.bOK.UseVisualStyleBackColor = true; this.bOK.Click += new EventHandler(this.bOK_Click); this.blTop.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.blTop.Location = new Point(6, 37); this.blTop.MaximumSize = new Size(10000, 4); this.blTop.Name = "blTop"; this.blTop.Size = new Size(226, 4); this.blTop.TabIndex = 16; this.ceWeight.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.ceWeight.Location = new Point(101, 125); this.ceWeight.Name = "ceWeight"; this.ceWeight.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.ceWeight.Size = new Size(131, 20); this.ceWeight.TabIndex = 18; this.lWeight.AutoSize = true; this.lWeight.Location = new Point(3, 128); this.lWeight.Name = "lWeight"; this.lWeight.Size = new Size(26, 13); this.lWeight.TabIndex = 17; this.lWeight.Text = "Вес"; this.atBevel1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.atBevel1.Location = new Point(6, 151); this.atBevel1.MaximumSize = new Size(10000, 4); this.atBevel1.Name = "atBevel1"; this.atBevel1.Size = new Size(226, 4); this.atBevel1.TabIndex = 19; this.atBevel2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.atBevel2.Location = new Point(3, 187); this.atBevel2.MaximumSize = new Size(10000, 4); this.atBevel2.Name = "atBevel2"; this.atBevel2.Size = new Size(229, 4); this.atBevel2.TabIndex = 20; this.atBevel3.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; this.atBevel3.Location = new Point(6, 347); this.atBevel3.MaximumSize = new Size(10000, 4); this.atBevel3.Name = "atBevel3"; this.atBevel3.Size = new Size(226, 4); this.atBevel3.TabIndex = 21; this.teRow.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.teRow.Location = new Point(101, 197); this.teRow.Name = "teRow"; this.teRow.Properties.Appearance.BackColor = Color.FromArgb((int)byte.MaxValue, (int)byte.MaxValue, 192); this.teRow.Properties.Appearance.Options.UseBackColor = true; this.teRow.Size = new Size(131, 20); this.teRow.TabIndex = 23; this.label1.AutoSize = true; this.label1.Location = new Point(3, 200); this.label1.Name = "label1"; this.label1.Size = new Size(26, 13); this.label1.TabIndex = 22; this.label1.Text = "Ряд"; this.teCell.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.teCell.Location = new Point(101, 223); this.teCell.Name = "teCell"; this.teCell.Properties.Appearance.BackColor = Color.FromArgb((int)byte.MaxValue, (int)byte.MaxValue, 192); this.teCell.Properties.Appearance.Options.UseBackColor = true; this.teCell.Size = new Size(131, 20); this.teCell.TabIndex = 25; this.label2.AutoSize = true; this.label2.Location = new Point(3, 226); this.label2.Name = "label2"; this.label2.Size = new Size(44, 13); this.label2.TabIndex = 24; this.label2.Text = "Ячейка"; this.atBevel4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.atBevel4.Location = new Point(3, 249); this.atBevel4.MaximumSize = new Size(10000, 4); this.atBevel4.Name = "atBevel4"; this.atBevel4.Size = new Size(229, 4); this.atBevel4.TabIndex = 26; this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.Controls.Add((Control)this.atBevel4); this.Controls.Add((Control)this.teCell); this.Controls.Add((Control)this.label2); this.Controls.Add((Control)this.teRow); this.Controls.Add((Control)this.label1); this.Controls.Add((Control)this.atBevel3); this.Controls.Add((Control)this.atBevel2); this.Controls.Add((Control)this.atBevel1); this.Controls.Add((Control)this.ceWeight); this.Controls.Add((Control)this.lWeight); this.Controls.Add((Control)this.blTop); this.Controls.Add((Control)this.bOK); this.Controls.Add((Control)this.lComment); this.Controls.Add((Control)this.meComment); this.Controls.Add((Control)this.lStatus); this.Controls.Add((Control)this.cbeStatus); this.Controls.Add((Control)this.ceWidth); this.Controls.Add((Control)this.ceHeight); this.Controls.Add((Control)this.ceLenght); this.Controls.Add((Control)this.lWidth); this.Controls.Add((Control)this.lHeight); this.Controls.Add((Control)this.lLenght); this.Controls.Add((Control)this.teMarking); this.Controls.Add((Control)this.lMarking); this.MinimumSize = new Size(235, 335); this.Name = "GoodBufferEdit"; this.Size = new Size(235, 390); this.teMarking.Properties.EndInit(); this.ceLenght.Properties.EndInit(); this.ceHeight.Properties.EndInit(); this.ceWidth.Properties.EndInit(); this.cbeStatus.Properties.EndInit(); this.meComment.Properties.EndInit(); this.ceWeight.Properties.EndInit(); this.teRow.Properties.EndInit(); this.teCell.Properties.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
public static void SetBarcodeEvent(CalcEdit edit) { edit.KeyUp += delegate(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.Enter) { System.Windows.Forms.SendKeys.Send("{TAB}"); } }; }
private void InitializeComponent() { this.pBottom = new Panel(); this.pTop = new Panel(); this.bOk = new Button(); this.button2 = new Button(); this.calcEditWaste5 = new CalcEdit(); this.calcEditWaste4 = new CalcEdit(); this.calcEditWaste3 = new CalcEdit(); this.calcEditWaste2 = new CalcEdit(); this.calcEditWaste1 = new CalcEdit(); this.label37 = new Label(); this.label36 = new Label(); this.label35 = new Label(); this.label34 = new Label(); this.label16 = new Label(); this.pBottom.SuspendLayout(); this.pTop.SuspendLayout(); this.calcEditWaste5.Properties.BeginInit(); this.calcEditWaste4.Properties.BeginInit(); this.calcEditWaste3.Properties.BeginInit(); this.calcEditWaste2.Properties.BeginInit(); this.calcEditWaste1.Properties.BeginInit(); this.SuspendLayout(); this.pBottom.Controls.Add((Control)this.button2); this.pBottom.Controls.Add((Control)this.bOk); this.pBottom.Dock = DockStyle.Bottom; this.pBottom.Location = new Point(0, 141); this.pBottom.Name = "pBottom"; this.pBottom.Size = new Size(176, 39); this.pBottom.TabIndex = 0; this.pTop.Controls.Add((Control)this.calcEditWaste5); this.pTop.Controls.Add((Control)this.calcEditWaste4); this.pTop.Controls.Add((Control)this.calcEditWaste3); this.pTop.Controls.Add((Control)this.calcEditWaste2); this.pTop.Controls.Add((Control)this.calcEditWaste1); this.pTop.Controls.Add((Control)this.label37); this.pTop.Controls.Add((Control)this.label36); this.pTop.Controls.Add((Control)this.label35); this.pTop.Controls.Add((Control)this.label34); this.pTop.Controls.Add((Control)this.label16); this.pTop.Dock = DockStyle.Fill; this.pTop.Location = new Point(0, 0); this.pTop.Name = "pTop"; this.pTop.Size = new Size(176, 141); this.pTop.TabIndex = 1; this.bOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.bOk.DialogResult = DialogResult.OK; this.bOk.FlatStyle = FlatStyle.Flat; this.bOk.Location = new Point(93, 7); this.bOk.Name = "bOk"; this.bOk.Size = new Size(75, 23); this.bOk.TabIndex = 0; this.bOk.Text = "Выбрать"; this.bOk.UseVisualStyleBackColor = true; this.button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.button2.DialogResult = DialogResult.Cancel; this.button2.FlatStyle = FlatStyle.Flat; this.button2.Location = new Point(12, 7); this.button2.Name = "button2"; this.button2.Size = new Size(75, 23); this.button2.TabIndex = 0; this.button2.Text = "Отменить"; this.button2.UseVisualStyleBackColor = true; this.calcEditWaste5.Location = new Point(79, 111); this.calcEditWaste5.Name = "calcEditWaste5"; this.calcEditWaste5.Properties.BorderStyle = BorderStyles.Simple; this.calcEditWaste5.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.calcEditWaste5.Size = new Size(82, 20); this.calcEditWaste5.TabIndex = 27; this.calcEditWaste4.Location = new Point(79, 85); this.calcEditWaste4.Name = "calcEditWaste4"; this.calcEditWaste4.Properties.BorderStyle = BorderStyles.Simple; this.calcEditWaste4.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.calcEditWaste4.Size = new Size(82, 20); this.calcEditWaste4.TabIndex = 28; this.calcEditWaste3.Location = new Point(79, 61); this.calcEditWaste3.Name = "calcEditWaste3"; this.calcEditWaste3.Properties.BorderStyle = BorderStyles.Simple; this.calcEditWaste3.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.calcEditWaste3.Size = new Size(82, 20); this.calcEditWaste3.TabIndex = 26; this.calcEditWaste2.Location = new Point(79, 34); this.calcEditWaste2.Name = "calcEditWaste2"; this.calcEditWaste2.Properties.BorderStyle = BorderStyles.Simple; this.calcEditWaste2.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.calcEditWaste2.Size = new Size(82, 20); this.calcEditWaste2.TabIndex = 24; this.calcEditWaste1.Location = new Point(79, 8); this.calcEditWaste1.Name = "calcEditWaste1"; this.calcEditWaste1.Properties.BorderStyle = BorderStyles.Simple; this.calcEditWaste1.Properties.Buttons.AddRange(new EditorButton[1] { new EditorButton(ButtonPredefines.Combo) }); this.calcEditWaste1.Size = new Size(82, 20); this.calcEditWaste1.TabIndex = 25; this.label37.AutoSize = true; this.label37.Location = new Point(12, 114); this.label37.Name = "label37"; this.label37.Size = new Size(61, 13); this.label37.TabIndex = 32; this.label37.Text = "% отхода 5"; this.label36.AutoSize = true; this.label36.Location = new Point(12, 88); this.label36.Name = "label36"; this.label36.Size = new Size(61, 13); this.label36.TabIndex = 33; this.label36.Text = "% отхода 4"; this.label35.AutoSize = true; this.label35.Location = new Point(12, 64); this.label35.Name = "label35"; this.label35.Size = new Size(61, 13); this.label35.TabIndex = 31; this.label35.Text = "% отхода 3"; this.label34.AutoSize = true; this.label34.Location = new Point(12, 37); this.label34.Name = "label34"; this.label34.Size = new Size(61, 13); this.label34.TabIndex = 29; this.label34.Text = "% отхода 2"; this.label16.AutoSize = true; this.label16.Location = new Point(12, 11); this.label16.Name = "label16"; this.label16.Size = new Size(61, 13); this.label16.TabIndex = 30; this.label16.Text = "% отхода 1"; this.AutoScaleDimensions = new SizeF(6f, 13f); this.AutoScaleMode = AutoScaleMode.Font; this.Controls.Add((Control)this.pTop); this.Controls.Add((Control)this.pBottom); this.MaximumSize = new Size(176, 180); this.MinimumSize = new Size(176, 180); this.Name = "GoodOptimOutSettings"; this.Size = new Size(176, 180); this.Text = "Настройки процентов отхода"; this.pBottom.ResumeLayout(false); this.pTop.ResumeLayout(false); this.pTop.PerformLayout(); this.calcEditWaste5.Properties.EndInit(); this.calcEditWaste4.Properties.EndInit(); this.calcEditWaste3.Properties.EndInit(); this.calcEditWaste2.Properties.EndInit(); this.calcEditWaste1.Properties.EndInit(); this.ResumeLayout(false); }
public void AddEvent() { nfi.CurrencyDecimalSeparator = "."; nfi.CurrencyGroupSeparator = ","; lc = data.FrmMain.Controls.Find("LcMain", true)[0] as LayoutControl; data.FrmMain.Shown += new EventHandler(FrmMain_Shown); gv = (data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; //Ẩn hiện layout raGroup = data.FrmMain.Controls.Find("NguonHV", true)[0] as RadioGroup; if (raGroup != null) { raGroup.EditValueChanged += new EventHandler(raGroup_EditValueChanged); } raHTMUA = data.FrmMain.Controls.Find("HTMua", true)[0] as RadioGroup; if (raHTMUA != null) { raHTMUA.EditValueChanged += new EventHandler(raHTMUA_EditValueChanged); } //ActiveFilterString gridLKHVDK = data.FrmMain.Controls.Find("MaHVDK", true)[0] as GridLookUpEdit; gridLKHVDK.Popup += new EventHandler(gridLKHVDK_Popup); gridLKHVTV = data.FrmMain.Controls.Find("HVTVID", true)[0] as GridLookUpEdit; gridLKHVTV.Popup += new EventHandler(gridLKHVTV_Popup); //Khắc phục trường hợp ko tự nhảy theo công thức gridLKHVTV.EditValueChanged += new EventHandler(gridLKHVTV_EditValueChanged); CalcEdit calSoBo = data.FrmMain.Controls.Find("SoLuong", true)[0] as CalcEdit; calSoBo.EditValueChanged += new EventHandler(calSoBo_EditValueChanged); //////////////////// mới thêm xử lý cho chuyển lớp dùng quy trình (nhập học phí cột bảo lưu ko thay đổi ), xử lý cột bảo lưu CalcEdit calThucThu = data.FrmMain.Controls.Find("ThucThu", true)[0] as CalcEdit; calThucThu.EditValueChanged += new EventHandler(calThucThu_EditValueChanged); //Chỉ hiển thị các lớp để đăng ký là lớp đang học GridLookUpEdit gridLKMaLop = data.FrmMain.Controls.Find("MaLop", true)[0] as GridLookUpEdit; gridLKMaLop.Popup += new EventHandler(gridLKMaLop_Popup); gridLKMaLop.Leave += new EventHandler(gridLKMaLop_Leave); // Bổ sung cho trường hợp get focus cho cải tiến 1 và 2 HPThucNop = data.FrmMain.Controls.Find("ThucThu", true)[0] as CalcEdit; GiamHP = data.FrmMain.Controls.Find("GiamHP", true)[0] as CalcEdit; GiamHP.Leave += new EventHandler(GiamHP_Leave); NgayDK = data.FrmMain.Controls.Find("NgayDK", true)[0] as DateEdit; MaHVTV = data.FrmMain.Controls.Find("MaHVTV", true)[0] as TextEdit; //tạo mã học viên if (data.BsMain.Current == null) // mới thêm để khi chạy thiết lập quy trình từ chuyển lớp k bị lỗi { return; } data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(data.BsMain, new EventArgs()); drMaster = (data.BsMain.Current as DataRowView).Row; if (drMaster.RowState == DataRowState.Deleted) { return; } }
public static void SetDecimal(CalcEdit edit, decimal? value) { if (value == null) { edit.EditValue = null; } else { edit.Value = value.Value; } }
void numDay_GotFocus(object sender, EventArgs e) { edit = (CalcEdit)sender; }
public static decimal? GetDecimal(CalcEdit edit) { if (edit.EditValue == null) return null; return edit.Value; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> protected void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.barManager1 = new DevExpress.XtraBars.BarManager(this.components); this.MainBar = new DevExpress.XtraBars.Bar(); this.barButtonItemAdd = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemXem = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemDelete = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemUpdate = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemPrint = new DevExpress.XtraBars.BarButtonItem(); this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components); this.barButtonItem4 = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemCommit = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItemNoCommit = new DevExpress.XtraBars.BarButtonItem(); this.barSubItem1 = new DevExpress.XtraBars.BarSubItem(); this.barButtonItemSearch = new DevExpress.XtraBars.BarButtonItem(); this.popupMenuFilter = new DevExpress.XtraBars.PopupMenu(this.components); this.barCheckItemFilter = new DevExpress.XtraBars.BarCheckItem(); this.barButtonItemClose = new DevExpress.XtraBars.BarButtonItem(); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.barStaticItem1 = new DevExpress.XtraBars.BarStaticItem(); this.barButtonItem1 = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItem2 = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItem3 = new DevExpress.XtraBars.BarButtonItem(); this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl(); this.gridControlMaster = new DevExpress.XtraGrid.GridControl(); this.gridViewMaster = new DevExpress.XtraGrid.Views.Grid.PLGridView(); this.Cot_MaHoSo = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_TenUngVien = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_TTHS = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_SoNgay = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_TuNgay = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_DenNgay = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_SoNgayLamViec = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_SoNgayConLai = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_KetThuc = new DevExpress.XtraGrid.Columns.GridColumn(); this.Cot_GhiChu = new DevExpress.XtraGrid.Columns.GridColumn(); this.xtraTabControlDetail = new DevExpress.XtraTab.XtraTabControl(); this.xtraTabPageDetail = new DevExpress.XtraTab.XtraTabPage(); this.gridControlDetail = new DevExpress.XtraGrid.GridControl(); this.gridViewDetail = new DevExpress.XtraGrid.Views.Grid.PLGridView(); this.repositoryItemButtonEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); this.repositoryItemImageComboBox1 = new DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox(); this.popupControlContainerFilter = new DevExpress.XtraBars.PopupControlContainer(this.components); this.SoNgayKetThuc = new DevExpress.XtraEditors.CalcEdit(); this.TinhTrangHoSo = new ProtocolVN.Framework.Win.PLCombobox(); this.TenUngVien = new ProtocolVN.Framework.Win.PLCombobox(); this.MaHoSo = new DevExpress.XtraEditors.TextEdit(); this.DenNgay = new DevExpress.XtraEditors.DateEdit(); this.TuNgay = new DevExpress.XtraEditors.DateEdit(); this.label8 = new System.Windows.Forms.PLLabel (); this.label4 = new System.Windows.Forms.PLLabel (); this.label5 = new System.Windows.Forms.PLLabel (); this.label2 = new System.Windows.Forms.PLLabel (); this.label3 = new System.Windows.Forms.PLLabel (); this.label1 = new System.Windows.Forms.PLLabel (); this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenuFilter)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit(); this.splitContainerControl1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridControlMaster)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridViewMaster)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xtraTabControlDetail)).BeginInit(); this.xtraTabControlDetail.SuspendLayout(); this.xtraTabPageDetail.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridControlDetail)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridViewDetail)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemImageComboBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.popupControlContainerFilter)).BeginInit(); this.popupControlContainerFilter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.SoNgayKetThuc.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.MaHoSo.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DenNgay.Properties.VistaTimeProperties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DenNgay.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.TuNgay.Properties.VistaTimeProperties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.TuNgay.Properties)).BeginInit(); this.SuspendLayout(); // // barManager1 // this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] { this.MainBar}); this.barManager1.DockControls.Add(this.barDockControlTop); this.barManager1.DockControls.Add(this.barDockControlBottom); this.barManager1.DockControls.Add(this.barDockControlLeft); this.barManager1.DockControls.Add(this.barDockControlRight); this.barManager1.Form = this; this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.barButtonItemAdd, this.barButtonItemDelete, this.barButtonItemUpdate, this.barButtonItemPrint, this.barStaticItem1, this.barButtonItem1, this.barButtonItem2, this.barButtonItemCommit, this.barButtonItemNoCommit, this.barSubItem1, this.barButtonItemXem, this.barButtonItemSearch, this.barButtonItemClose, this.barCheckItemFilter, this.barButtonItem3, this.barButtonItem4}); this.barManager1.MaxItemId = 35; // // MainBar // this.MainBar.BarName = "MainBar"; this.MainBar.DockCol = 0; this.MainBar.DockRow = 0; this.MainBar.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; this.MainBar.FloatLocation = new System.Drawing.Point(39, 133); this.MainBar.FloatSize = new System.Drawing.Size(72, 73); this.MainBar.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.Caption, this.barButtonItemAdd, "&Thêm"), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemXem), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemDelete), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemUpdate), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemPrint, true), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemCommit, true), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemNoCommit), new DevExpress.XtraBars.LinkPersistInfo(this.barSubItem1), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemSearch, true), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItemClose, true)}); this.MainBar.OptionsBar.AllowQuickCustomization = false; this.MainBar.OptionsBar.DrawDragBorder = false; this.MainBar.OptionsBar.RotateWhenVertical = false; this.MainBar.OptionsBar.UseWholeRow = true; this.MainBar.Text = "Custom 1"; // // barButtonItemAdd // this.barButtonItemAdd.Caption = "Thêm"; this.barButtonItemAdd.Id = 0; this.barButtonItemAdd.Name = "barButtonItemAdd"; this.barButtonItemAdd.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemXem // this.barButtonItemXem.Caption = "X&em"; this.barButtonItemXem.Id = 24; this.barButtonItemXem.Name = "barButtonItemXem"; this.barButtonItemXem.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemDelete // this.barButtonItemDelete.Caption = "&Xóa"; this.barButtonItemDelete.Id = 1; this.barButtonItemDelete.Name = "barButtonItemDelete"; this.barButtonItemDelete.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemUpdate // this.barButtonItemUpdate.Caption = "&Sửa"; this.barButtonItemUpdate.Id = 2; this.barButtonItemUpdate.Name = "barButtonItemUpdate"; this.barButtonItemUpdate.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemPrint // this.barButtonItemPrint.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown; this.barButtonItemPrint.Caption = "&In"; this.barButtonItemPrint.DropDownControl = this.popupMenu1; this.barButtonItemPrint.Id = 3; this.barButtonItemPrint.Name = "barButtonItemPrint"; this.barButtonItemPrint.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // popupMenu1 // this.popupMenu1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem4)}); this.popupMenu1.Manager = this.barManager1; this.popupMenu1.Name = "popupMenu1"; // // barButtonItem4 // this.barButtonItem4.Caption = "Xem t&rước"; this.barButtonItem4.Id = 33; this.barButtonItem4.Name = "barButtonItem4"; // // barButtonItemCommit // this.barButtonItemCommit.Caption = "&Duyệt"; this.barButtonItemCommit.Id = 17; this.barButtonItemCommit.Name = "barButtonItemCommit"; this.barButtonItemCommit.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemNoCommit // this.barButtonItemNoCommit.Caption = "&Không duyệt"; this.barButtonItemNoCommit.Id = 18; this.barButtonItemNoCommit.Name = "barButtonItemNoCommit"; this.barButtonItemNoCommit.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barSubItem1 // this.barSubItem1.Caption = "&Nghiệp vụ"; this.barSubItem1.Id = 20; this.barSubItem1.Name = "barSubItem1"; this.barSubItem1.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemSearch // this.barButtonItemSearch.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown; this.barButtonItemSearch.Caption = "Tì&m kiếm"; this.barButtonItemSearch.DropDownControl = this.popupMenuFilter; this.barButtonItemSearch.Id = 27; this.barButtonItemSearch.Name = "barButtonItemSearch"; this.barButtonItemSearch.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // popupMenuFilter // this.popupMenuFilter.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(this.barCheckItemFilter)}); this.popupMenuFilter.Manager = this.barManager1; this.popupMenuFilter.Name = "popupMenuFilter"; // // barCheckItemFilter // this.barCheckItemFilter.Caption = "Điề&u kiện tìm kiếm"; this.barCheckItemFilter.Checked = true; this.barCheckItemFilter.Id = 29; this.barCheckItemFilter.Name = "barCheckItemFilter"; this.barCheckItemFilter.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barButtonItemClose // this.barButtonItemClose.Caption = "Đón&g"; this.barButtonItemClose.Id = 28; this.barButtonItemClose.Name = "barButtonItemClose"; this.barButtonItemClose.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; // // barStaticItem1 // this.barStaticItem1.AutoSize = DevExpress.XtraBars.BarStaticItemSize.None; this.barStaticItem1.Border = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.barStaticItem1.Id = 13; this.barStaticItem1.Name = "barStaticItem1"; this.barStaticItem1.TextAlignment = System.Drawing.StringAlignment.Near; this.barStaticItem1.Width = 100; // // barButtonItem1 // this.barButtonItem1.Caption = "barButtonItem1"; this.barButtonItem1.Id = 14; this.barButtonItem1.Name = "barButtonItem1"; // // barButtonItem2 // this.barButtonItem2.Caption = "barButtonItem2"; this.barButtonItem2.Id = 15; this.barButtonItem2.Name = "barButtonItem2"; // // barButtonItem3 // this.barButtonItem3.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown; this.barButtonItem3.Caption = "In"; this.barButtonItem3.Id = 30; this.barButtonItem3.Name = "barButtonItem3"; // // splitContainerControl1 // this.splitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainerControl1.Horizontal = false; this.splitContainerControl1.Location = new System.Drawing.Point(0, 87); this.splitContainerControl1.Name = "splitContainerControl1"; this.splitContainerControl1.Panel1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.splitContainerControl1.Panel1.Controls.Add(this.gridControlMaster); this.splitContainerControl1.Panel1.Text = "splitContainerControl1_Panel1"; this.splitContainerControl1.Panel2.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.splitContainerControl1.Panel2.CaptionLocation = DevExpress.Utils.Locations.Left; this.splitContainerControl1.Panel2.Controls.Add(this.xtraTabControlDetail); this.splitContainerControl1.Panel2.ShowCaption = true; this.splitContainerControl1.Panel2.Text = "splitContainerControl1_Panel2"; this.splitContainerControl1.Size = new System.Drawing.Size(804, 410); this.splitContainerControl1.SplitterPosition = 175; this.splitContainerControl1.TabIndex = 4; this.splitContainerControl1.Text = "splitContainerControl1"; // // gridControlMaster // this.gridControlMaster.Dock = System.Windows.Forms.DockStyle.Fill; this.gridControlMaster.Location = new System.Drawing.Point(0, 0); this.gridControlMaster.MainView = this.gridViewMaster; this.gridControlMaster.Name = "gridControlMaster"; this.gridControlMaster.Size = new System.Drawing.Size(804, 175); this.gridControlMaster.TabIndex = 0; this.gridControlMaster.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridViewMaster}); // // gridViewMaster // this.gridViewMaster.Appearance.GroupPanel.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Inch); this.gridViewMaster.Appearance.GroupPanel.Options.UseFont = true; this.gridViewMaster.Appearance.HeaderPanel.Options.UseTextOptions = true; this.gridViewMaster.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridViewMaster.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.Cot_MaHoSo, this.Cot_TenUngVien, this.Cot_TTHS, this.Cot_SoNgay, this.Cot_TuNgay, this.Cot_DenNgay, this.Cot_SoNgayLamViec, this.Cot_SoNgayConLai, this.Cot_KetThuc, this.Cot_GhiChu}); this.gridViewMaster.GridControl = this.gridControlMaster; this.gridViewMaster.GroupPanelText = "Các phiếu mua hàng thỏa điều kiện tìm kiếm"; this.gridViewMaster.IndicatorWidth = 40; this.gridViewMaster.Name = "gridViewMaster"; this.gridViewMaster.NewItemRowText = "Nhập dữ liệu mới tại đây"; this.gridViewMaster.OptionsFilter.UseNewCustomFilterDialog = true; this.gridViewMaster.OptionsLayout.Columns.AddNewColumns = false; this.gridViewMaster.OptionsNavigation.AutoFocusNewRow = true; this.gridViewMaster.OptionsNavigation.EnterMoveNextColumn = true; this.gridViewMaster.OptionsSelection.MultiSelect = true; this.gridViewMaster.OptionsView.EnableAppearanceEvenRow = true; this.gridViewMaster.OptionsView.EnableAppearanceOddRow = true; this.gridViewMaster.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom; this.gridViewMaster.OptionsView.ShowGroupedColumns = true; // // Cot_MaHoSo // this.Cot_MaHoSo.Caption = "Mã hồ sơ"; this.Cot_MaHoSo.Name = "Cot_MaHoSo"; this.Cot_MaHoSo.Visible = true; this.Cot_MaHoSo.VisibleIndex = 0; this.Cot_MaHoSo.Width = 55; // // Cot_TenUngVien // this.Cot_TenUngVien.Caption = "Tên ứng viên"; this.Cot_TenUngVien.Name = "Cot_TenUngVien"; this.Cot_TenUngVien.Visible = true; this.Cot_TenUngVien.VisibleIndex = 1; // // Cot_TTHS // this.Cot_TTHS.Caption = "Tình trạng hồ sơ"; this.Cot_TTHS.Name = "Cot_TTHS"; this.Cot_TTHS.Visible = true; this.Cot_TTHS.VisibleIndex = 3; this.Cot_TTHS.Width = 90; // // Cot_SoNgay // this.Cot_SoNgay.Caption = "Số ngày"; this.Cot_SoNgay.Name = "Cot_SoNgay"; this.Cot_SoNgay.Visible = true; this.Cot_SoNgay.VisibleIndex = 2; this.Cot_SoNgay.Width = 51; // // Cot_TuNgay // this.Cot_TuNgay.Caption = "Ngày bắt đầu"; this.Cot_TuNgay.Name = "Cot_TuNgay"; this.Cot_TuNgay.Visible = true; this.Cot_TuNgay.VisibleIndex = 4; this.Cot_TuNgay.Width = 77; // // Cot_DenNgay // this.Cot_DenNgay.Caption = "Ngày kết thúc"; this.Cot_DenNgay.Name = "Cot_DenNgay"; this.Cot_DenNgay.Visible = true; this.Cot_DenNgay.VisibleIndex = 5; this.Cot_DenNgay.Width = 79; // // Cot_SoNgayLamViec // this.Cot_SoNgayLamViec.Caption = "Số ngày đi làm"; this.Cot_SoNgayLamViec.Name = "Cot_SoNgayLamViec"; this.Cot_SoNgayLamViec.Visible = true; this.Cot_SoNgayLamViec.VisibleIndex = 6; this.Cot_SoNgayLamViec.Width = 81; // // Cot_SoNgayConLai // this.Cot_SoNgayConLai.Caption = "Số ngày còn lại"; this.Cot_SoNgayConLai.Name = "Cot_SoNgayConLai"; this.Cot_SoNgayConLai.Visible = true; this.Cot_SoNgayConLai.VisibleIndex = 7; this.Cot_SoNgayConLai.Width = 84; // // Cot_KetThuc // this.Cot_KetThuc.Caption = "Kết thúc"; this.Cot_KetThuc.Name = "Cot_KetThuc"; this.Cot_KetThuc.Visible = true; this.Cot_KetThuc.VisibleIndex = 8; this.Cot_KetThuc.Width = 52; // // Cot_GhiChu // this.Cot_GhiChu.Caption = "Ghi chú"; this.Cot_GhiChu.Name = "Cot_GhiChu"; this.Cot_GhiChu.Visible = true; this.Cot_GhiChu.VisibleIndex = 9; this.Cot_GhiChu.Width = 47; // // xtraTabControlDetail // this.xtraTabControlDetail.Dock = System.Windows.Forms.DockStyle.Fill; this.xtraTabControlDetail.Location = new System.Drawing.Point(0, 0); this.xtraTabControlDetail.Name = "xtraTabControlDetail"; this.xtraTabControlDetail.SelectedTabPage = this.xtraTabPageDetail; this.xtraTabControlDetail.Size = new System.Drawing.Size(804, 229); this.xtraTabControlDetail.TabIndex = 0; this.xtraTabControlDetail.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { this.xtraTabPageDetail}); // // xtraTabPageDetail // this.xtraTabPageDetail.Controls.Add(this.gridControlDetail); this.xtraTabPageDetail.Name = "xtraTabPageDetail"; this.xtraTabPageDetail.Size = new System.Drawing.Size(795, 198); this.xtraTabPageDetail.Text = "Chi tiết"; // // gridControlDetail // this.gridControlDetail.Dock = System.Windows.Forms.DockStyle.Fill; this.gridControlDetail.Location = new System.Drawing.Point(0, 0); this.gridControlDetail.MainView = this.gridViewDetail; this.gridControlDetail.Name = "gridControlDetail"; this.gridControlDetail.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemButtonEdit1, this.repositoryItemImageComboBox1}); this.gridControlDetail.Size = new System.Drawing.Size(795, 198); this.gridControlDetail.TabIndex = 0; this.gridControlDetail.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridViewDetail}); // // gridViewDetail // this.gridViewDetail.Appearance.HeaderPanel.Options.UseTextOptions = true; this.gridViewDetail.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.gridViewDetail.GridControl = this.gridControlDetail; this.gridViewDetail.IndicatorWidth = 40; this.gridViewDetail.Name = "gridViewDetail"; this.gridViewDetail.NewItemRowText = "Nhập dữ liệu mới tại đây"; this.gridViewDetail.OptionsFilter.UseNewCustomFilterDialog = true; this.gridViewDetail.OptionsLayout.Columns.AddNewColumns = false; this.gridViewDetail.OptionsNavigation.AutoFocusNewRow = true; this.gridViewDetail.OptionsNavigation.EnterMoveNextColumn = true; this.gridViewDetail.OptionsView.EnableAppearanceEvenRow = true; this.gridViewDetail.OptionsView.EnableAppearanceOddRow = true; this.gridViewDetail.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom; this.gridViewDetail.OptionsView.ShowGroupedColumns = true; this.gridViewDetail.OptionsView.ShowGroupPanel = false; // // repositoryItemButtonEdit1 // this.repositoryItemButtonEdit1.AutoHeight = false; this.repositoryItemButtonEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton()}); this.repositoryItemButtonEdit1.Name = "repositoryItemButtonEdit1"; // // repositoryItemImageComboBox1 // this.repositoryItemImageComboBox1.AutoHeight = false; this.repositoryItemImageComboBox1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.repositoryItemImageComboBox1.Name = "repositoryItemImageComboBox1"; // // popupControlContainerFilter // this.popupControlContainerFilter.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.popupControlContainerFilter.Controls.Add(this.SoNgayKetThuc); this.popupControlContainerFilter.Controls.Add(this.TinhTrangHoSo); this.popupControlContainerFilter.Controls.Add(this.TenUngVien); this.popupControlContainerFilter.Controls.Add(this.MaHoSo); this.popupControlContainerFilter.Controls.Add(this.DenNgay); this.popupControlContainerFilter.Controls.Add(this.TuNgay); this.popupControlContainerFilter.Controls.Add(this.label8); this.popupControlContainerFilter.Controls.Add(this.label4); this.popupControlContainerFilter.Controls.Add(this.label5); this.popupControlContainerFilter.Controls.Add(this.label2); this.popupControlContainerFilter.Controls.Add(this.label3); this.popupControlContainerFilter.Controls.Add(this.label1); this.popupControlContainerFilter.Dock = System.Windows.Forms.DockStyle.Top; this.popupControlContainerFilter.Location = new System.Drawing.Point(0, 24); this.popupControlContainerFilter.Manager = this.barManager1; this.popupControlContainerFilter.Name = "popupControlContainerFilter"; this.popupControlContainerFilter.Size = new System.Drawing.Size(804, 63); this.popupControlContainerFilter.TabIndex = 0; this.popupControlContainerFilter.Visible = false; // // SoNgayKetThuc // this.SoNgayKetThuc.Location = new System.Drawing.Point(722, 6); this.SoNgayKetThuc.Name = "SoNgayKetThuc"; this.SoNgayKetThuc.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.SoNgayKetThuc.Size = new System.Drawing.Size(70, 20); this.SoNgayKetThuc.TabIndex = 6; // // TinhTrangHoSo // this.TinhTrangHoSo.DataSource = null; this.TinhTrangHoSo.DisplayField = null; this.TinhTrangHoSo.Location = new System.Drawing.Point(402, 6); this.TinhTrangHoSo.Name = "TinhTrangHoSo"; this.TinhTrangHoSo.Size = new System.Drawing.Size(204, 21); this.TinhTrangHoSo.TabIndex = 5; this.TinhTrangHoSo.ValueField = null; // // TenUngVien // this.TenUngVien.DataSource = null; this.TenUngVien.DisplayField = null; this.TenUngVien.Location = new System.Drawing.Point(90, 34); this.TenUngVien.Name = "TenUngVien"; this.TenUngVien.Size = new System.Drawing.Size(204, 21); this.TenUngVien.TabIndex = 5; this.TenUngVien.ValueField = null; // // MaHoSo // this.MaHoSo.Location = new System.Drawing.Point(90, 6); this.MaHoSo.Name = "MaHoSo"; this.MaHoSo.Properties.MaxLength = 100; this.MaHoSo.Size = new System.Drawing.Size(204, 20); this.MaHoSo.TabIndex = 0; // // DenNgay // this.DenNgay.EditValue = null; this.DenNgay.Location = new System.Drawing.Point(519, 34); this.DenNgay.Name = "DenNgay"; this.DenNgay.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.DenNgay.Properties.VistaTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton()}); this.DenNgay.Size = new System.Drawing.Size(87, 20); this.DenNgay.TabIndex = 3; // // TuNgay // this.TuNgay.EditValue = null; this.TuNgay.Location = new System.Drawing.Point(402, 34); this.TuNgay.Name = "TuNgay"; this.TuNgay.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.TuNgay.Properties.VistaTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton()}); this.TuNgay.Size = new System.Drawing.Size(88, 20); this.TuNgay.TabIndex = 2; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(491, 38); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(27, 13); this.label8.TabIndex = 3; this.label8.Text = "Đến"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(316, 38); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(47, 13); this.label4.TabIndex = 2; this.label4.Text = "Từ ngày"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(628, 10); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(88, 13); this.label5.TabIndex = 5; this.label5.Text = "Số ngày kết thúc"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(316, 10); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(85, 13); this.label2.TabIndex = 5; this.label2.Text = "Tình trạng hồ sơ"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(4, 10); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(50, 13); this.label3.TabIndex = 0; this.label3.Text = "Mã hồ sơ"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 38); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(84, 13); this.label1.TabIndex = 5; this.label1.Text = "Họ tên ứng viên"; // // gridColumn8 // this.gridColumn8.Caption = "VAT"; this.gridColumn8.Name = "gridColumn8"; this.gridColumn8.Visible = true; this.gridColumn8.VisibleIndex = 5; // // gridColumn6 // this.gridColumn6.Caption = "VAT"; this.gridColumn6.Name = "gridColumn6"; this.gridColumn6.Visible = true; this.gridColumn6.VisibleIndex = 5; this.gridColumn6.Width = 96; // // frmTheoDoi_TT_HL_TVQL // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(804, 497); this.Controls.Add(this.splitContainerControl1); this.Controls.Add(this.popupControlContainerFilter); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "frmTheoDoi_TT_HL_TVQL"; this.Text = "Quản lý phiếu mua hàng của nhà cung cấp"; ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.popupMenuFilter)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).EndInit(); this.splitContainerControl1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridControlMaster)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridViewMaster)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xtraTabControlDetail)).EndInit(); this.xtraTabControlDetail.ResumeLayout(false); this.xtraTabPageDetail.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridControlDetail)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridViewDetail)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemButtonEdit1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemImageComboBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.popupControlContainerFilter)).EndInit(); this.popupControlContainerFilter.ResumeLayout(false); this.popupControlContainerFilter.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.SoNgayKetThuc.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.MaHoSo.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DenNgay.Properties.VistaTimeProperties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DenNgay.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.TuNgay.Properties.VistaTimeProperties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.TuNgay.Properties)).EndInit(); this.ResumeLayout(false); }
public InputParametersControl(IList <InputParameter> inputParameters) { InitializeComponent(); _inputParameterEditors = new List <BaseEdit>(); _inputParameters = inputParameters; foreach (var inputParameter in inputParameters) { LayoutControlItem colItem = layoutControl.Root.AddItem(); colItem.Name = inputParameter.DisplayName; var inputParameterEditor = new CalcEdit(); _inputParameterEditors.Add(inputParameterEditor); inputParameterEditor.Name = inputParameter.Name; inputParameterEditor.Validating += onEditorValidating; inputParameterEditor.EditValueChanged += onInputParameterEditorEditValueChanged; if (inputParameter.Value != null) { inputParameterEditor.EditValue = inputParameter.Value; } inputParameterEditor.Properties.AllowNullInput = DefaultBoolean.False; if (!String.IsNullOrEmpty(inputParameter.Unit.Name)) { inputParameterEditor.Properties.EditMask = String.Format("{0} [{1}];-{0} [{1}]", _numberFormat, inputParameter.Unit.Name); } else { inputParameterEditor.Properties.EditMask = String.Format("{0};-{0}", _numberFormat); } inputParameterEditor.Properties.DisplayFormat.FormatString = inputParameterEditor.Properties.EditMask; inputParameterEditor.Properties.DisplayFormat.FormatType = FormatType.Custom; inputParameterEditor.Properties.NullValuePrompt = Captions.Importer.PleaseEnterData; inputParameterEditor.Properties.CloseUpKey = new KeyShortcut(Keys.Enter); inputParameterEditor.ToolTipController = new ToolTipController(); inputParameterEditor.SuperTip = new SuperToolTip(); inputParameterEditor.SuperTip.Items.AddTitle(inputParameter.DisplayName); if (!String.IsNullOrEmpty(inputParameter.Unit.Name)) { inputParameterEditor.SuperTip.Items.Add(String.Format("Please enter a value in {0} [{1}].", inputParameter.Unit.DisplayName, inputParameter.Unit.Name)); } else { inputParameterEditor.SuperTip.Items.Add("Please enter a value."); } if (inputParameter.MinValue != null || inputParameter.MaxValue != null) { var lowerBound = (inputParameter.MinValue == null) ? INFINITY_SIGN : (inputParameter.MinValueAllowed) ? "[" : "]"; var lowerValue = (inputParameter.MinValue == null) ? String.Empty : inputParameter.MinValue.ToString(); var upperValue = (inputParameter.MaxValue == null) ? String.Empty : inputParameter.MaxValue.ToString(); var upperBound = (inputParameter.MaxValue == null) ? INFINITY_SIGN : (inputParameter.MaxValueAllowed) ? "]" : "["; var text = String.Format("Valid values must be within range {0}{1};{2}{3}.", lowerBound, lowerValue, upperValue, upperBound); inputParameterEditor.SuperTip.Items.Add(text); } inputParameterEditor.ToolTipController.ToolTipType = ToolTipType.SuperTip; inputParameterEditor.PerformLayout(); colItem.Control = inputParameterEditor; checkEditorInput(inputParameterEditor); } }
public DialogResult ShowParameterDialog() { DataRetrieval retrieval = new DataRetrieval(); XtraForm form = new XtraForm(); form.Icon = Marbid.Module.Win.Properties.Resources.mareinico; form.Text = "Parameters"; LayoutControl layout = new LayoutControl() { Name = "layout", }; layout.Root.BeginUpdate(); foreach (ParameterDefinition definition in parameterDefinition) { LayoutControlItem itemLayout; switch (definition.ParameterPropertyType) { case ParameterPropertyType.DataSource: string paramQuery = definition.ParameterQueryString; string paramConnection = definition.ParameterConnection; DataSet paramDataSet = new DataSet(); paramDataSet = retrieval.GetDataSet("ParamData", paramQuery, paramConnection, paramDataSet); LookUpEdit lookUpEdit = new LookUpEdit(); lookUpEdit.Properties.DataSource = paramDataSet.Tables[0]; lookUpEdit.Properties.ValueMember = paramDataSet.Tables[0].Columns[0].ColumnName; lookUpEdit.Properties.DisplayMember = paramDataSet.Tables[0].Columns[1].ColumnName; lookUpEdit.EditValue = definition.ParameterDefaultValue; itemLayout = layout.AddItem(definition.ParameterCaption, lookUpEdit); itemLayout.OptionsTableLayoutItem.RowIndex = definition.ParameterIndex; itemLayout.Name = definition.ParameterName; lookUpEdit.EditValue = definition.ParameterDefaultValue; break; case BusinessObjects.ParameterPropertyType.DateTime: DateEdit dateEdit = new DateEdit() { DateTime = DateTime.Now, Name = definition.ParameterName, EditValue = definition.ParameterDefaultValue }; itemLayout = layout.AddItem(definition.ParameterCaption, dateEdit); itemLayout.Name = definition.ParameterName; itemLayout.OptionsTableLayoutItem.RowIndex = definition.ParameterIndex; break; case BusinessObjects.ParameterPropertyType.String: TextEdit textEdit = new TextEdit() { Name = definition.ParameterName }; itemLayout = layout.AddItem(definition.ParameterCaption, textEdit); itemLayout.Name = definition.ParameterName; itemLayout.OptionsTableLayoutItem.RowIndex = definition.ParameterIndex; break; case BusinessObjects.ParameterPropertyType.Integer: SpinEdit spinEdit = new SpinEdit() { Name = definition.ParameterName }; itemLayout = layout.AddItem(definition.ParameterCaption, spinEdit); itemLayout.Name = definition.ParameterName; itemLayout.OptionsTableLayoutItem.RowIndex = definition.ParameterIndex; break; case BusinessObjects.ParameterPropertyType.Numeric: CalcEdit calcEdit = new CalcEdit() { Name = definition.ParameterName }; itemLayout = layout.AddItem(definition.ParameterCaption, calcEdit); itemLayout.Name = definition.ParameterName; itemLayout.OptionsTableLayoutItem.RowIndex = definition.ParameterIndex; break; } } SimpleButton buttonOK = new SimpleButton() { Name = "ButtonOK", DialogResult = DialogResult.OK, Text = "OK" }; SimpleButton buttonCancel = new SimpleButton() { Name = "ButtonCancel", DialogResult = DialogResult.Cancel, Text = "Cancel" }; LayoutControlItem btn = layout.AddItem("OK", buttonOK); btn.TextVisible = false; form.AcceptButton = buttonOK; btn = layout.AddItem("Cancel", buttonCancel); btn.TextVisible = false; form.CancelButton = buttonCancel; layout.Root.EndUpdate(); layout.Dock = DockStyle.Fill; form.Controls.Add(layout); form.StartPosition = FormStartPosition.CenterScreen; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { foreach (BaseLayoutItem item in layout.Items) { if (item is LayoutControlItem) { LayoutControlItem controlItem = (LayoutControlItem)item; if (((LayoutControlItem)item).Control.GetType() == typeof(SpinEdit)) { var paramData = new ParameterDictionary() { ParameterName = item.Name, ParameterValue = ((SpinEdit)controlItem.Control).Value }; parameterDictionary.Add(paramData); } if (((LayoutControlItem)item).Control.GetType() == typeof(CalcEdit)) { var paramData = new ParameterDictionary() { ParameterName = item.Name, ParameterValue = ((CalcEdit)controlItem.Control).Value }; parameterDictionary.Add(paramData); } if (((LayoutControlItem)item).Control.GetType() == typeof(DateEdit)) { var paramData = new ParameterDictionary() { ParameterName = item.Name, ParameterValue = ((DateEdit)controlItem.Control).DateTime }; parameterDictionary.Add(paramData); } if (((LayoutControlItem)item).Control.GetType() == typeof(TextEdit)) { var paramData = new ParameterDictionary() { ParameterName = item.Name, ParameterValue = ((TextEdit)controlItem.Control).Text }; parameterDictionary.Add(paramData); } if (((LayoutControlItem)item).Control.GetType() == typeof(LookUpEdit)) { var paramData = new ParameterDictionary() { ParameterName = item.Name, ParameterValue = ((LookUpEdit)controlItem.Control).EditValue }; parameterDictionary.Add(paramData); } } } } return(result); }
void calThucThu_EditValueChanged(object sender, EventArgs e) { Application.CurrentCulture.NumberFormat = nfi; CalcEdit calThucThu = sender as CalcEdit; if (calThucThu == null) { return; } if (calThucThu.Properties.ReadOnly == true) { return; } if (NgayDK.Properties.ReadOnly == false) { return; } DataSet ds = data.BsMain.DataSource as DataSet; if (ds == null) { return; } //if (drMaster != null) // return; DataRow dr; if (data.BsMain.Current != null) { dr = (data.BsMain.Current as DataRowView).Row; } else { DataTable dt0 = ds.Tables[0]; DataView dv0 = new DataView(dt0); dv0.RowStateFilter = DataViewRowState.Added | DataViewRowState.ModifiedCurrent; if (dv0.Count == 0) { return; } dr = dv0[0].Row; } if (dr == null) { return; } dr["ThucThu"] = calThucThu.EditValue.ToString(); decimal tienHP = (decimal)dr["TienHP"]; decimal tienTN = calThucThu.EditValue != null ? (decimal)calThucThu.EditValue : 0; decimal tienCL = tienHP - tienTN; decimal tienBLDu = (decimal)dr["BLSoTien"]; // trường hợp tiền còn lại của lớp trước > hp lớp đăng ký // Fix HIK: Nếu chuyển lớp và còn tiền dư thì tiền bảo lưu = 0 if (tienCL < 0) { dr["ConLai"] = 0; dr["BLSoTien"] = (int)dr["IsCL"] != 1 ? RoundNumber(Math.Abs(tienCL) + tienBLDu) : 0; } else { dr["ConLai"] = (int)dr["IsCL"] != 1 ? RoundNumber(tienCL) : 0; dr["BLSoTien"] = tienBLDu; } dr.EndEdit(); Application.CurrentCulture = ci; }
private void CreateDetail(Type EntityType, String Name = null, object Value = null) { #region ==================================== Labels + textboxs ==================================== splitContainerControl.Panel2.Controls.Clear(); var EntityProperties = EntityType.GetProperties(); int index = 0; for (int i = 0; i < EntityProperties.Count(); i++) { var Pro = EntityProperties[i]; var DisplayName = Pro.GetName(); if (Pro.PropertyType.IsGenericType || Pro.Name.Substring(0, 2) == "FK") { } else { var DataBindingsType = "Text"; var label = new LabelControl(); label.Location = new Point(20, 50 + 30 * index + 3); label.Text = DisplayName; label.Font = new Font(label.Font, CurrentMDI.IsKey(Pro.Name) ? FontStyle.Underline | FontStyle.Bold : FontStyle.Regular); BaseEdit textbox = new TextEdit(); if(EntityType.IsForeignKey(Pro.Name)) { var ForeignInfo = Pro.GetForeignKeyTargetName(); var TableName = ForeignInfo.Substring(0, ForeignInfo.IndexOf("_")); var KeyName = ForeignInfo.Substring(ForeignInfo.IndexOf("_") + 1); var x = Global.GetType(TableName); var aList = x.Equals(typeof(DataContext.Menu)) ? GetMenuList() : (x.Equals(typeof(Quyen)) ? GetQuyenList() : Table.GetList(x, null, null, false)); if (aList != null) { var Ri = new LookUpEdit(); Ri.Properties.NullText = "Không có giá trị"; Ri.Properties.DataSource = aList; Ri.Properties.ValueMember = KeyName; Ri.Properties.BestFitMode = BestFitMode.BestFitResizePopup; Ri.BindingContextChanged += new EventHandler(delegate(object sender, EventArgs e) { var Lookup = (sender as LookUpEdit); Lookup.Properties.PopulateColumns(); Lookup.Properties.BestFit(); Lookup.Properties.AllowNullInput = DefaultBoolean.True; if (Lookup.Properties.Columns.Count == 0) return; var ci = 0; foreach (var Column in x.GetProperties()) { if (Column.PropertyType.IsGenericType) { Lookup.Properties.Columns[ci].Visible = false; } else { Lookup.Properties.Columns[ci].Caption = Column.GetName(); if (Column.PropertyType == typeof(DateTime)) { if (Column.Name.Substring(0, 3) == "Gio") Lookup.Properties.Columns[ci].FormatString = "HH:mm tt"; else Lookup.Properties.Columns[ci].FormatString = "dd/MM/yyy"; } } ci++; } }); textbox = Ri; DataBindingsType = "EditValue"; } } else if (Pro.PropertyType == typeof(DateTime)) { var rDate = new DateEdit(); var rTime = new TimeEdit(); rDate.Properties.MinValue = new DateTime(1753, 1, 1); // SQL min value if (Pro.Name.Substring(0, 3) == "Gio") textbox = rTime; else textbox = rDate; DataBindingsType = "EditValue"; } else if (Pro.PropertyType == typeof(bool)) { textbox = new CheckEdit(); DataBindingsType = "EditValue"; } else if (Pro.PropertyType == typeof(int) || Pro.PropertyType == typeof(decimal) || Pro.PropertyType == typeof(double)) { textbox = new CalcEdit(); DataBindingsType = "EditValue"; } textbox.Location = new Point(120, 50 + 30 * index); textbox.Width = 200; textbox.TabIndex = index; textbox.DataBindings.Add(DataBindingsType, gridView.DataSource, Pro.Name); textbox.Properties.ReadOnly = true; textbox.Name = Pro.Name; splitContainerControl.Panel2.Controls.AddRange(new Control[] { label, textbox }); index++; } } #endregion #region ==================================== Buttons ==================================== int bWidth = 60; int bX = 0; var btnEdit = new SimpleButton() { Text = "Chỉnh sửa", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = bWidth, Enabled = CurrentMDI.EnabledModify() && CurrentMDI.EnabledEdit() && gridView.SelectedRowsCount > 0 }; var btnCancelEdit = new SimpleButton() { Text = "Dừng sửa", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = 60, Visible = false }; bX++; var btnUpdate = new SimpleButton() { Text = "Cập nhật", Location = new Point(5 + 5*bX + bWidth * bX, 50 + 30 * index), Width = 60, Enabled = false }; bX++; var btnCreateNew = new SimpleButton() { Text = "Tạo mới", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = 60, Enabled = CurrentMDI.EnabledModify() }; var btnCancelNew = new SimpleButton() { Text = "Dừng thêm", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = 60, Visible = false }; bX++; var btnAddNew = new SimpleButton() { Text = "Thêm mới", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = 60, Enabled = false }; bX++; var btnDelete = new SimpleButton() { Text = "Xoá", Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = 60, Enabled = CurrentMDI.EnabledModify() && gridView.SelectedRowsCount > 0 }; index++; #endregion #region ==================================== Functions ==================================== var Element = EntityType.CreateNew(); Func<string, Control> GetControlByName = delegate(string ControlName) { foreach(Control c in splitContainerControl.Panel2.Controls) if(c.Name == ControlName) return c; return null; }; Func<Exception, bool> ValidateEntity = delegate(Exception e) { dxErrorProvider.ClearErrors(); bool isOk = false; if (e is SqlException) { var dbEx = e as SqlException; foreach (SqlError validationError in dbEx.Errors) { if (validationError.Message.IndexOf("]") > 0) { var PropertyName = validationError.Message.Substring(validationError.Message.IndexOf("[") + 1, validationError.Message.IndexOf("]")-1); var ErrorMessage = validationError.Message.Substring(validationError.Message.IndexOf("]") + 1); if (PropertyName.Equals("_Msg")) { MessageBox.Show(ErrorMessage); isOk = true; } else { dxErrorProvider.SetError(GetControlByName(PropertyName), ErrorMessage, ErrorType.Default); } } } } else { ShowError(e); } return isOk; }; Action<bool> SetReadOnly = delegate(bool IsReadOnly) { foreach (Control control in splitContainerControl.Panel2.Controls) { if (control is BaseEdit) { (control as BaseEdit).Properties.ReadOnly = IsReadOnly; if (CurrentMDI.IsKey(control.Name) && !IsReadOnly && !btnAddNew.Enabled) { (control as BaseEdit).Properties.ReadOnly = true; } if (control.Tag != null) { (control.Tag as Control).Enabled = !IsReadOnly; } if (control.Name == Name) { (control as BaseEdit).Properties.ReadOnly = true; } if (control is LookUpEdit && (control as BaseEdit).Properties.ReadOnly == false) { if (EntityType.IsFKContained(control.Name)) { var A = EntityType.Name; var MDI = (MasterDetailInfo)(control as LookUpEdit).Properties.DataSource.GetType().GenericTypeArguments[0].CreateNew(); var V = (GetControlByName(CurrentMDI.GetKeyName()) as BaseEdit).EditValue; var aList = Table.GetList(MDI.GetType(), A, V, false); (control as LookUpEdit).Properties.DataSource = aList; } } } } }; Action DefaultButtonDisplay = delegate() { btnEdit.Enabled = CurrentMDI.EnabledEdit() && gridView.SelectedRowsCount > 0; btnEdit.Visible = true; btnCancelEdit.Visible = false; btnUpdate.Enabled = false; btnCreateNew.Enabled = btnCreateNew.Visible = true; btnCancelNew.Visible = false; btnAddNew.Enabled = false; btnDelete.Enabled = gridView.SelectedRowsCount > 0; }; Func<MasterDetailInfo> GetCurrentRecord = delegate() { var AElement = EntityType.CreateNew(); foreach (Control control in splitContainerControl.Panel2.Controls) { if (control is BaseEdit) { AElement.SetPropertyValue(control.Name, (control as BaseEdit).EditValue); } } return (AElement as MasterDetailInfo); }; #endregion #region ==================================== Button Events ==================================== btnEdit.Click += new EventHandler(delegate(object sender, EventArgs e) { foreach (Control control in splitContainerControl.Panel2.Controls) { if (control is BaseEdit) { Element.SetPropertyValue(control.Name, (control as BaseEdit).EditValue); } } DefaultButtonDisplay(); btnCancelEdit.Visible = btnUpdate.Enabled = true; btnEdit.Visible = btnCreateNew.Enabled = btnDelete.Enabled = false; SetReadOnly(false); DataGridView.Enabled = false; }); btnCancelEdit.Click += new EventHandler(delegate(object sender, EventArgs e) { foreach (Control control in splitContainerControl.Panel2.Controls) { if (control is BaseEdit) { (control as BaseEdit).EditValue = Element.GetPropertyValue(control.Name); } } DefaultButtonDisplay(); SetReadOnly(true); DataGridView.Enabled = true; dxErrorProvider.ClearErrors(); }); btnUpdate.Click += new EventHandler(delegate(object sender, EventArgs e) { var NewElement = GetCurrentRecord(); bool isOk = false; try { Table.Update(NewElement); } catch (Exception ex) { isOk = ValidateEntity(ex); } finally { if (isOk) { dxErrorProvider.ClearErrors(); DefaultButtonDisplay(); SetReadOnly(true); DataGridView.Enabled = true; } } }); btnCreateNew.Click += new EventHandler(delegate(object sender, EventArgs e) { gridView.AddNewRow(); if (!string.IsNullOrEmpty(Name)) { var txt = (GetControlByName(Name) as BaseEdit); txt.EditValue = Value; txt.BindingManager.EndCurrentEdit(); } DefaultButtonDisplay(); btnCancelNew.Visible = btnAddNew.Enabled = true; btnCreateNew.Visible = btnEdit.Enabled = btnDelete.Enabled = false; SetReadOnly(false); DataGridView.Enabled = false; }); btnCancelNew.Click += new EventHandler(delegate(object sender, EventArgs e){ gridView.DeleteSelectedRows(); DefaultButtonDisplay(); SetReadOnly(true); DataGridView.Enabled = true; dxErrorProvider.ClearErrors(); }); btnAddNew.Click += new EventHandler(delegate(object sender, EventArgs e) { var NewElement = GetCurrentRecord(); bool isOk = true; try { Table.Insert(NewElement); } catch (Exception ex) { isOk = ValidateEntity(ex); } finally { if (isOk) { dxErrorProvider.ClearErrors(); DefaultButtonDisplay(); SetReadOnly(true); DataGridView.Enabled = true; } } }); btnDelete.Click += new EventHandler(delegate(object sender, EventArgs e) { var AElement = GetCurrentRecord(); try { gridView.DeleteSelectedRows(); Table.Delete(AElement); } catch (System.Exception ex) { ValidateEntity(ex); } }); #endregion splitContainerControl.Panel2.Controls.AddRange(new Control[] { btnEdit, btnCancelEdit, btnUpdate, btnCreateNew, btnCancelNew, btnAddNew, btnDelete }); #region ==================================== Relation ==================================== var Count = CurrentMDI.GetRelationCount(); bX = 0; bWidth = 160; for (int i = 0; i < Count; i++) { var MDI = (MasterDetailInfo)CurrentMDI.GetRelationType(i).CreateNew(); var aName = MDI.GetType().Name; var aButton = new SimpleButton() { Name = "btnRelation_"+ aName, Text = MDI.GetName(), Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index), Width = bWidth, Enabled = DSQuyen.Where(m => m.Quyen > 1 && m.Menu.Contains(aName)).Count() > 0 || Username == "admin" }; aButton.Click += new EventHandler(delegate(object sender, EventArgs e) { var TableName = CurrentMDI.GetType().Name; var ColumnName = MDI.GetForeignKeyColumn(TableName); var KeyValue = GetCurrentRecord().GetKeyValue(); UpdateGridView(MDI, ColumnName, KeyValue); //gridView.Columns[0].FilterInfo = new ColumnFilterInfo(gridView.Columns[ColumnName], KeyValue); }); splitContainerControl.Panel2.Controls.Add(aButton); index = bX > 0 ? index + 1 : index; bX = bX > 0 ? 0 : bX + 1; } #endregion }
public static bool IsCalcEditEmpty(CalcEdit edit) { return edit.Text == String.Empty ? true : false; }
public void AddEvent() { tableName = _data.DrTableMaster["TableName"].ToString(); List <string> lstTB = new List <string>(new string[] { "MTBaoGia", "MTDonHang", "MTLSX" }); List <string> lstSo = new List <string>(new string[] { "SoBG", "SoDH", "SoDH" }); if (!lstTB.Contains(tableName)) { return; } deNgayCT = _data.FrmMain.Controls.Find("NgayCT", true)[0] as DateEdit; lcMain = _data.FrmMain.Controls.Find("lcMain", true)[0] as LayoutControl; if (tableName == "MTDonHang") { SimpleButton btnKho = new SimpleButton(); btnKho.Name = "btnKho"; btnKho.Text = "Lấy khổ"; LayoutControlItem lci = lcMain.AddItem("", btnKho); lci.Name = "cusKho"; btnKho.Click += new EventHandler(btnKho_Click); } gvMain = (_data.FrmMain.Controls.Find("gcMain", true)[0] as GridControl).MainView as GridView; gvMain.OptionsBehavior.Editable = false; gvMain.BeforeLeaveRow += new DevExpress.XtraGrid.Views.Base.RowAllowEventHandler(gvMain_BeforeLeaveRow); gvMain.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(gvMain_FocusedRowChanged); gluKH = _data.FrmMain.Controls.Find("MaKH", true)[0] as GridLookUpEdit; if (tableName == "MTBaoGia") { gluKH.EditValueChanged += new EventHandler(gluKH_EditValueChanged); LayoutControlItem lciDH = lcMain.Items.FindByName("lciTaoDH") as LayoutControlItem; lciDH.AppearanceItemCaption.ForeColor = Color.Red; lciDH.AppearanceItemCaption.Options.UseForeColor = true; } ceKCT = _data.FrmMain.Controls.Find("KCT", true)[0] as CheckEdit; if (tableName == "MTDonHang") { ceXa = _data.FrmMain.Controls.Find("isXa", true)[0] as CheckEdit; ceCL = _data.FrmMain.Controls.Find("isCL", true)[0] as CheckEdit; CalcEdit ceDT = _data.FrmMain.Controls.Find("DienTich", true)[0] as CalcEdit; ceDT.Enter += new EventHandler(ceDT_Enter); ceXX = _data.FrmMain.Controls.Find("XaX", true)[0] as CalcEdit; ceXX.Enter += new EventHandler(ceXX_Enter); ceXX.EditValueChanged += new EventHandler(ceXX_EditValueChanged); seDaoX = _data.FrmMain.Controls.Find("DaoX", true)[0] as SpinEdit; seDaoX.Enter += new EventHandler(seDao_Enter); seDaoCL = _data.FrmMain.Controls.Find("DaoCL", true)[0] as SpinEdit; ceDCL = _data.FrmMain.Controls.Find("DaiCL", true)[0] as CalcEdit; ceDCL.Enter += new EventHandler(ceDCL_Enter); ceRCL = _data.FrmMain.Controls.Find("RongCL", true)[0] as CalcEdit; ceRCL.Enter += new EventHandler(ceDCL_Enter); ceRCL.EditValueChanged += new EventHandler(ceRCL_EditValueChanged); ceCCL = _data.FrmMain.Controls.Find("CaoCL", true)[0] as CalcEdit; ceCCL.Enter += new EventHandler(ceDCL_Enter); ceCCL.EditValueChanged += new EventHandler(ceCCL_EditValueChanged); SpinEdit seLCL = _data.FrmMain.Controls.Find("LopCL", true)[0] as SpinEdit; seLCL.Enter += new EventHandler(seLCL_Enter); } CalcEdit ceGB = _data.FrmMain.Controls.Find("GiaBan", true)[0] as CalcEdit; ceGB.Enter += new EventHandler(ceGB_Enter); CalcEdit ceKTT = _data.FrmMain.Controls.Find("KhoTT", true)[0] as CalcEdit; ceKTT.Enter += new EventHandler(ceKTT_Enter); CalcEdit ceDao = _data.FrmMain.Controls.Find("Dao", true)[0] as CalcEdit; ceDao.Enter += new EventHandler(ceDao_Enter); cbeLoaiThung = _data.FrmMain.Controls.Find("LoaiThung", true)[0] as ComboBoxEdit; cbeLoai = _data.FrmMain.Controls.Find("Loai", true)[0] as ComboBoxEdit; cbeLoai.EditValueChanged += new EventHandler(cbeLoai_EditValueChanged); CalcEdit ceDai = _data.FrmMain.Controls.Find("Dai", true)[0] as CalcEdit; ceRong = _data.FrmMain.Controls.Find("Rong", true)[0] as CalcEdit; ceLop = _data.FrmMain.Controls.Find("Lop", true)[0] as SpinEdit; ceLop.EditValueChanged += new EventHandler(ceLop_EditValueChanged); if (tableName == "MTDonHang" || tableName == "MTLSX") { gluTHS = _data.FrmMain.Controls.Find("THS", true)[0] as GridLookUpEdit; gluTHS.Popup += new EventHandler(gluTHS_Popup); } GridLookUpEdit gluMat = _data.FrmMain.Controls.Find("Mat_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluSB = _data.FrmMain.Controls.Find("SB_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluMB = _data.FrmMain.Controls.Find("MB_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluSC = _data.FrmMain.Controls.Find("SC_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluMC = _data.FrmMain.Controls.Find("MC_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluSE = _data.FrmMain.Controls.Find("SE_Giay", true)[0] as GridLookUpEdit; GridLookUpEdit gluME = _data.FrmMain.Controls.Find("ME_Giay", true)[0] as GridLookUpEdit; lstGiay.AddRange(new GridLookUpEdit[] { gluMat, gluSB, gluMB, gluSC, gluMC, gluSE, gluME }); SetDMGiay(); foreach (GridLookUpEdit glu in lstGiay) { glu.Popup += new EventHandler(gluGiay_Popup); glu.KeyDown += new KeyEventHandler(glu_KeyDown); glu.CloseUp += new DevExpress.XtraEditors.Controls.CloseUpEventHandler(glu_CloseUp); } if (tableName == "MTDonHang" || tableName == "MTLSX") { ceDai.Enter += new EventHandler(ceDai_Enter); ceRong.Enter += new EventHandler(ceRong_Enter); gvMain.OptionsView.EnableAppearanceEvenRow = false; gvMain.OptionsView.EnableAppearanceOddRow = false; gvMain.Appearance.FocusedRow.BackColor = Color.Transparent; gvMain.RowStyle += new RowStyleEventHandler(gvMain_RowStyle); } if (tableName == "MTDonHang") { ceRong.EditValueChanged += new EventHandler(ceRong_EditValueChanged); ceRong.Leave += new EventHandler(ceRong_Leave); } gvMain.ShownEditor += new EventHandler(gvMain_ShownEditor); _data.BsMain.DataSourceChanged += new EventHandler(BsMain_DataSourceChanged); BsMain_DataSourceChanged(_data.BsMain, new EventArgs()); }