Beispiel #1
0
        public async Task <PagedList <Receive> > GetWithPaginations(PaginationParams param)
        {
            var receives = _repoReceive.FindAll(x => x.Status == "1");

            receives = receives.OrderByDescending(x => x.Register_Date);
            return(await PagedList <Receive> .CreateAsync(receives, param.PageNumber, param.PageSize));
        }
        public async Task <PagedList <ReceiveInformationModel> > GetWithPaginations(PaginationParams param, string userID)
        {
            var user     = _repoUse.FindSingle(x => x.ID.Trim() == userID.Trim());
            var products = _repoProduct.FindAll();
            var receives = _repoReceive.FindAll(x => x.DepID.Trim() == user.DepID && x.Status == "0");
            var data     = (from a in receives
                            // join b in products
                            // on a.ProductID equals b.ID
                            select new ReceiveInformationModel()
            {
                ID = a.ID,
                UserID = a.UserID,
                Accept_ID = a.Accept_ID,
                DepID = a.DepID,
                // ProductID = a.ProductID,
                // ProductName = b.Name,
                // Qty = a.Qty,
                Register_Date = a.Register_Date,
                Accept_Date = a.Accept_Date,
                Status = a.Status,
                Updated_By = a.Updated_By,
                Updated_Time = a.Updated_Time
            }).OrderByDescending(x => x.Register_Date);

            return(await PagedList <ReceiveInformationModel> .CreateAsync(data, param.PageNumber, param.PageSize));
        }
Beispiel #3
0
        public async Task <PagedList <ReceiveInformationModel> > GetWithPaginations(PaginationParams param, string user)
        {
            var receives    = _repoReceive.FindAll(x => x.Status.Trim() != "-1");
            var products    = _repoProduct.FindAll();
            var users       = _repoUser.FindAll();
            var departments = _repoDepartment.FindAll();
            var userLogin   = _repoUser.FindSingle(x => x.ID.Trim() == user.Trim());

            if (userLogin.RoleID == 0 || userLogin.RoleID == 1)
            {
            }
            else if (userLogin.RoleID == 2)
            {
                receives = receives.Where(x => x.DepID.Trim() == userLogin.DepID.Trim() &&
                                          x.Status.Trim() != "2");
            }
            else if (userLogin.RoleID == 3)
            {
                receives = receives.Where(x => x.UserID.Trim() == user);
            }
            var data = await(from a in receives
                             // join b in products on a.ProductID.Trim() equals b.ID.Trim()
                             join c in departments on a.DepID.Trim() equals c.ID.Trim()
                             join d in users on a.UserID.Trim() equals d.ID.Trim()
                             select new ReceiveInformationModel()
            {
                ID         = a.ID,
                UserID     = a.UserID,
                UserName   = d.Name,
                Accept_ID  = a.Accept_ID,
                DepID      = a.DepID,
                DepName    = c.Name_LL,
                DepName_ZW = c.Name_ZW,
                // ProductID = a.ProductID,
                // ProductName = b.Name,
                // Qty = a.Qty,
                Register_Date = a.Register_Date,
                Accept_Date   = a.Accept_Date,
                Updated_By    = a.Updated_By,
                Status        = a.Status.Trim(),
                Updated_Time  = a.Updated_Time
            }).OrderByDescending(x => x.Register_Date).ToListAsync();

            foreach (var item in data)
            {
                if (item.Accept_ID != null)
                {
                    var userAccept = _repoUser.FindSingle(x => x.ID.Trim() == item.Accept_ID.Trim());
                    if (userAccept != null)
                    {
                        item.AcceptName = userAccept.Name;
                    }
                }
            }
            return(PagedList <ReceiveInformationModel> .Create(data, param.PageNumber, param.PageSize));
        }
Beispiel #4
0
        public async Task <PagedList <ReceiveInformationModel> > GetWithPaginations(PaginationParams param)
        {
            var products    = _repoProduct.FindAll();
            var categorys   = _repoCategory.FindAll();
            var receives    = _repoReceive.FindAll(x => x.Status == "1");
            var departments = _repoDepartment.FindAll();
            var data        = (from r in receives join p in products
                               on r.ProductID.Trim() equals p.ID.Trim()
                               join c in categorys on p.CatID equals c.ID
                               join d in departments on r.DepID.Trim() equals d.ID.Trim()
                               select new ReceiveInformationModel()
            {
                ID = r.ID,
                UserID = r.UserID,
                Accept_ID = r.Accept_ID,
                DepID = r.DepID,
                DepName = d.Name_LL,
                CategoryID = c.ID,
                ProductID = r.ProductID,
                ProductName = p.Name,
                Qty = r.Qty,
                Register_Date = r.Register_Date,
                Accept_Date = r.Accept_Date,
                Updated_Time = r.Updated_Time,
                Updated_By = r.Updated_By
            }).OrderByDescending(x => x.Register_Date);

            return(await PagedList <ReceiveInformationModel> .CreateAsync(data, param.PageNumber, param.PageSize));
        }
Beispiel #5
0
        public async Task <PagedList <Receive> > GetWithPaginations(PaginationParams param, string userID)
        {
            var receives = _repoReceive.FindAll(x => x.UserID.Trim() == userID && x.Status != "-1" &&
                                                x.Status != "2").OrderByDescending(x => x.Updated_Time);

            return(await PagedList <Receive> .CreateAsync(receives, param.PageNumber, param.PageSize));
        }