public void InsertPlanStep(Work_PlanStep objWork_PlanStep) { objWork_PlanStep.StepName.CheckIsNull("请输入步骤名称", "WorkLog"); objWork_PlanStep.SortIndex = 1; if ((from s in this.CurrentEntities.work_planstep where s.PlanID == objWork_PlanStep.PlanID select s).Count <Work_PlanStep>() > 0) { objWork_PlanStep.SortIndex = (from s in this.CurrentEntities.work_planstep where s.PlanID == objWork_PlanStep.PlanID select s).Max((Work_PlanStep s) => s.SortIndex) + 1; } this.CurrentEntities.AddTowork_planstep(objWork_PlanStep); this.CurrentEntities.SaveChanges(); }
/// <summary> /// 保存信息 /// </summary> public void SaveInfo() { if (PlanStepID.IsNull()) { objWork_PlanStep.PlanID = PlanID; ///步骤名称 objWork_PlanStep.StepName = txtStepName.TextCutWord(100); ///功能 objWork_PlanStep.ProcessID = dropProcessID.SelectValueInt; ///重试次数 objWork_PlanStep.RunCount = txtRunCount.TextInt; ///重试间隔 objWork_PlanStep.RunInterval = txtRunInterval.TextInt; ///成功时要执行的操作 objWork_PlanStep.SucessProcessType = radSucessProcessType.SelectValueInt; ///失败时要执行的操作 objWork_PlanStep.FailProcessType = radFailProcessType.SelectValueInt; ///执行顺序 objWork_PlanStep.SortIndex = 0; objWorkRule.InsertPlanStep(objWork_PlanStep); MessageDialog("新增成功", "PlanStepList.aspx?PlanID=" + PlanID + "&WorkInfoID=" + WorkInfoID); } else { objWork_PlanStep = objWorkRule.Work_PlanStep.FirstOrDefault(p => p.PlanStepID == PlanStepID); if (CheckEditObjectIsNull(objWork_PlanStep)) { return; } ///步骤名称 objWork_PlanStep.StepName = txtStepName.TextCutWord(100); ///功能 objWork_PlanStep.ProcessID = dropProcessID.SelectValueInt; ///重试次数 objWork_PlanStep.RunCount = txtRunCount.TextInt; ///重试间隔 objWork_PlanStep.RunInterval = txtRunInterval.TextInt; ///成功时要执行的操作 objWork_PlanStep.SucessProcessType = radSucessProcessType.SelectValueInt; ///失败时要执行的操作 objWork_PlanStep.FailProcessType = radFailProcessType.SelectValueInt; objWorkRule.UpdatePlanStep(objWork_PlanStep); MessageDialog("修改成功", "PlanStepList.aspx?PlanID=" + PlanID + "&WorkInfoID=" + WorkInfoID); } }
/// <summary> /// 页面加载 /// </summary> public override void RenderPage() { if (PlanStepID.IsNoNull()) { objWork_PlanStep = objWorkRule.Work_PlanStep.FirstOrDefault(s => s.PlanStepID == PlanStepID); if (CheckEditObjectIsNull(objWork_PlanStep)) { return; } ///功能 dropProcessID.SelectedValue = objWork_PlanStep.ProcessID.ToString(); ///成功时要执行的操作 radSucessProcessType.SelectedValue = objWork_PlanStep.SucessProcessType.ToString(); ///失败时要执行的操作 radFailProcessType.SelectedValue = objWork_PlanStep.FailProcessType.ToString(); Page.DataBind(); } else { txtRunCount.Text = "0"; txtRunInterval.Text = "0"; } }
public void UpdatePlanStep(Work_PlanStep objWork_PlanStep) { objWork_PlanStep.StepName.CheckIsNull("请输入步骤名称", "WorkLog"); this.CurrentEntities.SaveChanges(); }