/// <summary> /// Deletes the item. /// </summary> protected void DeleteItem() { try { ActionMode = ActionModeEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { if (treeList.FindNodeByKeyID(PrimaryKeyValue).HasChildren) { ShowErrorDeleteParent(); } else { DeleteTree(); _audittingLogPresenter.Save(); XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { LoadData(); SetRowSelected(); } }
/// <summary> /// btnUnlock_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUnlock_Click(object sender, EventArgs e) { IsLock = 0; LockDateSeason = ""; ActionMode = ActionModeEnum.Unlock; //var firstDay = new DateTime(DateTime.Now.Year, 1, 1); //var lastDay = new DateTime(DateTime.Now.Year, 12, 31); LockDateFrom = DateTime.MinValue; LockDateTo = DateTime.MinValue; //dtExcuteDate.EditValue = ""; _dbOptionsPresenter.Save(); _audittingLogPresenter.Save(); RefeshForm(); btnLock.Enabled = true; btnUnlock.Enabled = false; XtraMessageBox.Show(" Bỏ khóa sổ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); lblNotice.Text = "Hệ thống chưa thực hiện khóa sổ!"; IModel model = new Model.Model(); gridLog.DataSource = null; gridLog.DataSource = model.GetAudittingLogs().Where(o => o.EventAction == 10 || o.EventAction == 9); gridLog.Refresh(); gridLogView.RefreshData(); //dtExcuteDate.DateTime = DateTime.Now; }
/// <summary> /// Deletes the item. /// </summary> protected virtual void DeleteItem() { try { ActionMode = ActionModeEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { DeleteGrid(); _audittingLogPresenter.Save(); XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { LoadData(); SetRowSelected(); GetRowValueSelected(); } }
/// <summary> /// Initializes the layout. /// </summary> private void InitializeLayout() { if (!DesignMode) { Text = FormCaption; } ActionMode = ActionModeEnum.None; grdList.Focus(); }
/// <summary> /// Initializes the layout. /// </summary> private void InitializeLayout() { Text = FormCaption; ActionMode = ActionModeEnum.None; barButtonAddNewItem.Visibility = VisibleButtonAddNew == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonEditItem.Visibility = VisibleButtonEdit == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonDeleteItem.Visibility = VisibleButtonDelete == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonFindItem.Visibility = VisibleButtonFind == false ? BarItemVisibility.Never : BarItemVisibility.Always; }
/// <summary> /// Edits the data. /// </summary> protected virtual void EditData() { ActionMode = ActionModeEnum.Edit; if (!ValidEdit()) { return; } ShowFormDetail(); LoadData(); }
/// <summary> /// Initializes the layout. /// </summary> private void InitializeLayout() { Text = FormCaption; ActionMode = ActionModeEnum.None; barButtonAddNewItem.Visibility = VisibleButtonAddNew == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonEditItem.Visibility = VisibleButtonEdit == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonDeleteItem.Visibility = VisibleButtonDelete == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonFindItem.Visibility = VisibleButtonFind == false ? BarItemVisibility.Never : BarItemVisibility.Always; treeList.OptionsView.ShowSummaryFooter = true; }
/// <summary> /// Initializes the layout. /// </summary> private void InitializeLayout() { if (!DesignMode) { _dbOptionHelper = new GlobalVariable(); } Text = FormCaption; ActionMode = ActionModeEnum.None; grdList.Focus(); barButtonAddNewItem.Visibility = VisibleButtonAddNew == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonEditItem.Visibility = VisibleButtonEdit == false ? BarItemVisibility.Never : BarItemVisibility.Always; barButtonDeleteItem.Visibility = VisibleButtonDelete == false ? BarItemVisibility.Never : BarItemVisibility.Always; }
/// <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, DevExpress.XtraBars.ItemClickEventArgs e) { switch (e.Item.Name) { case "barButtonAddNewItem": AddData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonEditItem": EditData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDeleteItem": DeleteItem(); break; case "barButtonRefeshItem": LoadData(); SetRowSelected(); GetRowValueSelected(); break; case "barButtonPrintItem": PrintData(); break; case "barButtonHelpItem": ActionMode = ActionModeEnum.None; ShowHelp(); break; case "barButtonFind": gridView.ShowFindPanel(); break; case "barButtonItemRole": AddRole(); GetRowValueSelected(); break; } RefreshToolbar(); }
/// <summary> /// Prints the data. /// </summary> protected virtual void PrintData() { try { ActionMode = ActionModeEnum.None; Cursor.Current = Cursors.WaitCursor; var reportHelper = new ReportHelper(); _reportList = _reportListPresenter.GetAllReportList(); reportHelper.ReportLists = _reportList; reportHelper.PrintPreviewReport(null, ReportID, false); } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }
// In thẻ tài sản cố định protected virtual void PrintFixedAssetData() { try { ActionMode = ActionModeEnum.None; Cursor.Current = Cursors.WaitCursor; var reportHelper = new ReportHelper(); _reportList = _reportListPresenter.GetAllReportList(); reportHelper.ReportLists = _reportList; using (var frmXtraPrintVoucherByLot = new FrmXtraPrintVoucherByLot()) { frmXtraPrintVoucherByLot.RefType = RefType.FixedAssetDictionary; IList <ReportListModel> reportLists = _reportList.FindAll(item => item.ReportID.Contains("ReportFixedAsset")); frmXtraPrintVoucherByLot.InitComboData(reportLists); frmXtraPrintVoucherByLot.RefID = int.Parse(PrimaryKeyValue); if (frmXtraPrintVoucherByLot.ShowDialog() == DialogResult.OK) { var refIds = frmXtraPrintVoucherByLot.SelectedFa; var reportVoucherId = frmXtraPrintVoucherByLot.ReportID; reportHelper.CommonVariable = new GlobalVariable { RefIdList = refIds }; if (reportVoucherId != null) { reportHelper.PrintPreviewReport(null, reportVoucherId, false); } } } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }
/// <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 = ActionModeEnum.None; } }
/// <summary> /// Loads the data. /// </summary> private void LoadData() { try { treeList.BeginUpdate(); InitializeTreeMain(); LoadDataIntoTree(); LoadGridLayout(); SetGridNumericFormat(); SetTreeListNumericFormat(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); treeList.EndUpdate(); } finally { treeList.EndUpdate(); ActionMode = ActionModeEnum.None; } }
/// <summary> /// Prints the data. /// </summary> protected virtual void PrintData() { try { ActionMode = ActionModeEnum.None; Cursor.Current = Cursors.WaitCursor; var reportHelper = new ReportHelper(); _reportList = _reportListPresenter.GetAllReportList(); if (_reportList != null) { reportHelper.ReportLists = _reportList; reportHelper.PrintPreviewReport(null, ReportID, false); } } catch (Exception ex) { XtraMessageBox.Show("Có lỗi xảy ra trong quá trình truy vấn dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }
private void btnLock_Click(object sender, EventArgs e) { if (dtReportPeriod.ToDate >= DateTime.Parse(GlobalVariable.DBStartDate)) //if (dtExcuteDate.DateTime >= DateTime.Parse(GlobalVariable.DBStartDate)) { IsLock = 1; ActionMode = ActionModeEnum.Lock; _dbOptionsPresenter.Save(); _audittingLogPresenter.Save(); GlobalVariable.LockVoucherSeason = LockDateSeason; GlobalVariable.LockVoucherDateFrom = LockDateFrom.ToLongDateString(); GlobalVariable.LockVoucherDateTo = LockDateTo.ToLongDateString(); RefeshForm(); XtraMessageBox.Show("Khóa sổ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); btnLock.Enabled = false; btnUnlock.Enabled = true; } else { XtraMessageBox.Show("Ngày khóa sổ không được nhỏ hơn ngày khởi tạo dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <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(); break; case "barButtonEditItem": EditData(); SetRowAfterUpdate(); break; case "barButtonDeleteItem": try { if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn danh mục cần xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ActionMode = ActionModeEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { if (treeList.FindNodeByKeyID(int.Parse(PrimaryKeyValue)).HasChildren) { XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteTreeHasChild"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DeleteTree(); _audittingLogPresenter.Save(); XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message.Contains("The DELETE statement conflicted with the REFERENCE constraint") ? "Ko thể xóa đối tượng, vì đã được tồn tại trong chứng từ hoặc danh mục" : ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); } finally { LoadData(); SetRowSelected(); } break; case "barButtonRefeshItem": LoadData(); SetRowSelected(); break; case "barButtonPrintItem": PrintData(); break; case "barButtonHelpItem": ShowHelp(); break; case "barButtonFindItem": treeList.ShowFindPanel(); break; } RefreshToolbar(); }
/// <summary> /// Adds the data. /// </summary> protected virtual void AddData() { ActionMode = ActionModeEnum.AddNew; ShowFormDetail(); LoadData(); }
/// <summary> /// Edits the data. /// </summary> protected virtual void EditData() { ActionMode = ActionModeEnum.Edit; ShowFormDetail(); LoadData(); }
/// <summary> /// Adds the data. /// </summary> protected virtual void AddRole() { ActionMode = ActionModeEnum.Edit; ShowFormRole(); LoadData(); }
/// <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, DevExpress.XtraBars.ItemClickEventArgs e) { switch (e.Item.Name) { case "barButtonAddNewItem": AddData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonEditItem": if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn danh mục cần sửa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } EditData(); SetRowAfterUpdate(); GetRowValueSelected(); break; case "barButtonDeleteItem": try { if (PrimaryKeyValue == null) { XtraMessageBox.Show("Bạn chưa chọn danh mục cần xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ActionMode = ActionModeEnum.Delete; var result = XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteContent"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { DeleteGrid(); _audittingLogPresenter.Save(); XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResDeleteResult"), ResourceHelper.GetResourceValueByName("ResDeleteCaption"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message.Contains("The DELETE statement conflicted with the REFERENCE constraint") ? "Không thể xóa đối tượng, vì đã được sử dụng trong danh mục hoặc chứng từ" : ex.Message, ResourceHelper.GetResourceValueByName("ResExceptionCaption")); } finally { LoadData(); SetRowSelected(); GetRowValueSelected(); } break; case "barButtonRefeshItem": LoadData(); SetRowSelected(); GetRowValueSelected(); break; case "barButtonPrintItem": PrintData(); break; case "barButtonHelpItem": ActionMode = ActionModeEnum.None; ShowHelp(); break; } RefreshToolbar(); }