public bool UpdateProductionLine(tblProductionLine productionLine) { _entity.Configuration.LazyLoadingEnabled = false; tblProductionLine list = _entity.tblProductionLine.FirstOrDefault(x => x.LineId == productionLine.LineId); if (list != null) { if (productionLine.LineName != "") { list.LineName = productionLine.LineName; } _entity.Entry(list).State = EntityState.Modified; _entity.SaveChanges(); } else { return(false); } return(true); }
public JsonResult UpdateProductionLine(tblProductionLine productionLine) { Result result; result = _adminService.UpdateProductionLine(productionLine); return(Json(result)); }
public JsonResult InsertProductionLine(tblProductionLine productionLine) { var userId = (long)_dictionary[2].Id; var result = new Result(); if (userId != 0) { try { string lineName = productionLine.LineName.Substring(0, 1); //if (lineName=="L") productionLine.LineCriteria = productionLine.LineCriteria; //if (lineName == "P") // productionLine.LineCriteria = "PackagingLine"; productionLine.AddedBy = userId; productionLine.AddedDate = DateTime.Now; result = _adminService.InsertProductionLine(productionLine); return(Json(result)); } catch (Exception ex) { return(Json(ex)); } } else { return(Json(new Result { Id = "0" })); } }
public bool InsertProductionLine(tblProductionLine productionLine) { try { _entity.tblProductionLine.Add(productionLine); _entity.SaveChanges(); } catch (Exception ex) { throw ex; } return(true); }
public Result UpdateProductionLine(tblProductionLine productionLine) { try { return(adminManager.UpdateProductionLine(productionLine)); } catch (Exception ex) { return(new Result { IsSuccess = false, Message = ex.Message }); } }
public bool DeleteProductionLine(int id) { _entity.Configuration.LazyLoadingEnabled = false; tblProductionLine line = _entity.tblProductionLine.Find(id); if (line != null) { _entity.tblProductionLine.Remove(line); _entity.SaveChanges(); } else { return(false); } return(true); }
public Result InsertProductionLine(tblProductionLine productionLine) { try { IAdmin iAdmin = new WCMS_DAL_Admin(); using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, ApplicationState.TransactionOptions)) { Result _Result = new Result(); _Result.IsSuccess = iAdmin.InsertProductionLine(productionLine); if (_Result.IsSuccess) { transaction.Complete(); } return(_Result); } } catch (Exception ex) { throw ex; } }