public IActionResult GetListPaging(string uuid)
        {
            long logId = 0;

            try
            {
                logId = BaseApiManager.SaveLogs(uuid);
                if (!IsUuid(uuid))
                {
                    return(Error(logId, "verify uuid fail!"));
                }

                var    entityInterfaceAccount = GetInterfaceAccountByUuid(uuid);
                string companyId = entityInterfaceAccount.CompanyID;
                int    pageIndex = Utility.ToPageIndex(Accessor.HttpContext.Request.GetQueryString("page").ToInt());
                int    pageCount = Utility.ToPageCount(Accessor.HttpContext.Request.GetQueryString("count").ToInt());

                string state = true.ToString();
                long   total = MessageBoardService.CountMessageBoard(SystemID, companyId, state);
                var    lists = MessageBoardService.GetMessageBoardPaging(SystemID, companyId, state, pageIndex, pageCount);
                if (lists == null)
                {
                    return(Error(logId, "not data!"));
                }
                var data = from m in lists
                           select new
                {
                    id           = m.MessageID,
                    company_name = m.CompanyName.IIF(""),
                    name         = m.Name.IIF(""),
                    phone        = m.Phone.IIF(""),
                    email        = m.Email.IIF(""),
                    address      = m.Address.IIF(""),
                    content      = m.Content.IIF(""),
                    reply        = m.Reply.IIF(""),
                    staff_id     = m.ReplyStaffId.IIF(""),
                    staff_name   = m.ReplyStaffName.IIF(""),
                    reply_time   = m.ReplyTime.ToDate().ToString().IIF(""),
                    ip           = m.IpAddress.IIF(""),
                    date         = m.CreateDate
                };
                return(Success(logId, "ok", new { page = pageIndex, total, rows = data }));
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        public IActionResult List()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.客服管理.留言管理.列表);
                if (!IsPermission(funcId))
                {
                    return(ToPermission(funcId));
                }
                string startTime = GetQueryString("datemin");
                string endTime   = GetQueryString("datemax");
                string state     = GetQueryString("state");
                string keyword   = GetQueryString("keyword");
                ViewBag.DateMin = startTime;
                ViewBag.DateMax = endTime;
                ViewBag.State   = state;
                ViewBag.Keyword = keyword;

                int pageId   = 1;
                int pageSize = 100;
                int rowCount = MessageBoardService.CountMessageBoard(SystemID, CompanyID);
                List <Ld_Service_MessageBoard> lists = new List <Ld_Service_MessageBoard>();
                string strKeyword = string.Format("{0}{1}", startTime, keyword);
                if (string.IsNullOrWhiteSpace(strKeyword))
                {
                    lists = MessageBoardService.GetMessageBoardPaging(SystemID, CompanyID, pageId, pageSize);
                }
                else
                {
                    lists = MessageBoardService.SearchMessageBoard(SystemID, CompanyID, startTime, endTime, state, keyword);
                }
                int totalNum = rowCount > 0 ? rowCount : lists == null ? 0 : lists.Count();
                ViewBag.Count = totalNum;
                return(View(lists));
            }
            catch (Exception ex)
            {
                return(ToError(ex.Message));
            }
        }
Example #3
0
        public IActionResult List()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.客服管理.留言管理.列表);
                if (!IsPermission(funcId))
                {
                    return(ToPermission(funcId));
                }

                string startTime = GetQueryString("datemin");
                string endTime   = GetQueryString("datemax");
                string state     = GetQueryString("state");
                string keyword   = GetQueryString("keyword");
                ViewData["DateMin"] = startTime;
                ViewData["DateMax"] = endTime;
                ViewData["State"]   = state;
                ViewData["Keyword"] = keyword;

                int total = 100;
                List <Service_MessageBoard> lists = new List <Service_MessageBoard>();
                string strKeyword = string.Format("{0}{1}{2}", startTime, state, keyword);
                if (string.IsNullOrWhiteSpace(strKeyword))
                {
                    lists = MessageBoardService.GetMessageBoardTop(SystemID, CompanyID, total);
                }
                else
                {
                    lists = MessageBoardService.SearchMessageBoard(SystemID, CompanyID, startTime, endTime, state, keyword, total);
                }
                ViewData["Count"] = MessageBoardService.CountMessageBoard(SystemID, CompanyID);
                return(View(lists));
            }
            catch (Exception ex)
            {
                return(ToError(ex.Message));
            }
        }