Exemplo n.º 1
0
        public JsonResult List(int page, string keywords, int rows, bool?status = null)
        {
            long            shopId         = base.CurrentSellerManager.ShopId;
            long            id             = base.CurrentSellerManager.Id;
            long            roleId         = base.CurrentSellerManager.RoleId;
            IManagerService managerService = ServiceHelper.Create <IManagerService>();
            ManagerQuery    managerQuery   = new ManagerQuery()
            {
                PageNo   = page,
                PageSize = rows,
                ShopID   = shopId,
                userID   = id,
                roleID   = roleId
            };
            PageModel <ManagerInfo> sellerManagers = managerService.GetSellerManagers(managerQuery);

            //List<RoleInfo> list = ServiceHelper.Create<IPrivilegesService>().GetSellerRoles(shopId).ToList();
            var collection =
                from item in sellerManagers.Models.ToList()
                select new
            {
                Id         = item.Id,
                UserName   = item.UserName,
                CreateDate = item.CreateDate.ToString("yyyy-MM-dd HH:mm"),
                RoleName   = item.RoleName,
                RoleId     = item.RoleId,
                realName   = item.RealName,
                Emails     = item.Email,
                reMark     = item.Remark
            };

            return(Json(new { rows = collection, total = sellerManagers.Total }));
        }
Exemplo n.º 2
0
        private void GetList(HttpContext context)
        {
            int num  = 1;
            int num2 = 10;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            ManagerQuery managerQuery = new ManagerQuery();

            managerQuery.UserName = context.Request["UserName"];
            if (!string.IsNullOrEmpty(context.Request["RoleId"]))
            {
                managerQuery.RoleId = base.GetIntParam(context, "RoleId", false).Value;
            }
            managerQuery.SortBy    = "CreateDate";
            managerQuery.SortOrder = SortAction.Desc;
            managerQuery.PageIndex = num;
            managerQuery.PageSize  = num2;
            DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(managerQuery);
            string s = base.SerializeObjectToJson(dataList);

            context.Response.Write(s);
            context.Response.End();
        }
Exemplo n.º 3
0
 public ActionResult ListPurchased()
 {
     try
     {
         if (User == null || string.IsNullOrEmpty(User.Identity.Name))
         {
             return(PartialView(new List <PurchaseView>()));
         }
         ManagerQuery manager      = new ManagerQuery();
         var          UserID       = manager.GetAllUsers().Where(p => p.UserName == User.Identity.Name).Select(p => p.ID).FirstOrDefault();
         var          model        = new List <PurchaseView>();
         var          lstPurchased = manager.AllPurchases().Where(p => p.UserId.HasValue && p.UserId.Value == UserID && p.PurchasesStatus.HasValue && p.PurchasesStatus.Value == 1).ToList();
         if (lstPurchased.Count > 0)
         {
             foreach (var pur in lstPurchased)
             {
                 var purView = new PurchaseView(pur);
                 purView.Availlability = (pur.CarID.HasValue && pur.PurchaseDate.HasValue && pur.ReturnDate.HasValue) ? CheckCarAvailability(pur.PurchaseDate.Value, pur.ReturnDate.Value, pur.CarID.Value) : false;
                 model.Add(purView);
             }
         }
         return(PartialView(model));
     }
     catch
     {
         return(PartialView(new List <PurchaseView>()));
     }
 }
