Esempio n. 1
0
 public JsonResult UpdateOTK(int id, DateTime?appDate, string appDescription)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (appDate != null)
         {
             planVerificationItems.appDate = appDate.Value;
         }
         if (appDescription != null)
         {
             planVerificationItems.appDescription = appDescription;
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         EmailVerifPlan           dataMail = new EmailVerifPlan(planVerificationItems, login, 3);
         PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
         planVerificationItemsLog.action = "Начата приемка изделия на проверку: " + planVerificationItems.appDate.Value.ToShortDateString();
         planVerificationItemsLog.date   = DateTime.Now;
         planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
         planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Погадо Евгений Владимирович").Id;
         db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 2
0
 public JsonResult UpdateTE(int id, DateTime?planDate, string planDescription)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (planDate != null)
         {
             planVerificationItems.planDate = planDate.Value;
             planVerificationItems.@fixed   = true;
         }
         if (planDescription != null)
         {
             planVerificationItems.planDescription = planDescription;
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 1);
         ProjectServer_UpdateMustStartOnCRUD projectServer_UpdateMustStartOnCRUD = new ProjectServer_UpdateMustStartOnCRUD(planVerificationItems.id_PZ_PlanZakaz, "ПП", planVerificationItems.planDate.Value);
         PlanVerificationItemsLog            planVerificationItemsLog            = new PlanVerificationItemsLog();
         planVerificationItemsLog.action = "Установлен плановый срок проверки изделия: " + planVerificationItems.planDate.Value.ToShortDateString();
         planVerificationItemsLog.date   = DateTime.Now;
         planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
         planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Брель Андрей Викторович").Id;
         db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 3
0
 public JsonResult UpdateTM(int id, DateTime?factDate, string factDescription, DateTime?fixedDateForKO)
 {
     using (PortalKATEKEntities db = new PortalKATEKEntities())
     {
         string login = HttpContext.User.Identity.Name;
         db.Configuration.ProxyCreationEnabled = false;
         db.Configuration.LazyLoadingEnabled   = false;
         PlanVerificationItems planVerificationItems = db.PlanVerificationItems.Find(id);
         if (factDate != null)
         {
             planVerificationItems.factDate = factDate.Value;
             EmailVerifPlan           dataMail = new EmailVerifPlan(planVerificationItems, login, 2);
             PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
             planVerificationItemsLog.action = "ПО передало изделие на проверку ОТК: " + planVerificationItems.factDate.Value.ToShortDateString();
             planVerificationItemsLog.date   = DateTime.Now;
             planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
             planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Медведев Андрей").Id;
             db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
             db.SaveChanges();
         }
         if (factDescription != null)
         {
             planVerificationItems.factDescription = factDescription;
         }
         if (fixedDateForKO != null)
         {
             planVerificationItems.fixedDateForKO = fixedDateForKO.Value;
             if (planVerificationItems.fixedDateForKO < planVerificationItems.planDate)
             {
                 EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 5);
             }
             else
             {
                 EmailVerifPlan dataMail = new EmailVerifPlan(planVerificationItems, login, 4);
             }
             PlanVerificationItemsLog planVerificationItemsLog = new PlanVerificationItemsLog();
             planVerificationItemsLog.action = "Указан прогнозируемый срок передачи изделия на проверку: " + planVerificationItems.fixedDateForKO.Value.ToShortDateString();
             planVerificationItemsLog.date   = DateTime.Now;
             planVerificationItemsLog.id_PlanVerificationItems = planVerificationItems.id;
             planVerificationItemsLog.id_AspNetUsers           = db.AspNetUsers.First(d => d.CiliricalName == "Медведев Андрей").Id;
             db.PlanVerificationItemsLog.Add(planVerificationItemsLog);
             db.SaveChanges();
         }
         db.Entry(planVerificationItems).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
 }