Beispiel #1
0
        /// <summary>
        /// 活动首页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Index(int?id)
        {
            try
            {
                #region  构造参数

                var page = id ?? 1;
                page = page <= 0 ? 1 : page;

                var pageOption = new MoPagerOption
                {
                    CurrentPage = page,
                    PageSize    = 8,
                    Total       = 0,
                    RouteUrl    = $"/Pictures/Index",
                    StyleNum    = 1,

                    JoinOperateCode = ""
                };
                #endregion

                var modules = _db.ToModule.Where(b => b.Status == (int)EnumHelper.EmModuleStatus.启用).AsEnumerable();
                pageOption.Total = modules.Count();
                modules          = modules.OrderByDescending(b => b.CreateTime).Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToList();

                ViewBag.PagerOption = pageOption;
                return(View(modules));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
        /// <summary>
        /// 记录日志列表  page-codeId
        /// </summary>
        /// <returns></returns>
        public IActionResult UserLogs(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest());
            }

            #region  构造参数
            var paramArr = id.Split('-');
            if (paramArr.Length != 2)
            {
                return(BadRequest());
            }
            var page   = Convert.ToInt32(paramArr[1]);
            var codeId = Convert.ToInt32(paramArr[0]);
            if (codeId != (int)EnumHelper.EmLogCode.登录 && codeId != (int)EnumHelper.EmLogCode.积分)
            {
                return(BadRequest());
            }
            page = page <= 0 ? 1 : page;

            var pageOption = new MoPagerOption
            {
                CurrentPage = page,
                PageSize    = 15,
                Total       = 0,
                RouteUrl    = $"/usercenter/userlogs/{codeId}",
                StyleNum    = 1,

                JoinOperateCode = "-"
            };
            #endregion

            var userLogs = _db.ToUserLog.
                           Where(b => b.UserId == _MyUserInfo.Id && b.CodeId == codeId).AsEnumerable();
            pageOption.Total = userLogs.Count();
            userLogs         = userLogs.OrderByDescending(b => b.Id).
                               Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).
                               Take(pageOption.PageSize).
                               ToList();
            ViewBag.PagerOption = pageOption;

            var userLog = new ToUserLog
            {
                CodeId = codeId,
                Des    = $"{Enum.GetName(typeof(EnumHelper.EmLogCode), codeId)}记录"
            };
            ViewData["userLog"] = userLog;

            return(View(userLogs));
        }