Exemplo n.º 4
0
        public ManagerQuery GetQuery(HttpContext context)
        {
            int num  = 1;
            int num2 = 10;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            ManagerQuery managerQuery = new ManagerQuery();

            managerQuery.UserName  = context.Request["UserName"];
            managerQuery.UserName  = managerQuery.UserName.Trim();
            managerQuery.StoreId   = base.GetIntParam(context, "storeId", false).Value;
            managerQuery.SortOrder = SortAction.Desc;
            managerQuery.PageIndex = num;
            managerQuery.PageSize  = num2;
            return(managerQuery);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取管理员列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="keywords"></param>
        /// <param name="rows"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        //[UnAuthorize]
        public JsonResult List(int page, string keywords, int rows, bool?status = null)
        {
            IManagerService managerService = this._iManagerService;
            ManagerQuery    managerQuery   = new ManagerQuery()
            {
                PageNo   = page,
                PageSize = rows
            };
            PageModel <ManagerInfo> platformManagers = managerService.GetPlatformManagers(managerQuery);
            List <RoleInfo>         list             = this._iPrivilegesService.GetPlatformRoles().ToList <RoleInfo>();
            var collection =
                from item in platformManagers.Models.ToList <ManagerInfo>()
                select new
            {
                Id         = item.Id,
                UserName   = item.UserName,
                CreateDate = item.CreateDate.ToString("yyyy-MM-dd HH:mm"),
                RoleName   = (item.RoleId == (long)0 ? "系统管理员" : (
                                  from a in list
                                  where a.Id == item.RoleId
                                  select a).FirstOrDefault <RoleInfo>().RoleName),
                RoleId = item.RoleId
            };
            var variable = new { rows = collection, total = platformManagers.Total };

            return(base.Json(variable));
        }
Exemplo n.º 6
0
        public ActionResult Confimation(int dealID)
        {
            //var deals = Session[DEALS_IN_THE_BUSKET] as List<PurchaseView>;

            //var currenDeal = deals.Where(d => d.ID == dealID).FirstOrDefault();

            //deals.Remove(currenDeal);

            //Session[DEALS_IN_THE_BUSKET] = deals;

            //_customer.PurcaseConfirmation(currenDeal.ReturnDateDetails());

            //TempData["Success"] = "Reservation Completed!";

            //return RedirectToAction("PreviousReservations");
            try
            {
                if (User == null || string.IsNullOrEmpty(User.Identity.Name))
                {
                    return(Json(new { IsOk = 0 }, JsonRequestBehavior.AllowGet));
                }
                ManagerQuery manager    = new ManagerQuery();
                var          _Purchases = manager.AllPurchases().Where(p => p.ID == dealID).FirstOrDefault();
                _Purchases.PurchasesStatus = 1;
                manager.UpdatePurchase(_Purchases);
                return(Json(new { IsOk = 1, Url = Url.Action("MyBusket", "Customer") }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { IsOk = -1 }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 7
0
        private void GetList(HttpContext context)
        {
            ManagerQuery query = this.GetQuery(context);
            MemberDetailsModel <Dictionary <string, object> > dataList = this.GetDataList(query);
            string s = base.SerializeObjectToJson(dataList);

            context.Response.Write(s);
            context.Response.End();
        }
Exemplo n.º 8
0
        public PageModel <ManagerInfo> GetPlatformManagers(ManagerQuery query)
        {
            int num = 0;
            IQueryable <ManagerInfo> managerInfos = context.ManagerInfo.FindBy <ManagerInfo, long>((ManagerInfo item) => item.ShopId == 0, query.PageNo, query.PageSize, out num, (ManagerInfo item) => item.RoleId, true);

            return(new PageModel <ManagerInfo>()
            {
                Models = managerInfos,
                Total = num
            });
        }
Exemplo n.º 9
0
        public PageModel <ManagerInfo> GetSellerManagers(ManagerQuery query)
        {
            int num = 0;
            IQueryable <ManagerInfo> managerInfos = context.ManagerInfo.FindBy((ManagerInfo item) => item.ShopId == query.ShopID && item.RoleId != 0 && item.Id != query.userID, query.PageNo, query.PageSize, out num);

            return(new PageModel <ManagerInfo>()
            {
                Models = managerInfos,
                Total = num
            });
        }
Exemplo n.º 10
0
        private void BindData()
        {
            ManagerQuery  managerQuery  = this.GetManagerQuery();
            DbQueryResult dbQueryResult = Methods.Supplier_SGet(managerQuery, null, null);

            this.grdManager.DataSource = dbQueryResult.Data;
            this.grdManager.DataBind();
            this.txtSearchText.Text  = managerQuery.Username;
            this.pager.TotalRecords  = dbQueryResult.TotalRecords;
            this.pager1.TotalRecords = dbQueryResult.TotalRecords;
        }
Exemplo n.º 11
0
        public DbQueryResult GetManagers(ManagerQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("UserName LIKE '%{0}%' AND RoleId !={1} AND RoleId !={2} AND RoleId !={3}", DataHelper.CleanSearchString(query.UserName), -1, -3, -2);
            if (query.RoleId.HasValue)
            {
                stringBuilder.AppendFormat(" AND  RoleId = {0}", query.RoleId.Value);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_Manager", "ManagerId", stringBuilder.ToString(), "*"));
        }
Exemplo n.º 12
0
        public QueryPageModel <ManagerInfo> GetSellerManagers(ManagerQuery query)
        {
            var users = DbFactory.Default.Get <ManagerInfo>().Where(item => item.ShopId == query.ShopID && item.RoleId != 0 && item.Id != query.userID).OrderBy(item => item.Id).ToPagedList(query.PageNo, query.PageSize);
            QueryPageModel <ManagerInfo> pageModel = new QueryPageModel <ManagerInfo>()
            {
                Models = users,
                Total  = users.TotalRecordCount
            };

            return(pageModel);
        }
Exemplo n.º 13
0
        public override DbQueryResult GetManagers(ManagerQuery query)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.Username));
            if (query.RoleId != Guid.Empty)
            {
                builder.AppendFormat(" AND UserId IN (SELECT UserId FROM aspnet_UsersInRoles WHERE RoleId = '{0}')", query.RoleId);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_aspnet_Managers", "UserId", builder.ToString(), "*"));
        }
Exemplo n.º 14
0
        private void BindData()
        {
            ManagerQuery  managerQuery = this.GetManagerQuery();
            DbQueryResult managers     = ManagerHelper.GetManagers(managerQuery);

            this.grdManager.DataSource = managers.Data;
            this.grdManager.DataBind();
            this.txtSearchText.Text          = managerQuery.Username;
            this.dropRolesList.SelectedValue = managerQuery.RoleId;
            this.pager.TotalRecords          = managers.TotalRecords;
        }
Exemplo n.º 15
0
        public DbQueryResult GetManagers(ManagerQuery query)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.Username));
            if (query.RoleId != 0)
            {
                builder.AppendFormat(" AND RoleId = {0}", query.RoleId);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "aspnet_Managers", "UserId", builder.ToString(), "*"));
        }
