public List <Bus_FocalWork_MonthlyProgress_Content> GetList_ProgressContent(Bus_FocalWork_MonthlyProgress billInfo) { List <Bus_FocalWork_MonthlyProgress_Content> result = new List <Bus_FocalWork_MonthlyProgress_Content>(); DateTime tempDate = Convert.ToDateTime(billInfo.YearMonth.Substring(0, 4) + "-" + billInfo.YearMonth.Substring(4, 2) + "-1").AddMonths(1).AddDays(-1); string strSql = "select * from Bus_FocalWork where DutyUser = '******' and StartDate <= '" + tempDate.ToShortDateString() + "' and TaskStatus not in ('已完成','终止')"; DataTable tempTable = GlobalObject.DatabaseServer.QueryInfo(strSql); foreach (DataRow dr in tempTable.Rows) { Bus_FocalWork_MonthlyProgress_Content tempContent = new Bus_FocalWork_MonthlyProgress_Content(); tempContent.BillNo = billInfo.BillNo; tempContent.F_Id = Guid.NewGuid().ToString(); tempContent.FocalWorkId = dr["F_Id"].ToString(); result.Add(tempContent); } return(result); }
void SetInfo() { if (_Lnq_BillInfo != null) { txtBillNo.Text = _Lnq_BillInfo.BillNo; cmbMonth.Text = _Lnq_BillInfo.YearMonth.Substring(4, 2); cmbYear.Text = _Lnq_BillInfo.YearMonth.Substring(0, 4); _List_Content = _Service_FocalWork.GetList_ProgressContent(_Lnq_BillInfo.BillNo); _List_KeyPoint = _Service_FocalWork.GetList_ProgressKeyPoint(_Lnq_BillInfo.BillNo); cmbMonth.Enabled = false; cmbYear.Enabled = false; SetFocalWorkRadioButton(); if (flowLayoutPanel1.Controls.Count > 0) { RadioButton rb1 = flowLayoutPanel1.Controls[0] as RadioButton; rb1.Checked = true; } } else { _Lnq_BillInfo = new Bus_FocalWork_MonthlyProgress(); txtBillNo.Text = this.FlowInfo_BillNo; _Lnq_BillInfo.BillNo = txtBillNo.Text; _Lnq_BillInfo.CreateUser = BasicInfo.LoginID; cmbMonth.Text = ServerTime.Time.Month.ToString("D2"); cmbYear.Text = ServerTime.Time.Year.ToString(); } }
public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.重点工作.ToString(), _Service_FocalWork); _Lnq_BillInfo = _Service_FocalWork.GetSingleBillInfo(this.FlowInfo_BillNo); SetInfo(); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
private bool 重点工作_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { try { Bus_FocalWork_MonthlyProgress lnqBillInfo = form.ResultInfo as Bus_FocalWork_MonthlyProgress; this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[0].ToString()); List <Bus_FocalWork_MonthlyProgress_Content> lstContent = form.ResultList[1] as List <Bus_FocalWork_MonthlyProgress_Content>; List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstKeyPoint = form.ResultList[2] as List <Bus_FocalWork_MonthlyProgress_KeyPoint>; this.BillNo = lnqBillInfo.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: _Service_FocalWork.SaveInfo(lnqBillInfo, lstContent, lstKeyPoint); _Service_FocalWork.OpertionInfo(lnqBillInfo.BillNo); break; case CE_FlowOperationType.暂存: _Service_FocalWork.SaveInfo(lnqBillInfo, lstContent, lstKeyPoint); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!_Service_FocalWork.IsExist(lnqBillInfo.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> /// <param name="effectValue">业务明细信息</param> public void SaveInfo(Bus_FocalWork_MonthlyProgress billInfo, List <Bus_FocalWork_MonthlyProgress_Content> lstContent, List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstKeyPoint) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { var varData = from a in ctx.Bus_FocalWork_MonthlyProgress where a.BillNo == billInfo.BillNo select a; Bus_FocalWork_MonthlyProgress lnqBill = new Bus_FocalWork_MonthlyProgress(); if (varData.Count() == 1) { lnqBill = varData.Single(); lnqBill.CreateUser = BasicInfo.LoginID; lnqBill.YearMonth = billInfo.YearMonth; SaveDetail(ctx, billInfo.BillNo, lstContent, lstKeyPoint); } else if (varData.Count() == 0) { ctx.Bus_FocalWork_MonthlyProgress.InsertOnSubmit(billInfo); SaveDetail(ctx, billInfo.BillNo, lstContent, lstKeyPoint); } else { throw new Exception("单据数据不唯一"); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } } }
public void OpertionInfo(string billNo) { Bus_FocalWork_MonthlyProgress billInfo = GetSingleBillInfo(billNo); List <Bus_FocalWork_MonthlyProgress_Content> lstContent = GetList_ProgressContent(billNo); List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstKeyPoint = GetList_ProgressKeyPoint(billNo); using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { DateTime tempDate = Convert.ToDateTime(billInfo.YearMonth.Substring(0, 4) + "-" + billInfo.YearMonth.Substring(4, 2) + "-1").AddMonths(1).AddDays(-1); foreach (Bus_FocalWork_MonthlyProgress_KeyPoint keyPoint in lstKeyPoint) { var varKey = from a in ctx.Bus_FocalWork_KeyPoint where a.F_Id == keyPoint.KeyPointId select a; varKey.Single().KeyStatus = keyPoint.Evaluate; } foreach (Bus_FocalWork_MonthlyProgress_Content content in lstContent) { var varContent = from a in ctx.Bus_FocalWork where a.F_Id == content.FocalWorkId select a; var varKey = from a in ctx.Bus_FocalWork_KeyPoint where a.FocalWorkId == content.FocalWorkId && a.KeyStatus != "已完成" select a; if (varKey.Count() == 0) { varContent.Single().TaskStatus = "已完成"; } } var varContent1 = from a in ctx.Bus_FocalWork where a.TaskStatus == "待启动" && a.StartDate <= tempDate select a; foreach (Bus_FocalWork focalWork in varContent1) { focalWork.TaskStatus = "进行中"; } var varContent2 = from a in ctx.Bus_FocalWork where a.TaskStatus == "进行中" && a.EndDate <= tempDate select a; foreach (Bus_FocalWork focalWork in varContent2) { focalWork.TaskStatus = "延期"; } var varKeyPoint = from a in ctx.Bus_FocalWork_KeyPoint where a.KeyStatus == "待启动" && a.StartDate <= tempDate select a; foreach (Bus_FocalWork_KeyPoint key in varKeyPoint) { key.KeyStatus = "进行中"; } ctx.SubmitChanges(); } }
public List <Bus_FocalWork_MonthlyProgress_KeyPoint> GetList_ProgressKeyPoint(Bus_FocalWork_MonthlyProgress billInfo, List <Bus_FocalWork_MonthlyProgress_Content> lstContent) { List <Bus_FocalWork_MonthlyProgress_KeyPoint> result = new List <Bus_FocalWork_MonthlyProgress_KeyPoint>(); DateTime tempDate = Convert.ToDateTime(billInfo.YearMonth.Substring(0, 4) + "-" + billInfo.YearMonth.Substring(4, 2) + "-1").AddMonths(1); foreach (Bus_FocalWork_MonthlyProgress_Content content in lstContent) { string strSql = "select * from Bus_FocalWork_KeyPoint where FocalWorkId = '" + content.FocalWorkId + "' and EndDate < '" + tempDate.ToShortDateString() + "' and KeyStatus <> '已完成'"; DataTable tempTable = GlobalObject.DatabaseServer.QueryInfo(strSql); foreach (DataRow dr in tempTable.Rows) { Bus_FocalWork_MonthlyProgress_KeyPoint keyPoint = new Bus_FocalWork_MonthlyProgress_KeyPoint(); keyPoint.BillNo = billInfo.BillNo; keyPoint.F_Id = Guid.NewGuid().ToString(); keyPoint.FocalWorkId = content.FocalWorkId; keyPoint.KeyPointId = dr["F_Id"].ToString(); result.Add(keyPoint); } } return(result); }