public void RaiseUpdatedEventHander(DIC_UNIT Item) { if (this.Updated != null) { this.Updated(this, Item); } }
private void RaiseSuccessEventHander(DIC_UNIT item) { if (this.Success != null) { this.Success(this, item); } }
private void RaiseItemSelectedEventHander(DIC_UNIT item) { if (this.ItemSelected != null) { this.ItemSelected(this, item); } }
protected override void Add() { base.Add(); DIC_UNIT dICUNIT = new DIC_UNIT(); this.txtID.Text = dICUNIT.NewID(); this.txtNAME.Focus(); }
public xfmUnitAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; DIC_UNIT dICUNIT = new DIC_UNIT(); this.ucAdd.SetData(dICUNIT.NewID()); this.Text = "Thêm"; }
private void UpdateRow(DIC_UNIT item, RowClickEventArgs e) { AdvBandedGridView advBandedGridView = this.gbList; int rowIndex = e.RowIndex; advBandedGridView.SetRowCellValue(rowIndex, "Active", item.Active); advBandedGridView.SetRowCellValue(rowIndex, "UnitCode", item.UnitCode); advBandedGridView.SetRowCellValue(rowIndex, "UnitName", item.UnitName); advBandedGridView.SetRowCellValue(rowIndex, "Description", item.Description); advBandedGridView.UpdateCurrentRow(); }
public void SetData(DIC_UNIT item) { this.txtID.Text = item.UnitCode; // SYS_LOG.Insert("Danh Mục Đơn Vị Tính", "Xem", this.txtID.Text); if (this.m_Status == Actions.Update) { this.txtID.Properties.ReadOnly = true; } this.txtNAME.Text = item.UnitName; this.txtDescription.Text = item.Description; this.chxUse.Checked = item.Active; }
private void AddRow(DIC_UNIT Item) { AdvBandedGridView advBandedGridView = this.gbList; int focusedRowHandle = advBandedGridView.FocusedRowHandle; advBandedGridView.AddNewRow(); focusedRowHandle = advBandedGridView.FocusedRowHandle; advBandedGridView.SetRowCellValue(focusedRowHandle, "Active", Item.Active); advBandedGridView.SetRowCellValue(focusedRowHandle, "UnitCode", Item.UnitCode); advBandedGridView.SetRowCellValue(focusedRowHandle, "UnitName", Item.UnitName); advBandedGridView.SetRowCellValue(focusedRowHandle, "Description", Item.Description); advBandedGridView.UpdateCurrentRow(); }
protected override string uc_Delete() { DIC_UNIT dICUNIT = new DIC_UNIT() { UnitCode = this.txtID.Text }; string str = dICUNIT.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(dICUNIT); } return(str); }
public xfmUnitAdd(Actions Action, DIC_UNIT Item) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; if (Action == Actions.Update) { this.ucAdd.SetData(Item); this.Text = "Cập nhật"; } else if (Action == Actions.Delete) { this.ucAdd.SetData(Item.UnitCode); } }
private void ucAdd_Success(object sender, DIC_UNIT Item) { if (this.ucAdd.Status == Actions.Add) { this.RaiseAddedEventHander(Item); } else if (this.ucAdd.Status == Actions.Update) { this.RaiseUpdatedEventHander(Item); } if (this.ucAdd.IsClose == CloseOrNew.Close) { base.Close(); } this.ucAdd.Clear(); }
protected override void txtID_KeyDown(object sender, KeyEventArgs e) { TextEdit textEdit = (TextEdit)sender; if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab) { DIC_UNIT dICUNIT = new DIC_UNIT(); if (this.m_Status == Actions.Add) { if (dICUNIT.Exist(textEdit.Text)) { this.Err.SetError(textEdit, "Mã đã tồn tại."); textEdit.Focus(); } } } }
protected override string uc_Update() { // SYS_LOG.Insert("Danh Mục Đơn Vị Tính", "Cập Nhật", this.txtID.Text); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); DIC_UNIT dICUNIT = new DIC_UNIT(this.txtID.Text, this.txtNAME.Text, this.txtDescription.Text, this.chxUse.Checked); string str = dICUNIT.Update(); if (str == "OK") { this.RaiseSuccessEventHander(dICUNIT); } if (str != "OK") { XtraMessageBox.Show(str, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); return(str); }
protected override string uc_Save() { // SYS_LOG.Insert("Danh Mục Đơn Vị Tính", "Thêm", this.txtID.Text); base.SetWaitDialogCaption("Đang lưu dữ liệu..."); Cursor.Current = Cursors.WaitCursor; DIC_UNIT dICUNIT = new DIC_UNIT(this.txtID.Text, this.txtNAME.Text, this.txtDescription.Text, this.chxUse.Checked); string str = dICUNIT.Insert(); if (str == "OK") { this.RaiseSuccessEventHander(dICUNIT); } Cursor.Current = Cursors.Default; this.DoHide(); if (str != "OK") { XtraMessageBox.Show(str, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(str); }
public override void Change() { DIC_UNIT dICUNIT = new DIC_UNIT(); object cellValue = base.GetCellValue(this.m_RowClickEventArgs.RowIndex, "UnitCode"); if (cellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(dICUNIT.Get(cellValue.ToString()) != "OK")) { this.DoHide(); xfmUnitAdd _xfmUnitAdd = new xfmUnitAdd(Actions.Update, dICUNIT); _xfmUnitAdd.Updated += new xfmUnitAdd.UpdatedEventHander(this.frm_Updated); _xfmUnitAdd.Added += new xfmUnitAdd.AddedEventHander(this.frm_Added); _xfmUnitAdd.ShowDialog(); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
public override void ReLoad() { base.SetWaitDialogCaption("Đang nạp dữ liệu..."); DIC_UNIT dICUNIT = new DIC_UNIT(); this.gcList.DataSource = dICUNIT.GetList(); base.SetWaitDialogCaption("Đang nạp cấu hình..."); this.List_Init(this.gbList); base.SetWaitDialogCaption("Nạp quyền sử dụng..."); MyRule.Get(MyLogin.RoleId, "bbiUnit"); if (!MyRule.AllowPrint) { this.ucToolBar.bbiPrint.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiUnit"); if (!MyRule.AllowExport) { this.ucToolBar.bbiExport.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiUnit"); if (!MyRule.AllowAdd) { this.ucToolBar.bbiAdd.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiUnit"); if (!MyRule.AllowDelete) { this.ucToolBar.bbiDelete.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiUnit"); if (!MyRule.AllowEdit) { this.ucToolBar.bbiEdit.Visibility = BarItemVisibility.Never; } base.SetWaitDialogCaption("Đã xong..."); this.DoHide(); }
private void frm_Updated(object sender, DIC_UNIT Item) { this.UpdateRow(Item, this.m_RowClickEventArgs); }
public override void Delete() { object cellValue; if (ClsOption.System2.IsQuestion) { if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } base.SetWaitDialogCaption("Đang xóa..."); string str = ""; bool flag = false; AdvBandedGridView advBandedGridView = this.gbList; int[] selectedRows = advBandedGridView.GetSelectedRows(); DIC_UNIT dICUNIT = new DIC_UNIT(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; cellValue = base.GetCellValue(selectedRows[i - 1], "UnitCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Mục Đơn Vị Tính", "Xoá", cellValue.ToString()); str = dICUNIT.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(selectedRows[i - 1]); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { if (advBandedGridView.DataSource != null) { RowClickEventArgs rowClickEventArg = new RowClickEventArgs((advBandedGridView == null ? -1 : advBandedGridView.FocusedRowHandle), (advBandedGridView.FocusedColumn == null ? -1 : advBandedGridView.FocusedColumn.ColumnHandle), (advBandedGridView.FocusedColumn == null ? "" : advBandedGridView.FocusedColumn.FieldName)); this.m_RowClickEventArgs = rowClickEventArg; cellValue = null; cellValue = base.GetCellValue(rowClickEventArg.RowIndex, "UnitCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Mục Đơn Vị Tính", "Xoá", cellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = dICUNIT.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(rowClickEventArg.RowIndex); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.DoHide(); } } } }
private void frm_Added(object sender, DIC_UNIT e) { this.AddRow(e); }