Exemplo n.º 16
0
        public QueryPageModel <Managers> GetPlatformManagers(ManagerQuery query)
        {
            int total = 0;
            IQueryable <Managers>     users     = Context.Managers.FindBy(item => item.Id > 0, query.PageNo, query.PageSize, out total, item => item.RoleId, true);
            QueryPageModel <Managers> pageModel = new QueryPageModel <Managers>()
            {
                Models = users.ToList(),
                Total  = total
            };

            return(pageModel);
        }
Exemplo n.º 17
0
        public QueryPageModel <ManagerInfo> GetManagersList(ManagerQuery query)
        {
            int total = 0;
            IQueryable <ManagerInfo> users = Context.ManagerInfo.AsQueryable();

            users = users.GetPage(out total, query.PageNo, query.PageSize, d => d.OrderBy(o => o.Id));
            QueryPageModel <ManagerInfo> pageModel = new QueryPageModel <ManagerInfo>()
            {
                Models = users.ToList(), Total = total
            };

            return(pageModel);
        }
Exemplo n.º 18
0
        private bool CheckCarAvailability(DateTime sDateStart, DateTime sDateEnd, int CarID)
        {
            ManagerQuery manager   = new ManagerQuery();
            DateTime     DateStart = new DateTime(sDateStart.Year, sDateStart.Month, sDateStart.Day);
            DateTime     DateEnd   = new DateTime(sDateEnd.Year, sDateEnd.Month, sDateEnd.Day);
            var          listPur   = manager.AllPurchases().Where(p => p.CarID.HasValue && p.CarID.Value == CarID && p.PurchasesStatus.HasValue && p.PurchasesStatus.Value == 1 && p.PurchaseDate.HasValue && p.ReturnDate.HasValue && ((p.PurchaseDate.Value <= DateStart && p.ReturnDate.Value >= DateStart) || (p.PurchaseDate.Value <= DateEnd && DateEnd <= p.ReturnDate.Value))).FirstOrDefault();

            if (listPur != null)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 19
0
        public ActionResult RemoveItemFromBusket(int dealID)
        {
            //var deals = Session[DEALS_IN_THE_BUSKET] as List<PurchaseView>;
            //var dealtoRemove = deals.Where(d => d.ID == dealID).FirstOrDefault();

            //deals.Remove(dealtoRemove);

            //Session[DEALS_IN_THE_BUSKET] = deals;

            //TempData["Success"] = "Order Removed! ";
            ManagerQuery manager = new ManagerQuery();

            manager.DeletePurchas(dealID);
            return(RedirectToAction("MyBusket"));
        }
Exemplo n.º 20
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(ManagerQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult managers = ManagerHelper.GetManagers(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(managers.Data);
                dataGridViewModel.total = managers.TotalRecords;
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                }
            }
            return(dataGridViewModel);
        }
