/// <summary> /// Edits the data. /// </summary> protected virtual void EditData() { if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn chứng từ!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_lockPresenter.CheckLockDate(int.Parse(PrimaryKeyValue ?? "0"), (int)RefTypeId)) { XtraMessageBox.Show("Chứng từ hiện tại đang khóa sổ. Bạn phải mở sổ để sửa chứng từ này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ActionMode = ActionModeVoucherEnum.Edit; ShowFormDetail(); LoadData(); }
/// <summary> /// Loads the data. /// </summary> protected void LoadData() { try { gridView.BeginUpdate(); LoadDataIntoGrid(); LoadGridLayout(); SetGridNumericFormat(); grdList.ForceInitialize(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); gridView.EndUpdate(); } finally { gridView.EndUpdate(); ActionMode = ActionModeVoucherEnum.None; } }
/// <summary> /// Handles the ItemClick event of the barToolManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraBars.ItemClickEventArgs"/> instance containing the event data.</param> private void barToolManager_ItemClick(object sender, ItemClickEventArgs e) { switch (e.Item.Name) { case "barButtonAddNewItem": AddData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDuplicate": DuplicateData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonEditItem": if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn chứng từ cần sửa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } EditData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDeleteItem": var deleteSuccess = false; try { if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn chứng từ cần xóa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_lockPresenter.CheckLockDate(Int32.Parse(PrimaryKeyValue), (int)RefTypeId)) { var result1 = XtraMessageBox.Show("Chứng từ đang khóa sổ. Bạn phải mở sổ để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ActionMode = ActionModeVoucherEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { DeleteGrid(); _audittingLogPresenter.Save(); deleteSuccess = true; //LinhMC chạy đến đây là ok rồi if (((IList)bindingSource.DataSource).Count == 0) { bindingSourceDetail = null; } if (RefTypeId != RefType.InwardStock) { XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); } finally { if (deleteSuccess) { LoadData(); SetRowSelected(); GetRowValueSelected(); } } break; case "barButtonRefeshItem": LoadData(); SetRowSelected(); GetRowValueSelected(); break; case "barButtonPrintItem": PrintData(); break; case "barButtonHelpItem": ActionMode = ActionModeVoucherEnum.None; ShowHelp(); break; case "barButtonCalculatePriceItem": CalculatePriceOutwardStock(); break; } RefreshToolbar(); }
/// <summary> /// Shows the data. /// </summary> protected virtual void ShowData() { ActionMode = ActionModeVoucherEnum.None; ShowFormDetail(); LoadData(); }
protected virtual void DuplicateData() { ActionMode = ActionModeVoucherEnum.DuplicateVoucher; ShowFormDetail(); LoadData(); }
/// <summary> /// Adds the data. /// </summary> protected virtual void AddData() { ActionMode = ActionModeVoucherEnum.AddNew; ShowFormDetail(); LoadData(); }
/// <summary> /// Initializes the variables. /// </summary> private void InitVariables() { ActionMode = ActionModeVoucherEnum.None; _globalVariable = new GlobalVariable(); PostedDate = _globalVariable.PostedDate; }
/// <summary> /// Handles the ItemClick event of the barToolManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param> private void barToolManager_ItemClick(object sender, ItemClickEventArgs e) { switch (e.Item.Name) { case "barButtonAddNewItem": AddData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDuplicate": DuplicateData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonEditItem": EditData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDeleteItem": try { ActionMode = ActionModeVoucherEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { DeleteGrid(); _audittingLogPresenter.Save(); //if (RefTypeId != RefType.InwardStock) //{ // XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), // ResourceHelper.GetResourceValueByName("ResDeleteCaption"), // MessageBoxButtons.OK, MessageBoxIcon.Information); //} } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); } finally { LoadData(); SetRowSelected(); GetRowValueSelected(); } break; case "barButtonRefeshItem": LoadData(); SetRowSelected(); GetRowValueSelected(); break; case "barButtonPrintItem": PrintData(); break; case "barButtonHelpItem": ActionMode = ActionModeVoucherEnum.None; ShowHelp(); break; case "barButtonCalculatePriceItem": CalculatePriceOutwardStock(); break; } RefreshToolbar(); }
/// <summary> /// Edits the data. /// </summary> protected virtual void EditData() { ActionMode = ActionModeVoucherEnum.Edit; ShowFormDetail(); LoadData(); }
/// <summary> /// Initializes the variables. /// </summary> private void InitVariables() { ActionMode = ActionModeVoucherEnum.None; PostedDate = GlobalVariable.PostedDate; }