/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, RoutedEventArgs e) { this.DataVerify(); if (this.IsVerify) { this.ReportDate(); PfmReportMDL rptMdl = new PfmReportMDL(); rptMdl.DictMark = DictMark; rptMdl.RptTime = DateTime.Now; rptMdl.RptDate = DateBegin; rptMdl.RptState = 1; rptMdl.RptName = this.txtName.Text; rptMdl.RptMemo = string.IsNullOrEmpty(this.txtMemo.Text) ? null : this.txtMemo.Text; PfmReportBLL.Insert(rptMdl); this.ReportRecordSave(PfmReportBLL.GetMaxId()); MessageBoxResult boxResult = MessageBox.Show("新数据添加成功!是否继续添加?", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { this.InitializeData(); } else { if (ModuleExtend != null) { this.ModuleExtend(false, Library.Transit.NameItems.Report); } } } }
/// <summary> /// 初始化数据 /// </summary> private void InitializeData() { if (this.svDetailed.Visibility == Visibility.Visible) { this.DetailedBack(); } EntityListener.PfmReportListener.Instance.Receive(PfmReportBLL.ISelectPaging(pager.PageSize, pager.PageCurrent, out _dataTotal)); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="rptId">报表编号</param> public void InitializeData(long rptId) { PfmReport = PfmReportBLL.Select(rptId); PfmReportRecord = PfmReportRecordBLL.ISelect(string.Format("rpt_id = '{0}'", rptId)); this.dgDataSource.DataContext = PfmReportRecord; this.txtTitle.Text = PfmReport.RptName; this.txtType.Text = DictionaryTsit.GetDictName(PfmReport.DictMark); this.txtDate.Text = PfmReport.RptDate.ToString("yyyy年MM月dd日"); this.txtMemo.Text = PfmReport.RptMemo; }
/// <summary> /// 删除报表信息数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mitmDelete_Click(object sender, RoutedEventArgs e) { if (ReportEntity != null && ReportEntity.RptId > 0) { MessageBoxResult boxResult = MessageBox.Show(string.Format("您确定要删除数据【{0}】所包含的信息吗?", ReportEntity.RptName), "询问:", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { PfmReportBLL.Delete(ReportEntity.RptId); PfmReportRecordBLL.DeleteAll(ReportEntity.RptId); MessageBox.Show("数据删除成功!", "提示:", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); this.InitializePaging(); } } }