public bool UpdateBatteryLine(tblBatteryComponentInfo productionLine) { _entity.Configuration.LazyLoadingEnabled = false; tblBatteryComponentInfo list = _entity.tblBatteryComponentInfo.FirstOrDefault(x => x.Id == productionLine.Id); if (list != null) { if (productionLine.ProjectName != "") { list.ProjectName = productionLine.ProjectName; } list.PcbPassed = productionLine.PcbPassed; list.PcbIssued = productionLine.PcbIssued; list.PcbFailed = productionLine.PcbFailed; list.CellIssued = productionLine.CellIssued; list.CellPassed = productionLine.CellPassed; list.CellFailed = productionLine.CellFailed; _entity.Entry(list).State = EntityState.Modified; _entity.SaveChanges(); } else { return(false); } return(true); }
public List <tblBatteryComponentInfo> ProjectNameExist(tblBatteryComponentInfo tblLineSetup) { try { IBattery iAdmin = new WCMS_DAL_BatteryStation(); return(iAdmin.ProjectNameExist(tblLineSetup)); } catch (Exception ex) { throw ex; } }
public bool InsertProductionLine(tblBatteryComponentInfo productionLine) { try { _entity.tblBatteryComponentInfo.Add(productionLine); _entity.SaveChanges(); } catch (Exception ex) { throw ex; } return(true); }
public Result UpdateBatteryLine(tblBatteryComponentInfo productionLine) { try { return(_batteryManager.UpdateBatteryLine(productionLine)); } catch (Exception ex) { return(new Result { IsSuccess = false, Message = ex.Message }); } }
public List <tblBatteryComponentInfo> ProjectNameExist(tblBatteryComponentInfo tblLineSetup) { var list = new List <tblBatteryComponentInfo>(); try { list = _batteryManager.ProjectNameExist(tblLineSetup); } catch (Exception ex) { } return(list); }
public Result InsertBatteryComponentInfo(tblBatteryComponentInfo batteryComponent) { try { //tblBatteryComponentInfo batteryComponents = null; return(_batteryManager.InsertBatteryComponentInfo(batteryComponent)); } catch (Exception ex) { return(new Result { IsSuccess = false, Message = ex.Message }); } }
public JsonResult UpdateBatteryLine(tblBatteryComponentInfo productionLine) { var userId = (long)_dictionary[2].Id; var projectId = (long)_dictionary[3].Id; Result result = new Result(); productionLine.UpdateBy = (int)userId; productionLine.UpdateDate = DateTime.Now; result = _batteryService.UpdateBatteryLine(productionLine); return(Json(result)); }
public bool InsertBatteryComponentInfo(tblBatteryComponentInfo batteryComponent) { try { _entity.tblBatteryComponentInfo.Add(batteryComponent); _entity.SaveChanges(); return(true); } catch (Exception exception) { throw exception; } }
public JsonResult InsertBatteryComponentInfo(tblBatteryComponentInfo batteryComponent) { var userId = (long)_dictionary[2].Id; var projectId = (long)_dictionary[3].Id; var result = new Result(); batteryComponent.AddedBy = (int)userId; batteryComponent.AddedDate = DateTime.Now; var tblBatteryComponentInfo = new tblBatteryComponentInfo(); try { var existUser = _batteryService.ProjectNameExist(new tblBatteryComponentInfo() { ProjectName = batteryComponent.ProjectName }).FirstOrDefault(); if (existUser == null) { //tblBatteryComponentInfo.PorjectId = batteryComponent.PorjectId; //tblBatteryComponentInfo.ProjectName = batteryComponent.ProjectName; //tblBatteryComponentInfo.LineId = batteryComponent.LineId; //tblBatteryComponentInfo.LineName = batteryComponent.LineName; //tblBatteryComponentInfo.PcbIssued = batteryComponent.PcbIssued; //tblBatteryComponentInfo.PcbPassed = batteryComponent.PcbPassed; //tblBatteryComponentInfo.PcbFailed = batteryComponent.PcbFailed; //tblBatteryComponentInfo.CellIssued = batteryComponent.CellIssued; //tblBatteryComponentInfo.CellPassed = batteryComponent.CellPassed; //tblBatteryComponentInfo.CellFailed = batteryComponent.CellFailed; result = _batteryService.InsertBatteryComponentInfo(batteryComponent); } else { result.Message = "Current Project Already Exists"; } } catch (Exception ex) { } return(Json(result)); }
public List <tblBatteryComponentInfo> ProjectNameExist(tblBatteryComponentInfo tblLineSetup) { List <tblBatteryComponentInfo> list; try { DateTime startDate = DateTime.Today; DateTime endDate = startDate.AddDays(1).AddTicks(-1); list = _entity.tblBatteryComponentInfo.Where(a => a.AddedDate >= startDate && a.AddedDate <= endDate && a.ProjectName == tblLineSetup.ProjectName).ToList(); } catch (Exception ex) { throw ex; } return(list); }
public bool DeleteProductionLine(int id) { _entity.Configuration.LazyLoadingEnabled = false; tblBatteryComponentInfo line = _entity.tblBatteryComponentInfo.Find(id); if (line != null) { _entity.tblBatteryComponentInfo.Remove(line); _entity.SaveChanges(); } else { return(false); } return(true); }
public Result UpdateBatteryLine(tblBatteryComponentInfo productionLine) { try { IBattery iBattery = new WCMS_DAL_BatteryStation(); using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, ApplicationState.TransactionOptions)) { Result _Result = new Result(); _Result.IsSuccess = iBattery.UpdateBatteryLine(productionLine); if (_Result.IsSuccess) { transaction.Complete(); } return(_Result); } } catch (Exception ex) { throw ex; } }
public Result InsertBatteryComponentInfo(tblBatteryComponentInfo batteryComponent) { try { using ( var transaction = new TransactionScope(TransactionScopeOption.Required, ApplicationState.TransactionOptions)) { var result = new Result(); result.IsSuccess = _iBattery.InsertBatteryComponentInfo(batteryComponent); if (result.IsSuccess) { transaction.Complete(); } return(result); } } catch (Exception ex) { throw ex; } }