private Process selectProcessbyIdorder(int pid, int order, ProcessManagerDbEntities db)
        {
            var selectstring = from p in db.Process
                               where p.pid == pid && p.steps == order
                               select p;
            Process process = selectstring.First();

            return(process);
        }
 public void insertProcessModel(ProcessProcessModel processmodel)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         Process process = processModelToProcess(processmodel);
         db.Process.Add(process);
         db.SaveChanges();
     }
 }
 public ProcessProcessModel selectProcessModelByidorder(int pid, int order)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         Process             process      = selectProcessbyIdorder(pid, order, db);
         ProcessProcessModel processmodel = processToProcessModel(process);
         return(processmodel);
     }
 }
 public int updateProcess(ProcessProcessModel processmodel)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         Process process = selectProcessbyIdorder(processmodel.Pid, processmodel.Order, db);
         processModelToProcess(processmodel, process);
         int i = db.SaveChanges();
         return(i);
     }
 }
 /// <summary>
 /// 插入单个流程数据
 /// </summary>
 /// <param name="processmodel">需插入的数据</param>
 public int insert(ProcessProcessModel processmodel)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         Process process = processModelToProcess(processmodel);
         db.Process.Add(process);
         int i = db.SaveChanges();
         return(i);
     }
 }
 public void insertProcessModelList(List <ProcessProcessModel> processmodellist)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         processmodellist.ForEach(processmodel =>
         {
             Process process = processModelToProcess(processmodel);
             db.Process.Add(process);
         });
         db.SaveChanges();
     }
 }
 public int updateProcesslist(List <ProcessProcessModel> processlist)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities())
     {
         processlist.ForEach(processmodel =>
         {
             Process process = selectProcessbyIdorder(processmodel.Pid, processmodel.Order, db);
             processModelToProcess(processmodel, process);
         });
         int i = db.SaveChanges();
         return(i);
     }
 }
 public List <ProcessProcessModel> selectProcessModelByid(int pid)
 {
     using (ProcessManagerDbEntities db = new ProcessManagerDbEntities()) {
         var                        selectstring  = from p in db.Process where p.pid == pid select p;
         List <Process>             processs      = selectstring.ToList();
         List <ProcessProcessModel> processmodels = new List <ProcessProcessModel>();
         processs.ForEach(process =>
         {
             ProcessProcessModel processmodel = processToProcessModel(process);
             processmodels.Add(processmodel);
         });
         return(processmodels);
     }
 }