Exemplo n.º 21
0
        public DbQueryResult GetManagerList(ManagerQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        table         = "(SELECT A.StoreId,a.RoleId, A.ManagerId,A.UserName,COUNT(B.UserId) AS MemberCount,ISNULL((SELECT SUM(Expenditure) FROM aspnet_Members AS ce WHERE ce.StoreId = A.StoreId and A.ManagerId = ce.ShoppingGuiderId),0) AS ConsumeTotals FROM aspnet_Managers AS A LEFT JOIN aspnet_Members AS B ON A.ManagerId = B.ShoppingGuiderId GROUP BY A.ManagerId,A.StoreId,a.RoleId, A.UserName) AS Managers_List";

            stringBuilder.Append(" 1=1 AND (RoleId=-3 OR RoleId=-1) ");
            if (!string.IsNullOrWhiteSpace(query.UserName))
            {
                stringBuilder.AppendFormat(" AND UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.UserName));
            }
            if (query.StoreId.HasValue && query.StoreId > 0)
            {
                stringBuilder.AppendFormat(" AND StoreId = {0}", query.StoreId.Value);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, table, "Managers_List.ManagerId", stringBuilder.ToString(), "*"));
        }
Exemplo n.º 22
0
        public async Task <IActionResult> GetManagers([FromQuery] ManagerQuery managerQuery)
        {
            var managers = await _managerService.GetAsync(managerQuery);

            if (managerQuery.SquadId.HasValue)
            {
                var returnManagers = _mapper.Map <PaginatedList <ManagerListDto> >(managers,
                                                                                   opt => { opt.Items["squadId"] = managerQuery.SquadId; });

                return(Ok(returnManagers));
            }
            else
            {
                var returnManagers = _mapper.Map <PaginatedList <ManagerListDto> >(managers);
                return(Ok(returnManagers));
            }
        }
Exemplo n.º 23
0
        public QueryPageModel <ManagerInfo> GetManagersList(ManagerQuery query)
        {
            int total = 0;
            IQueryable <ManagerInfo> users = Context.ManagerInfo.AsQueryable().Where(c => c.ShopId != 0);

            if (!string.IsNullOrWhiteSpace(query.keyWords))
            {
                users = users.Where(d => d.UserName.Equals(query.keyWords));
            }
            users = users.GetPage(out total, query.PageNo, query.PageSize, d => d.OrderBy(o => o.Id));
            QueryPageModel <ManagerInfo> pageModel = new QueryPageModel <ManagerInfo>()
            {
                Models = users.ToList(), Total = total
            };

            return(pageModel);
        }
