Exemple #1
0
        public IQueryable <MaterialReasonDTO> GetInfo(MaterialReasonDTO searchModel, Page page, out int totalcount)
        {
            var query = from M in DataContext.Material_Reason
                        join mat in DataContext.Material_Info
                        on M.Material_UID equals mat.Material_Uid
                        join users in DataContext.System_Users
                        on M.Modified_UID equals users.Account_UID
                        select new MaterialReasonDTO
            {
                Material_Reason_UID = M.Material_Reason_UID,
                Material_Id         = mat.Material_Id,
                Material_Name       = mat.Material_Name,
                Material_Types      = mat.Material_Types,
                Reason        = M.Reason,
                ModifiedUser  = users.User_Name,
                Modified_Date = M.Modified_Date,
                PlantId       = mat.Organization_UID
            };

            if (!string.IsNullOrWhiteSpace(searchModel.Material_Id))
            {
                query = query.Where(m => m.Material_Id.Contains(searchModel.Material_Id));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.Material_Name))
            {
                query = query.Where(m => m.Material_Name.Contains(searchModel.Material_Name));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.Material_Types))
            {
                query = query.Where(m => m.Material_Types.Contains(searchModel.Material_Types));
            }
            if (!string.IsNullOrWhiteSpace(searchModel.ModifiedUser))
            {
                query = query.Where(m => m.ModifiedUser.Contains(searchModel.ModifiedUser));
            }
            if (searchModel.PlantId != 0)
            {
                query = query.Where(m => m.PlantId == searchModel.PlantId);
            }
            totalcount = query.Count();
            query      = query.OrderByDescending(m => m.Modified_Date).ThenBy(m => m.Material_Id).GetPage(page);
            return(query);
        }
Exemple #2
0
        public List <MaterialReasonDTO> DoAllExportMatReasonReprot(MaterialReasonDTO search)
        {
            var query = from M in DataContext.Material_Reason
                        join mat in DataContext.Material_Info
                        on M.Material_UID equals mat.Material_Uid
                        join users in DataContext.System_Users
                        on M.Modified_UID equals users.Account_UID
                        select new MaterialReasonDTO
            {
                Material_Reason_UID = M.Material_Reason_UID,
                Material_Id         = mat.Material_Id,
                Material_Name       = mat.Material_Name,
                Material_Types      = mat.Material_Types,
                Reason        = M.Reason,
                ModifiedUser  = users.User_Name,
                Modified_Date = M.Modified_Date,
                PlantId       = mat.Organization_UID
            };

            if (!string.IsNullOrWhiteSpace(search.Material_Id))
            {
                query = query.Where(m => m.Material_Id.Contains(search.Material_Id));
            }
            if (!string.IsNullOrWhiteSpace(search.Material_Name))
            {
                query = query.Where(m => m.Material_Name.Contains(search.Material_Name));
            }
            if (!string.IsNullOrWhiteSpace(search.Material_Types))
            {
                query = query.Where(m => m.Material_Types.Contains(search.Material_Types));
            }
            if (!string.IsNullOrWhiteSpace(search.ModifiedUser))
            {
                query = query.Where(m => m.ModifiedUser.Contains(search.ModifiedUser));
            }
            if (search.PlantId != 0)
            {
                query = query.Where(m => m.PlantId == search.PlantId);
            }
            return(query.ToList());
        }