public override void LoadFormInfo() { try { _LnqPlanInfo = _ServiceSurvey.GetSingleInfo(this.FlowInfo_BillNo); lbBillStatus.Text = _ServiceFlow.GetNowBillStatus(this.FlowInfo_BillNo); _ListPlanCourse = _ServiceSurvey.GetPlanCourseInfo(this.FlowInfo_BillNo); _ListPlanUser = _ServiceSurvey.GetPlanUserInfo(this.FlowInfo_BillNo); txtBillNo.Text = this.FlowInfo_BillNo; cmbYear.Init(); cmbPlanType.Init <CE_HR_Train_PlanType>(); cmbMonth.Init <CE_MonthValue>(); if (_LnqPlanInfo != null) { cmbYear.Text = _LnqPlanInfo.YearValue == null? ServerTime.Time.Year.ToString() : ((int)_LnqPlanInfo.YearValue).ToString(); cmbPlanType.Text = _LnqPlanInfo.PlanType; } RefreshDataGrid(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
private bool 培训计划申请表明细_PanelGetDataInfo(CE_FlowOperationType flowOperationType) { try { if (cmbYear.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【计划年份】"); return(false); } if (cmbPlanType.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【计划类型】"); return(false); } _LnqPlanInfo = new HR_Train_Plan(); _LnqPlanInfo.BillNo = txtBillNo.Text; _LnqPlanInfo.YearValue = Convert.ToInt32(cmbYear.Text); _LnqPlanInfo.Department = BasicInfo.DeptCode; _LnqPlanInfo.PlanType = cmbPlanType.Text; this.ResultInfo = _LnqPlanInfo; this.FlowOperationType = flowOperationType; if (_ListPlanCourse.Count() == 0) { MessageDialog.ShowPromptMessage("未添加任何【课程计划】"); return(false); } if (_ListPlanUser.Count() == 0) { MessageDialog.ShowPromptMessage("未选择任何【员工】参与培训"); return(false); } this.ResultList.Add(_ListPlanCourse); this.ResultList.Add(_ListPlanUser); this.KeyWords = "【" + UniversalFunction.GetDept_Belonge(BasicInfo.DeptCode).DeptName + "】的【" + cmbYear.Text + "年" + cmbMonth.Text + "】培训计划"; return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
private bool 培训计划申请表_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { ITrainSurvey servcieSurvey = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <ITrainSurvey>(); try { this.OperationType = form.FlowOperationType; this.BillNo = form.FlowInfo_BillNo; HR_Train_Plan planInfo = form.ResultInfo as HR_Train_Plan; List <View_HR_Train_PlanCourse> lstCourseInfo = form.ResultList[0] as List <View_HR_Train_PlanCourse>; List <View_HR_Train_PlanUser> lstUser = form.ResultList[1] as List <View_HR_Train_PlanUser>; switch (this.OperationType) { case CE_FlowOperationType.提交: servcieSurvey.SaveInfo(planInfo, lstCourseInfo, lstUser); servcieSurvey.OperationBusiness(this.BillNo); break; case CE_FlowOperationType.暂存: servcieSurvey.SaveInfo(planInfo, lstCourseInfo, lstUser); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!servcieSurvey.IsExist(this.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public void SaveInfo(HR_Train_Plan planInfo, List <View_HR_Train_PlanCourse> lstPlanCourse, List <View_HR_Train_PlanUser> lstUser) { IFlowServer service = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { if (service.GetNowBillStatus(planInfo.BillNo) != CE_CommonBillStatus.新建单据.ToString()) { return; } var varData = from a in ctx.HR_Train_Plan where a.BillNo == planInfo.BillNo select a; var varData1 = from a in ctx.HR_Train_PlanCourse where a.BillNo == planInfo.BillNo select a; var varData2 = from a in ctx.HR_Train_PlanUser join b in ctx.HR_Train_PlanCourse on a.PlanCourseID equals b.ID where b.BillNo == planInfo.BillNo select a; ctx.HR_Train_PlanUser.DeleteAllOnSubmit(varData2); ctx.HR_Train_PlanCourse.DeleteAllOnSubmit(varData1); ctx.HR_Train_Plan.DeleteAllOnSubmit(varData); planInfo.Department = UniversalFunction.GetDept_Belonge(ctx, planInfo.Department).DeptCode; ctx.HR_Train_Plan.InsertOnSubmit(planInfo); foreach (View_HR_Train_PlanCourse course in lstPlanCourse) { HR_Train_PlanCourse tempCourse = new HR_Train_PlanCourse(); tempCourse.BillNo = planInfo.BillNo; tempCourse.CourseID = course.课程ID; tempCourse.ID = course.ID; tempCourse.MonthValue = course.月份; ctx.HR_Train_PlanCourse.InsertOnSubmit(tempCourse); } foreach (View_HR_Train_PlanUser user in lstUser) { HR_Train_PlanUser tempUser = new HR_Train_PlanUser(); tempUser.PlanCourseID = user.PlanCourseID; tempUser.WorkID = user.员工编号; ctx.HR_Train_PlanUser.InsertOnSubmit(tempUser); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }