public static List <AssignMaterialToRoutingFileModel> GetAssignMaterialToRoutingFileList(AssignMaterialToRoutingFileFilterModel filter, ref int totalRecord, ref ResponseModel response) { ACTION = "GetAssignMaterialToRoutingFileList(AssignMaterialToRoutingFileFilterModel)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { filter.AssignMaterialToRoutingFileIDs = filter.AssignMaterialToRoutingFileIDs != null ? filter.AssignMaterialToRoutingFileIDs : new int[] { }; var IQuery = context.USR_TMMA_ASSIGN_MATERIAL_TO_ROUTING_FILE .Where(o => (!string.IsNullOrEmpty(filter.Keywords) ? (o.RecObjectName.Contains(filter.Keywords)) || (o.CreatedBy.Contains(filter.Keywords)) : true) && (filter.AssignMaterialToRoutingFileID.HasValue ? o.AssignMaterialToRoutingFileID == filter.AssignMaterialToRoutingFileID.Value : true) && (filter.AssignMaterialToRoutingFileIDs.Count() > 0 ? filter.AssignMaterialToRoutingFileIDs.Contains(o.AssignMaterialToRoutingFileID) : true) && (!string.IsNullOrEmpty(filter.RecObjectName) ? filter.CreatedBy.Contains(o.RecObjectName) : true) && (filter.ProductsTypeID.HasValue ? o.ProductsTypeID == filter.ProductsTypeID.Value : true) && (filter.IsActive.HasValue ? o.IsActive == 1 : true) ); totalRecord = IQuery.Count(); List <USR_TMMA_ASSIGN_MATERIAL_TO_ROUTING_FILE> list = filter.Pagination.IsPaging ? IQuery.OrderBy(o => o.CreatedDate).Skip(filter.Pagination.Skip).Take(filter.Pagination.Take).ToList() : IQuery.ToList(); List <AssignMaterialToRoutingFileModel> mList = Mapping(list); response = new ResponseModel() { Source = SOURCE, Action = ACTION, Status = true, Message = "Success" }; return(mList); } } catch (Exception ex) { totalRecord = 0; response = new ResponseModel() { Source = SOURCE, Action = ACTION, Status = false, Message = ex.Message }; return(null); } }
public static AssignMaterialToRoutingFileViewModel GetAssignMaterialToRoutingFileView(AssignMaterialToRoutingFileFilterModel filter) { ACTION = "GetAssignMaterialToRoutingFileView(AssignMaterialToRoutingFileFilterModel)"; try { ResponseModel response = new ResponseModel(); int totalRecord = 0; var model = AssignMaterialToRoutingFileDAL.GetAssignMaterialToRoutingFileList(filter, ref totalRecord, ref response); filter.Pagination.TotalRecord = totalRecord; PaginationModel pagination = new PaginationModel(totalRecord, filter.Pagination.Page, filter.Pagination.Take); filter.Pagination = pagination; return(new AssignMaterialToRoutingFileViewModel() { Action = ACTION, Source = SOURCE, Status = response.Status, Message = response.Message, List = model, Filter = filter }); } catch (Exception ex) { return(new AssignMaterialToRoutingFileViewModel() { Action = ACTION, Source = SOURCE, Status = false, Message = ex.Message, List = null, Filter = filter }); } }
/// <summary> /// AssignMaterialToRoutingFile /// </summary> /// <param name="filter"></param> /// <returns></returns> public AssignMaterialToRoutingFileViewModel GetAssignMaterialToRoutingFileView(AssignMaterialToRoutingFileFilterModel filter) { return(AssignMaterialToRoutingFileBLL.GetAssignMaterialToRoutingFileView(filter)); }