Exemplo n.º 24
0
        public PageModel <ManagerInfo> GetSellerManagers(ManagerQuery query)
        {
            int num = 0;
            IQueryable <ManagerInfo> managerInfos = from item in base.context.ManagerInfo
                                                    where item.ShopId == query.ShopID
                                                    select item;

            if (query.roleID != 0)
            {
                managerInfos = context.ManagerInfo.FindBy((ManagerInfo item) => item.ShopId == query.ShopID && item.RoleId == query.roleID && item.Id == query.userID);
            }

            Func <IQueryable <ManagerInfo>, IOrderedQueryable <ManagerInfo> > func = null;

            func = (IQueryable <ManagerInfo> d) =>
                   from o in d
                   orderby o.CreateDate descending
                   select o;

            num          = managerInfos.Count();
            managerInfos = managerInfos.GetPage(out num, query.PageNo, query.PageSize);
            foreach (ManagerInfo list in managerInfos.ToList())
            {
                ManagerInfo managerInfo = context.ManagerInfo.FirstOrDefault((ManagerInfo m) => m.Id.Equals(list.Id));
                if (managerInfo != null)
                {
                    UserMemberInfo userInfo = context.UserMemberInfo.First((UserMemberInfo m) => m.UserName.Equals(managerInfo.UserName));
                    list.Email = (userInfo == null ? "" : userInfo.Email);
                    if (managerInfo.RoleId == 0)
                    {
                        managerInfo.RoleName = "管理员";
                    }
                    else
                    {
                        RoleInfo role = context.RoleInfo.FirstOrDefault((RoleInfo m) => m.ShopId == managerInfo.ShopId && m.Id == managerInfo.RoleId);
                        managerInfo.RoleName = role.RoleName;
                    }
                }
            }
            return(new PageModel <ManagerInfo>()
            {
                Models = managerInfos,
                Total = num
            });
        }
        public async Task GetManagers_WhenCalled_ReturnManagersFromDb()
        {
            var managerQuery = new ManagerQuery
            {
                PageNumber      = 1,
                PageSize        = 10,
                SortBy          = "name",
                IsSortAscending = true
            };

            var expectedManagers = new PaginatedList <Manager>
            {
                Pagination = new Pagination
                {
                    PageNumber = 1,
                    PageSize   = 10
                },
                Items = new List <Manager>()
                {
                    new Manager {
                        Id = 1
                    },
                    new Manager {
                        Id = 2
                    },
                    new Manager {
                        Id = 3
                    },
                }
            };

            _managerService.Setup(m => m.GetAsync(managerQuery)).ReturnsAsync(expectedManagers);

            var result = await _managersController.GetManagers(managerQuery);

            var okObjectResult      = result as OkObjectResult;
            var okObjectResultValue = okObjectResult.Value as PaginatedList <ManagerListDto>;

            Assert.That(result, Is.TypeOf <OkObjectResult>());

            Assert.That(okObjectResultValue, Is.Not.Null);
            Assert.That(okObjectResultValue.Pagination.PageNumber, Is.EqualTo(1));
            Assert.That(okObjectResultValue.Pagination.PageSize, Is.EqualTo(10));
            Assert.That(okObjectResultValue.Items.Count(), Is.EqualTo(3));
        }
Exemplo n.º 26
0
        public static QueryPageModel <ManagerInfo> GetMemberList(ManagerQuery query)
        {
            var list    = _iManagerService.GetManagersList(query);
            var members = Mapper.Map <QueryPageModel <ManagerInfo> >(list);
            var grades  = MemberGradeApplication.GetMemberGradeList();

            foreach (var m in members.Models)
            {
                var memberIntegral = MemberIntegralApplication.GetMemberIntegral(m.Id);
                m.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, memberIntegral.HistoryIntegrals).GradeName;
                if (memberIntegral != null)
                {
                    m.AvailableIntegral = memberIntegral.AvailableIntegrals;
                    m.HistoryIntegral   = memberIntegral.HistoryIntegrals;
                }
            }
            return(members);
        }