Beispiel #3
0
        /// <summary>
        /// 指定活动列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Pictures(string id)
        {
            try
            {
                #region  构造参数
                var paramArr = id.Split('-');
                if (paramArr.Length != 2)
                {
                    return(BadRequest());
                }

                var page     = Convert.ToInt32(paramArr[1]);
                var moduleId = Convert.ToInt32(paramArr[0]);

                var module = _db.ToModule.SingleOrDefault(b => b.Id == moduleId && b.Status == (int)EnumHelper.EmModuleStatus.启用);
                if (module == null)
                {
                    return(BadRequest());
                }
                page = page <= 0 ? 1 : page;

                var pageOption = new MoPagerOption
                {
                    CurrentPage = page,
                    PageSize    = 16,
                    Total       = 0,
                    RouteUrl    = $"/Pictures/Pictures/{moduleId}",
                    StyleNum    = 1,

                    JoinOperateCode = "-"
                };
                #endregion

                var contents = _db.ToContent.Where(b => b.ModuleId == moduleId && b.Status == (int)EnumHelper.EmContentStatus.公有).AsEnumerable();
                pageOption.Total = contents.Count();
                contents         = contents.OrderByDescending(b => b.CreateTime).Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToList();

                ViewData["module"]  = module;
                ViewBag.PagerOption = pageOption;
                return(View(contents));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
Beispiel #4
0
 public void OnGet(int pageSize = 10, int pageIndex = 1)
 {
     PagerOption = new MoPagerOption
     {
         CurrentPage = pageIndex,
         PageSize    = pageSize,
         Total       = _pinhuaContext.发货.Count(),
         RouteUrl    = "/OrderManagement/Old/DeliveryOrder"
     };
     DeliveryOrders = new List <Delivery>();
     _pinhuaContext.发货.OrderByDescending(p => p.送货日期).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList().ForEach(p =>
     {
         var details = _pinhuaContext.发货Detail.Where(d => d.ExcelServerRcid == p.ExcelServerRcid).Select(detail => new Detail
         {
             ItemId        = detail.编号,
             Type          = detail.类型,
             Description   = detail.描述,
             Specification = detail.规格,
             Qty           = detail.Pcs,
             UnitQty       = detail.单位数量,
             Unit          = detail.计价单位,
             Price         = detail.单价,
             Amount        = detail.金额
         }).ToList();
         var order = new Delivery
         {
             DeliveryId       = p.送货单号,
             DeliveryDate     = p.送货日期,
             CId              = p.客户编号,
             CName            = p.客户,
             CAddress         = p.地址,
             Remarks          = p.备注,
             OrderType        = p.业务类型,
             OrderDescription = p.业务描述,
             Contacts         = p.联系人,
             Phone            = p.联系电话,
             CreatedBy        = p.创建者,
             Details          = details
         };
         DeliveryOrders.Add(order);
     });
 }
Beispiel #5
0
        public IActionResult Index(int?id, int page = 1)
        {
            List <BookViewModel> list = _bookData.SelectBookByCategoryId(page, 10, id);

            var catList = _bookData.SelectCategorys();

            ViewBag.CatList = catList;

            var pageOption = new MoPagerOption
            {
                CurrentPage = 1,
                PageSize    = 2,
                Total       = 20,
                RouteUrl    = "/Book/Index/?id="
            };

            //分页参数
            ViewBag.PagerOption = pageOption;


            return(View(list));
        }
Beispiel #6
0
        // GET: Device
        public async Task <IActionResult> Index(
            string SortOrder,
            string searchNo,
            string searchSummary,
            string searchUser,
            string searchDepartment,
            string searchStatus,
            int?page
            )
        {
            var toyForSIContext = await _context.Device
                                  .AsNoTracking().Include(d => d.devModel).ThenInclude(m => m.brand)
                                  .Include(d => d.devModel).ThenInclude(m => m.equipmentType)
                                  .Include(d => d.historys).ThenInclude(i => i.toMember)
                                  .Include(d => d.historys).ThenInclude(i => i.toDepartment).ToListAsync();


            Dictionary <string, string> currentFilter = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(searchNo))
            {
                ViewData["SearchNo"] = searchNo;
                currentFilter.Add("searchNo", searchNo);
                toyForSIContext = toyForSIContext.Where(d => d.siSN.Contains(searchNo)).ToList();
            }

            if (!string.IsNullOrEmpty(searchSummary))
            {
                ViewData["SearchSummary"] = searchSummary;
                currentFilter.Add("searchSummary", searchSummary);
                toyForSIContext = toyForSIContext.Where(d => d.DeviceSummary.Contains(searchSummary)).ToList();
            }

            if (!string.IsNullOrEmpty(searchUser))
            {
                ViewData["SearchUser"] = searchUser;
                currentFilter.Add("searchUser", searchUser);
                toyForSIContext = toyForSIContext.Where(d => d.User.Contains(searchUser)).ToList();
            }

            if (!string.IsNullOrEmpty(searchDepartment))
            {
                ViewData["SearchDepartment"] = searchDepartment;
                currentFilter.Add("searchDepartment", searchDepartment);
                toyForSIContext = toyForSIContext.Where(d => d.UserDepartment.Contains(searchDepartment)).ToList();
            }
            int statusCode;

            if (int.TryParse(searchStatus, out statusCode))
            {
                Models.Enum.DeviceStatus dStatus = (Models.Enum.DeviceStatus)statusCode;
                ViewData["SearchStatus"] = (int)dStatus;
                currentFilter.Add("searchStatus", ((int)dStatus).ToString());
                toyForSIContext = toyForSIContext.Where(d => d.historys.LastOrDefault().deviceStatus.Equals(dStatus)).ToList();
            }

            switch (SortOrder)
            {
            case "COL1":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.siSN).ToList();
                ViewData["COL1"] = "COL1_DES";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL1_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.siSN).ToList();
                ViewData["COL1"] = "";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL2":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.DeviceSummary).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2_DES";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL2_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.DeviceSummary).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL3":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.User).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3_DES";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL3_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.User).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;

            case "COL4":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.UserDepartment).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4_DES";
                ViewData["COL5"] = "COL5";
                break;

            case "COL4_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.UserDepartment).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "";
                ViewData["COL5"] = "COL5";
                break;

            case "COL5":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.historys.LastOrDefault().deviceStatus).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5_DES";
                break;

            case "COL5_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.historys.LastOrDefault().deviceStatus).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "";
                break;

            default:
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.deviceId).ToList();
                ViewData["COL1"] = "COL1";
                ViewData["COL2"] = "COL2";
                ViewData["COL3"] = "COL3";
                ViewData["COL4"] = "COL4";
                ViewData["COL5"] = "COL5";
                break;
            }


            //if (dStatus != Models.Enum.DeviceStatus.Unknown)
            //{
            //    ViewData["SearchStatus"] = (int)dStatus;
            //    currentFilter.Add("searchStatus", ((int)dStatus).ToString());
            //    toyForSIContext = toyForSIContext.Where(d => d.LastHistory.deviceStatus.Equals(dStatus));
            //}

            var pageOption = new MoPagerOption
            {
                CurrentPage   = page ?? 1,
                PageSize      = 10,
                Total         = toyForSIContext.Count(),
                RouteUrl      = "/Device/Index",
                CurrentSort   = SortOrder,
                CurrentFilter = currentFilter
            };


            //分页参数
            ViewBag.PagerOption = pageOption;
            return(View(toyForSIContext.Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToList()));
        }
