public ActionResult ActivityStore(int Id)
        {
            var activity = _memberActivityContract.View(Id);

            if (activity == null)
            {
                return(Json(OperationResult.Error("未找到活动")));
            }
            var storeIds = new List <int>();

            if (activity.IsAllStore)
            {
                storeIds = _storeContract.QueryAllStore().Select(s => s.Id).ToList();
            }
            else
            {
                storeIds = activity.StoreIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
            }
            ViewBag.Stores = _storeContract.QueryAllStore().Where(s => storeIds.Contains(s.Id)).Select(s => new SelectListItem()
            {
                Text  = s.StoreName,
                Value = s.Id.ToString()
            }).ToList();
            return(PartialView());
        }
Пример #2
0
        public async Task <ActionResult> GetHistoryApply(string number, int pageIndex = 1, int pageSize = 10)
        {
            try
            {
                var storeIds = _storeContract.QueryManageStoreId(AuthorityHelper.OperatorId.Value);

                var departmentIds = _storeContract.QueryAllStore().Where(s => storeIds.Contains(s.Id)).Select(s => s.DepartmentId.Value).ToList();

                var query = _timeoutRequestContract.Entities.Where(r => !r.IsDeleted && r.IsEnabled && departmentIds.Contains(r.DepartmentId));
                if (!string.IsNullOrWhiteSpace(number))
                {
                    query = query.Where(r => r.Number.StartsWith(number));
                }
                var data = await query.OrderByDescending(r => r.UpdatedTime)
                           .Select(r => new { r.Number, r.CreatedTime, State = r.State.ToString(), TimeoutType = r.TimeoutType.Name, DepartmentName = r.Department.DepartmentName })
                           .Skip((pageIndex - 1) * pageSize).Take(pageSize)
                           .ToListAsync();

                var res = data.Select(r => new
                {
                    CreatedTime = r.CreatedTime.ToUnixTime(),
                    r.DepartmentName,
                    r.Number,
                    r.State,
                    r.TimeoutType
                });
                return(Json(OperationResult.OK(res), JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(OperationResult.Error(e.Message)));
            }
        }
 private string GetStoreDic()
 {
     return(JsonConvert.SerializeObject(_storeContract.QueryAllStore().Select(m => new { m.Id, m.StoreName }).ToList()));
 }