public void OperationBusiness(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString()) { return; } var varData = from a in ctx.Business_Finance_Budget_Year where a.BillNo == billNo select a; if (varData.Count() != 1) { throw new Exception("未找到主表信息"); } List <CommonProcessInfo> lstPersonnel = serviceFlow.GetFlowData(billNo); string createUser = lstPersonnel[lstPersonnel.Count() - 1].人员; Business_Finance_Budget_Year yearInfo = varData.Single(); var varDelete = from a in ctx.Business_Finance_BudgetInfo where a.YearValue == yearInfo.YearValue && a.DeptCode == yearInfo.DeptCode select a; ctx.Business_Finance_BudgetInfo.DeleteAllOnSubmit(varDelete); var varDetail = from a in ctx.Business_Finance_Budget_YearDetail where a.BillNo == billNo select a; foreach (Business_Finance_Budget_YearDetail detail in varDetail) { Business_Finance_BudgetInfo budgetInfo = new Business_Finance_BudgetInfo(); budgetInfo.ID = Guid.NewGuid(); budgetInfo.BudgetAmountYear = detail.BudgetAmount; budgetInfo.CreateDate = ServerTime.Time; budgetInfo.CreateUser = createUser; budgetInfo.DeptCode = yearInfo.DeptCode; budgetInfo.ProjectID = detail.ProjectID; budgetInfo.MonthValue = detail.MonthValue; budgetInfo.YearValue = yearInfo.YearValue; ctx.Business_Finance_BudgetInfo.InsertOnSubmit(budgetInfo); } ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public override void LoadFormInfo() { try { txtBillNo.Text = this.FlowInfo_BillNo; lbBillStatus.Text = _ServiceFlow.GetNowBillStatus(this.FlowInfo_BillNo); cmbYearValue.MaxYear = 2025; cmbYearValue.MinYear = 2015; cmbYearValue.Init(); this.预算科目.m_OnCompleteSearch += new DelegateCollection.NonArgumentHandle(预算科目_m_OnCompleteSearch); Business_Finance_Budget_Year billInfo = _ServiceYear.GetBillSingleInfo(this.FlowInfo_BillNo); if (billInfo != null) { cmbYearValue.Text = billInfo.YearValue.ToString(); } DataTable sourceTable = _ServiceYear.GetDetailInfo(this.FlowInfo_BillNo); RefreshDataGridView(sourceTable); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
private bool 年度预算申请表明细_PanelGetDataInfo(CE_FlowOperationType flowOperationType) { try { if (cmbYearValue.Text.Trim().Length == 0) { throw new Exception("请填写【预算年份】"); } if (customDataGridView1.Rows.Count == 0) { throw new Exception("请录入【明细】信息"); } Business_Finance_Budget_Year yearInfo = new Business_Finance_Budget_Year(); yearInfo.BillNo = txtBillNo.Text; yearInfo.YearValue = Convert.ToInt32(cmbYearValue.Text); this.ResultInfo = yearInfo; this.FlowOperationType = flowOperationType; this.ResultList.Add(GetDetail()); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
private bool 年度预算申请表_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { IBudgetYear servcieYear = Service_Economic_Financial.ServerModuleFactory.GetServerModule <IBudgetYear>(); try { this.OperationType = form.FlowOperationType; this.BillNo = form.FlowInfo_BillNo; Business_Finance_Budget_Year yearInfo = form.ResultInfo as Business_Finance_Budget_Year; DataTable detailTable = form.ResultList[0] as DataTable; switch (this.OperationType) { case CE_FlowOperationType.提交: servcieYear.SaveInfo(detailTable, yearInfo); servcieYear.OperationBusiness(this.BillNo); break; case CE_FlowOperationType.暂存: servcieYear.SaveInfo(detailTable, yearInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!servcieYear.IsExist(this.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public void SaveInfo(DataTable detailTable, Business_Finance_Budget_Year billInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNowBillStatus(billInfo.BillNo) != CE_CommonBillStatus.新建单据.ToString()) { return; } if (detailTable == null) { throw new Exception("无明细信息,无法保存"); } var varDetail = from a in ctx.Business_Finance_Budget_YearDetail where a.BillNo == billInfo.BillNo select a; var varBill = from a in ctx.Business_Finance_Budget_Year where a.BillNo == billInfo.BillNo select a; ctx.Business_Finance_Budget_YearDetail.DeleteAllOnSubmit(varDetail); ctx.Business_Finance_Budget_Year.DeleteAllOnSubmit(varBill); billInfo.DeptCode = UniversalFunction.GetDept_Belonge(ctx, BasicInfo.DeptCode).DeptCode; ctx.Business_Finance_Budget_Year.InsertOnSubmit(billInfo); List <Business_Finance_Budget_YearDetail> lstDetail = new List <Business_Finance_Budget_YearDetail>(); Business_Finance_Budget_YearDetail detail = new Business_Finance_Budget_YearDetail(); foreach (DataRow dr in detailTable.Rows) { detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 1; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["1月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 2; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["2月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 3; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["3月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 4; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["4月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 5; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["5月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 6; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["6月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 7; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["7月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 8; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["8月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 9; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["9月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 10; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["10月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 11; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["11月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 12; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["12月"]); lstDetail.Add(detail); } ctx.Business_Finance_Budget_YearDetail.InsertAllOnSubmit(lstDetail); ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }