Beispiel #1
0
        public void DeleteLimsEquipmentLink(LimsPlanEquipmentLink entityToDelete)
        {
            if (AppContext.Entry(entityToDelete).State == EntityState.Detached)
            {
                AppContext.LimsPlanEquipmentLinks.Attach(entityToDelete);
            }

            var entToDelete = entityToDelete as ISoftDeleteEntity;

            if (entToDelete != null)
            {
                entToDelete.DeleteDate = DateTime.Now;
                UpdateLimsEquipmentLink(entityToDelete);
            }
            else
            {
                AppContext.LimsPlanEquipmentLinks.Remove(entityToDelete);
            }
        }
 public ActionResult DestroyPlanEquipment([DataSourceRequest] DataSourceRequest request, LimsPlanEquipmentLink model)
 {
     if (model != null)
     {
         EquipmentPlanRepository eRepository = new EquipmentPlanRepository(false);
         eRepository.DeleteLimsEquipmentLink(model.Id);
         eRepository.Save();
     }
     return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
 }
        public ActionResult UpdatePlanEquipment([DataSourceRequest] DataSourceRequest request, LimsPlanEquipmentLink model)
        {
            ModelState.Remove("EquipmentPlanId");
            ModelState.Remove("CreateDate");
            ModelState.Remove("LimsEquipment.CreateDate");

            foreach (ModelState modelState in ViewData.ModelState.Values)
            {
                foreach (ModelError error in modelState.Errors)
                {
                    var e = error;
                }
            }

            if (ModelState.IsValid)
            {
                EquipmentPlanRepository eRepository = new EquipmentPlanRepository(false);
                if (model.IsSignLocal)
                {
                    model.SignDate = DateTime.Now;
                }
                eRepository.UpdateLimsEquipmentLink(model);
                eRepository.Save();
            }
            return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
        }
 public ActionResult CreatePlanEquipment([DataSourceRequest] DataSourceRequest request, [Bind(Exclude = "Id")] LimsPlanEquipmentLink model)
 {
     ModelState.Remove("EquipmentPlanId");
     if (ModelState.IsValid)
     {
         EquipmentPlanRepository eRepository = new EquipmentPlanRepository(false);
         model.Id         = Guid.NewGuid();
         model.CreateDate = DateTime.Now;
         if (model.IsSignLocal)
         {
             model.SignDate = DateTime.Now;
         }
         eRepository.InsertLimsEquipmentLink(model);
         eRepository.Save();
     }
     return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
 }
Beispiel #5
0
 public virtual void UpdateLimsEquipmentLink(LimsPlanEquipmentLink entityToUpdate)
 {
     AppContext.LimsPlanEquipmentLinks.Attach(entityToUpdate);
     AppContext.Entry(entityToUpdate).State = EntityState.Modified;
 }
Beispiel #6
0
        public void DeleteLimsEquipmentLink(object id)
        {
            LimsPlanEquipmentLink entityToDelete = AppContext.LimsPlanEquipmentLinks.Find(id);

            DeleteLimsEquipmentLink(entityToDelete);
        }
Beispiel #7
0
 public void InsertLimsEquipmentLink(LimsPlanEquipmentLink entity)
 {
     AppContext.LimsPlanEquipmentLinks.Add(entity);
 }