Exemplo n.º 27
0
        public override DbQueryResult GetManagers(ManagerQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(" 0=0 ", DataHelper.CleanSearchString(query.Username));
            if (!string.IsNullOrEmpty(query.Username))
            {
                stringBuilder.AppendFormat(" and UserName LIKE '%{0}%' ", DataHelper.CleanSearchString(query.Username));
            }
            if (query.RoleId != Guid.Empty)
            {
                stringBuilder.AppendFormat(" AND UserId IN (SELECT UserId FROM aspnet_UsersInRoles WHERE RoleId = '{0}')", query.RoleId);
            }
            else
            {
                stringBuilder.AppendFormat(" AND ( supplier_regionid is null and supplier_gradeid is null ) ", new object[0]);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_aspnet_Managers", "UserId", stringBuilder.ToString(), "*"));
        }
Exemplo n.º 28
0
        private MemberDetailsModel <Dictionary <string, object> > GetDataList(ManagerQuery query)
        {
            MemberDetailsModel <Dictionary <string, object> > memberDetailsModel = new MemberDetailsModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult managersExpand = ManagerHelper.GetManagersExpand(query);
                memberDetailsModel.rows  = new List <Dictionary <string, object> >();
                memberDetailsModel.rows  = DataHelper.DataTableToDictionary(managersExpand.Data);
                memberDetailsModel.total = managersExpand.TotalRecords;
                if (memberDetailsModel.rows.Count > 0)
                {
                    memberDetailsModel.rows = (from a in memberDetailsModel.rows
                                               orderby Math.Abs(a["RoleId"].ToInt(0) + 1)
                                               select a).ToList();
                }
            }
            return(memberDetailsModel);
        }
Exemplo n.º 29
0
 private void ExportToExcel(HttpContext context)
 {
     try
     {
         ManagerQuery query = this.GetQuery(context);
         query.PageIndex = 1;
         query.PageSize  = 2147483647;
         DbQueryResult managersExpand = ManagerHelper.GetManagersExpand(query);
         StringBuilder stringBuilder  = new StringBuilder();
         stringBuilder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");
         stringBuilder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">");
         stringBuilder.AppendLine("<td>店员</td>");
         stringBuilder.AppendLine("<td>累计发展会员数</td>");
         stringBuilder.AppendLine("<td>累计会员消费</td>");
         stringBuilder.AppendLine("</tr>");
         DataTable data = managersExpand.Data;
         foreach (DataRow row in data.Rows)
         {
             stringBuilder.AppendLine("<tr>");
             stringBuilder.AppendLine("<td>" + row.Field <string>("UserName") + ((row.Field <int>("RoleId") == -1) ? "(门店管理员)" : "(导购)") + "</td>");
             stringBuilder.AppendLine("<td>" + row.Field <int>("MemberCount") + "</td>");
             stringBuilder.AppendLine("<td>" + row.Field <decimal>("ConsumeTotals").F2ToString("f2") + "</td>");
             stringBuilder.AppendLine("</tr>");
         }
         stringBuilder.AppendLine("<tr>");
         stringBuilder.AppendLine("<td></td>");
         stringBuilder.AppendLine("</tr>");
         stringBuilder.AppendLine("</table>");
         context.Response.Clear();
         context.Response.Buffer  = false;
         context.Response.Charset = "GB2312";
         context.Response.AppendHeader("Content-Disposition", "attachment;filename=StoresExpand_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
         context.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
         context.Response.ContentType     = "application/ms-excel";
         context.Response.Write(stringBuilder.ToString());
         context.Response.End();
     }
     catch (Exception)
     {
         throw new HidistroAshxException("导出数据错误");
     }
 }
Exemplo n.º 30
0
        /// <summary>
        /// 获取商家信息列表
        /// </summary>
        public static QueryPageModel <ManagerInfo> GetMemberList(ManagerQuery query)
        {
            var list    = _iManagerService.GetManagersList(query);
            var members = Mapper.Map <QueryPageModel <ManagerInfo> >(list);
            var grades  = MemberGradeApplication.GetMemberGradeList();

            foreach (var m in members.Models)
            {
                //获取用户积分
                var member         = _iMemberService.GetMemberByName(m.UserName);
                var memberIntegral = MemberIntegralApplication.GetMemberIntegral(member.Id);
                m.GradeName = MemberGradeApplication.GetMemberGradeByIntegralandType(grades, memberIntegral.HistoryIntegrals, Convert.ToInt32(m.MemberGradeId), m.BondMoney).GradeName;
                if (memberIntegral != null)
                {
                    m.AvailableIntegral = memberIntegral.AvailableIntegrals;
                    m.HistoryIntegral   = memberIntegral.HistoryIntegrals;
                }
            }
            return(members);
        }