internal static PackagingInstructionFileModel Mapping(USR_TMMA_PACKAGING_INSTRUCTION_FILE o) { try { if (o != null) { return(new PackagingInstructionFileModel() { PackagingInstructionFileID = o.PackagingInstructionFileID, RecObjectName = o.RecObjectName, UserSAP = o.UserSAP, PackagingInstructionFilePath = o.PackagingInstructionFilePath, PackagingInstructionFileVersion = o.PackagingInstructionFileVersion, PackagingInstructionFileStatus = o.PackagingInstructionFileStatus, FileStatus = FileStatusDAL.GetFileStatus(o.PackagingInstructionFileStatus), ProductsTypeID = o.ProductsTypeID, 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 UpdateStatusPackagingInstructionFile(int PackagingInstructionFileID, int PackagingInstructionFileStatus) { string action = "UpdateStatusPackagingInstructionFile(PackagingInstructionFileID, PackagingInstructionFileStatus)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_PACKAGING_INSTRUCTION_FILE _obj = context.USR_TMMA_PACKAGING_INSTRUCTION_FILE.FirstOrDefault(o => o.PackagingInstructionFileID == PackagingInstructionFileID); if (_obj != null) { _obj.PackagingInstructionFileStatus = PackagingInstructionFileStatus; context.SaveChanges(); return(new ResponseModel() { Source = SOURCE, Action = action, Status = true, Message = "Success" }); } return(new ResponseModel() { Source = SOURCE, Action = action, Status = false, Message = "PackagingInstructionFileID 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 PackagingInstructionFileModel GetPackagingInstructionFile(int packagingInstructionFileID) { ACTION = "GetPackagingInstructionFile(packagingInstructionFileID)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_PACKAGING_INSTRUCTION_FILE obj = context.USR_TMMA_PACKAGING_INSTRUCTION_FILE.Where(o => o.PackagingInstructionFileID == packagingInstructionFileID).FirstOrDefault(); PackagingInstructionFileModel m = Mapping(obj); return(m); } } catch (Exception ex) { throw ex; } }
public static ResponseModel AddPackagingInstructionFile(PackagingInstructionFileModel m, ref int _newID) { string action = "AddPackagingInstructionFile(PackagingInstructionFileModel, out _newID)"; _newID = 0; try { if (m != null) { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_PACKAGING_INSTRUCTION_FILE _obj = Mapping(m); context.USR_TMMA_PACKAGING_INSTRUCTION_FILE.Add(_obj); if (context.SaveChanges() > 0) { _newID = _obj.PackagingInstructionFileID; 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 }); } }