public ScheduleDMApp ScheduleFinish(String StepID) { ScheduleDMApp schedules = new ScheduleDMApp(); var schedule = db.Step.Where(x => x.StepID == StepID).FirstOrDefault(); schedule.StepState = StepState.Yes; schedule.StepEndTime = DateTime.Now; db.SaveChanges(); schedules.msg = 0;//操作成功 db.Entry <Fc_Step>(schedule).State = System.Data.Entity.EntityState.Modified; return(schedules); }
public ScheduleDMApp ScheduleAdd(String OfferID, String StepID, DateTime?StepStartTime, String StepName, String Tool, String StepLiable, String StepArtificial, int StepDate) { ScheduleDMApp schedules = new ScheduleDMApp(); if (String.IsNullOrEmpty(StepName)) { schedules.msg = 0;//请输入工序名 } if (String.IsNullOrEmpty(Tool)) { schedules.msg = 1;//请输入工具 } if (String.IsNullOrEmpty(StepLiable)) { schedules.msg = 2;//请输入负责人 } if (String.IsNullOrEmpty(StepArtificial)) { schedules.msg = 3;//请输入人工 } else { Fc_Step schedule = new Fc_Step(); schedule.StepName = StepName; schedule.Tool = Tool; schedule.StepLiable = StepLiable; schedule.StepArtificial = StepArtificial; schedule.StepState = StepState.No; schedule.StepDate = StepDate; if (String.IsNullOrEmpty(StepID)) { schedule.StepID = DateTime.Now.ToString("yyyyMMddHHmmssffffff"); schedule.StepStartTime = DateTime.Now; } else { schedule.StepID = StepID; schedule.StepStartTime = StepStartTime; } schedule.OfferID = OfferID; db.Step.Add(schedule); db.SaveChanges(); db.Entry <Fc_Step>(schedule).State = System.Data.Entity.EntityState.Modified; schedules.msg = 4;//添加成功 } return(schedules); }
public ScheduleDMApp ScheduleDelete(String StepID) { ScheduleDMApp schedules = new ScheduleDMApp(); var schedule = db.Step.Where(x => x.StepID == StepID).FirstOrDefault(); if (!String.IsNullOrEmpty(schedules.ToString())) { db.Step.Remove(schedule); db.SaveChanges(); schedules.msg = 0;//删除成功 } else { schedules.msg = 1;//删除失败 } return(schedules); }