internal static BOMFileModel Mapping(USR_TMMA_BOM_FILE o) { try { if (o != null) { return(new BOMFileModel() { BOMFileID = o.BOMFileID, RecObjectName = o.RecObjectName, UserSAP = o.UserSAP, BOMFilePath = o.BOMFilePath, BOMFileVersion = o.BOMFileVersion, BOMFileStatus = o.BOMFileStatus, FileStatus = FileStatusDAL.GetFileStatus(o.BOMFileStatus), ProductsTypeID = o.ProductsTypeID, ValidDate = o.ValidDate, IsActive = o.IsActive == 1, CreatedBy = o.CreatedBy, CreatedDate = o.CreatedDate, UpdatedBy = o.UpdatedBy, UpdatedDate = o.UpdatedDate }); } return(null); } catch (Exception ex) { throw ex; } }
public static ResponseModel UpdateStatusBOMFile(int BOMFileID, int BOMFileStatus) { string action = "UpdateStatusBOMFile(BOMFileModel)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_BOM_FILE _obj = context.USR_TMMA_BOM_FILE.FirstOrDefault(o => o.BOMFileID == BOMFileID); if (_obj != null) { _obj.BOMFileStatus = BOMFileStatus; context.SaveChanges(); return(new ResponseModel() { Source = SOURCE, Action = action, Status = true, Message = "Success" }); } return(new ResponseModel() { Source = SOURCE, Action = action, Status = false, Message = "BOMFileID Not Exist" }); } } 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 static BOMFileModel GetBOMFile(int bomFileID) { ACTION = "GetBOMFile(bomFileID)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_BOM_FILE obj = context.USR_TMMA_BOM_FILE.Where(o => o.BOMFileID == bomFileID).FirstOrDefault(); BOMFileModel m = Mapping(obj); return(m); } } catch (Exception ex) { throw ex; } }
public static ResponseModel AddBOMFile(BOMFileModel m, ref int _newID) { string action = "AddBOMFile(BOMFileModel, out _newID)"; _newID = 0; try { if (m != null) { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_BOM_FILE _obj = Mapping(m); context.USR_TMMA_BOM_FILE.Add(_obj); if (context.SaveChanges() > 0) { _newID = _obj.BOMFileID; 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 }); } }