internal static USR_TMMA_ROUTING_FILE Mapping(RoutingFileModel o) { try { if (o != null) { return(new USR_TMMA_ROUTING_FILE() { RoutingFileID = o.RoutingFileID, RecObjectName = o.RecObjectName, UserSAP = o.UserSAP, RoutingFilePath = o.RoutingFilePath, RoutingFileVersion = o.RoutingFileVersion, RoutingFileStatus = o.RoutingFileStatus, ProductsTypeID = o.ProductsTypeID, IsActive = o.IsActive ? 1 : 0, CreatedBy = o.CreatedBy, CreatedDate = o.CreatedDate, UpdatedBy = o.UpdatedBy, UpdatedDate = o.UpdatedDate, ValidDate = o.ValidDate }); } return(null); } catch (Exception ex) { throw ex; } }
public static ResponseModel AddRoutingFile(RoutingFileModel m, ref int _newID) { ACTION = "AddRoutingFile(RoutingFileModel)"; try { _newID = 0; ResponseModel res = RoutingFileDAL.AddRoutingFile(m, ref _newID); return(new ResponseModel() { Action = ACTION, Source = SOURCE, Message = res.Message, Status = res.Status }); } catch (Exception ex) { return(new ResponseModel() { Action = ACTION, Source = SOURCE, Message = ex.Message, Status = false }); } }
public static RoutingFileModel GetRoutingFile(int routingFileID) { ACTION = "GetRoutingFile(routingFileID)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_ROUTING_FILE obj = context.USR_TMMA_ROUTING_FILE.Where(o => o.RoutingFileID == routingFileID).FirstOrDefault(); RoutingFileModel m = Mapping(obj); return(m); } } catch (Exception ex) { throw ex; } }
public static RoutingFileModel GetRoutingFileLastVersion(int ProductsTypeID) { ACTION = "GetRoutingFileLastVersion(ProductsTypeID)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { var list = context.USR_TMMA_ROUTING_FILE.Where(a => a.ProductsTypeID == ProductsTypeID).ToList(); var o = list.Last(); RoutingFileModel m = Mapping(o); return(m); } } catch (Exception ex) { throw ex; } }
public static ResponseModel AddRoutingFile(RoutingFileModel m, ref int _newID) { ACTION = "AddRoutingFile(RoutingFileModel, out _newID)"; _newID = 0; try { if (m != null) { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_ROUTING_FILE _obj = Mapping(m); context.USR_TMMA_ROUTING_FILE.Add(_obj); if (context.SaveChanges() > 0) { _newID = _obj.RoutingFileID; return(new ResponseModel() { Source = SOURCE, Action = ACTION, Status = true, Message = "Success" }); } return(new ResponseModel() { Source = SOURCE, Action = ACTION, Status = false, Message = "Fail" }); } } return(new ResponseModel() { Source = SOURCE, Action = ACTION, Status = false, Message = "Null" }); } catch (DbEntityValidationException ex) { return(new ResponseModel() { Source = SOURCE, Action = ACTION, Status = false, Message = ex.Message, StackTrace = ex.StackTrace }); } catch (Exception ex) { return(new ResponseModel() { Source = SOURCE, Action = ACTION, Status = false, Message = ex.Message, StackTrace = ex.StackTrace }); } }
public ResponseModel AddRoutingFile(RoutingFileModel m, ref int _newID) { return(RoutingFileBLL.AddRoutingFile(m, ref _newID)); }