Beispiel #7
0
        // GET: Member
        public async Task <IActionResult> Index(string SortOrder, string searchName, string searchDepartment, string searchPosition, int?page)
        {
            //ViewData["NAME"] = SortOrder == "NAME" ? "NAME_DES" : "NAME";
            //ViewData["DEP"] = SortOrder == "DEP" ? "DEP_DES" : "DEP";
            //ViewData["POS"] = SortOrder == "POS" ? "POS_DES" : "POS";
            var toyForSIContext = await _context.Member.AsTracking()
                                  .Include(m => m.department).Include(m => m.position).OrderBy(d => d.memberId).ToListAsync();

            Dictionary <string, string> currentFilter = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(searchName))
            {
                ViewData["SearchName"] = searchName;
                currentFilter.Add("searchName", searchName);
                toyForSIContext = toyForSIContext.Where(d => d.name.Contains(searchName)).ToList();
            }

            if (!string.IsNullOrEmpty(searchDepartment))
            {
                ViewData["SearchDepartment"] = searchDepartment;
                currentFilter.Add("searchDepartment", searchDepartment);
                toyForSIContext = toyForSIContext.Where(d => d.department.departmentName.Contains(searchDepartment)).ToList();
            }

            if (!string.IsNullOrEmpty(searchPosition))
            {
                ViewData["SearchPosition"] = searchPosition;
                currentFilter.Add("searchPosition", searchPosition);
                toyForSIContext = toyForSIContext.Where(d => d.position.positionName.Contains(searchPosition)).ToList();
            }

            switch (SortOrder)
            {
            case "NAME":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.name).ToList();
                ViewData["NAME"] = "NAME_DES";
                ViewData["DEP"]  = "DEP";
                ViewData["POS"]  = "POS";
                break;

            case "NAME_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.name).ToList();
                ViewData["NAME"] = "";
                ViewData["DEP"]  = "DEP";
                ViewData["POS"]  = "POS";
                break;

            case "DEP":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.departmentId).ToList();
                ViewData["NAME"] = "NAME";
                ViewData["DEP"]  = "DEP_DES";
                ViewData["POS"]  = "POS";
                break;

            case "DEP_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.departmentId).ToList();
                ViewData["NAME"] = "NAME";
                ViewData["DEP"]  = "";
                ViewData["POS"]  = "POS";
                break;

            case "POS":
                toyForSIContext  = toyForSIContext.OrderBy(d => d.positionId).ToList();
                ViewData["NAME"] = "NAME";
                ViewData["DEP"]  = "DEP";
                ViewData["POS"]  = "POS_DES";
                break;

            case "POS_DES":
                toyForSIContext  = toyForSIContext.OrderByDescending(d => d.positionId).ToList();
                ViewData["NAME"] = "NAME";
                ViewData["DEP"]  = "DEP";
                ViewData["POS"]  = "";
                break;

            default:
                toyForSIContext  = toyForSIContext.OrderBy(d => d.memberId).ToList();
                ViewData["NAME"] = "NAME";
                ViewData["DEP"]  = "DEP";
                ViewData["POS"]  = "POS";
                break;
            }

            var pageOption = new MoPagerOption
            {
                CurrentPage   = page ?? 1,
                PageSize      = 10,
                Total         = toyForSIContext.Count(),
                RouteUrl      = "/Member/Index",
                CurrentSort   = SortOrder,
                CurrentFilter = currentFilter
            };

            //分页参数
            ViewBag.PagerOption = pageOption;
            return(View(toyForSIContext.Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToList()));
            //return View(await toyForSIContext.ToListAsync());
        }
        //原始默认方法
        //GET: UWaybillBindings
        //public async Task<IActionResult> Index(int id=1)
        //{
        //    var artiles = _context.UWaybillBinding;
        //    var pageOption = new MoPagerOption
        //    {
        //        CurrentPage = id,
        //        PageSize = 2,
        //        Total = await artiles.CountAsync(),
        //        RouteUrl = "/UWaybillBindings/Index"
        //    };

        //    //分页参数
        //    ViewBag.PagerOption = pageOption;

        //    //数据
        //    return View(await artiles.OrderByDescending(b => b.OrderNo).Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToListAsync());

        //return View(await _context.UWaybillBinding.ToListAsync());
        //}

        /// <summary>
        /// 单一查询方法
        /// </summary>
        /// <param name="searchString"></param>
        /// <returns></returns>
        //public ActionResult Index(string searchString)
        //{

        //    var _UWaybillBinding = from m in _context.UWaybillBinding
        //                select m;

        //    if (!String.IsNullOrEmpty(searchString))
        //    {

        //        _UWaybillBinding = _UWaybillBinding.Where(s => s.Carnumber.Contains(searchString));

        //    }
        //    return View(_UWaybillBinding);
        //}


        public async Task <IActionResult> Index(string Carlist, string SearchString, int id = 1)
        {
            var cateLst = new List <string>();
            var cateQry = from d in _context.UWaybillBinding

                          orderby d.Carnumber

                          select d.Carnumber;

            cateLst.AddRange(cateQry.Distinct());

            ViewBag.Carlist = new SelectList(cateLst);



            ViewBag.SearchString = SearchString;

            var _UWaybillBinding = from m in  _context.UWaybillBinding

                                   select m;

            if (!String.IsNullOrEmpty(SearchString))
            {
                _UWaybillBinding = _UWaybillBinding.Where(s => s.OrderNo.Contains(SearchString));
            }

            if (String.IsNullOrEmpty(Carlist))
            {
                var pageOption = new MoPagerOption
                {
                    CurrentPage = id,
                    PageSize    = 15,
                    Total       = await _UWaybillBinding.CountAsync(),
                    RouteUrl    = "/UWaybillBindings/index",
                    SelectName  = "Carlist",
                    SelectValue = Carlist,
                    TextName    = "SearchString",
                    TextValue   = SearchString
                };

                //分页参数
                ViewBag.PagerOption = pageOption;

                //数据
                return(View(await _UWaybillBinding.OrderByDescending(b => b.OrderNo).Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToListAsync()));
                //return View(_UWaybillBinding);
            }
            else

            {
                _UWaybillBinding = _UWaybillBinding.Where(x => x.Carnumber == Carlist);
                var pageOption = new MoPagerOption
                {
                    CurrentPage = id,
                    PageSize    = 15,
                    Total       = await _UWaybillBinding.CountAsync(),
                    RouteUrl    = "/UWaybillBindings/index",
                    SelectName  = "Carlist",
                    SelectValue = Carlist,
                    TextName    = "SearchString",
                    TextValue   = SearchString
                };

                //分页参数
                ViewBag.PagerOption = pageOption;

                //数据
                return(View(await _UWaybillBinding.OrderByDescending(b => b.OrderNo).Skip((pageOption.CurrentPage - 1) * pageOption.PageSize).Take(pageOption.PageSize).ToListAsync()));
                //return View();
            }
        }