Пример #1
0
        public ActionResult NumberOfActiveUsers(Dictionary <string, string> queryvalues)
        {
            int     _Channels       = queryvalues.ContainsKey("Channels") ? Convert.ToInt32(queryvalues["Channels"]) : 0;
            string  _StartDate      = queryvalues.ContainsKey("StartDate") ? queryvalues["StartDate"] : DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
            string  _ExpirationDate = queryvalues.ContainsKey("ExpirationDate") ? queryvalues["ExpirationDate"] : DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
            groupby _Groupby        = (groupby)(queryvalues.ContainsKey("groupby") ? Convert.ToInt32(queryvalues["groupby"]) : 1);


            int MasterID = User.Identity.GetUserId <int>();

            if (AgentUserBLL.CheckUser(_Channels, MasterID))
            {
                _Channels = MasterID;
            }
            string       _UserList   = AgentUserBLL.GetUserListString(_Channels);
            string       _MasterList = AgentUserBLL.GetUserListString(MasterID);
            BaseDataView vbd         = new BaseDataView {
                UserList = _UserList, StartDate = _StartDate, ExpirationDate = _ExpirationDate, Groupby = _Groupby, Channels = _Channels
            };

            ViewData["groupby"] = vbd.Groupby.ToSelectListItemForSelect();
            var cha = AgentUserBLL.GetUserList(_MasterList).Select(x => new SelectListItem {
                Text = x.AgentName, Value = x.Id.ToString(), Selected = x.Id == _Channels
            });

            if (cha.Count() <= 1)
            {
                ViewData["cCount"] = 1;
            }
            else
            {
                ViewData["cCount"] = 2;
            }
            ViewData["Channels"] = cha;

            vbd.BaseDataList = new List <BaseDataInfo>(BaseDataBLL.GetActiveUsers(vbd));


            return(View(vbd));
        }
Пример #2
0
        public ActionResult Test(Dictionary <string, string> queryvalues)
        {
            int _Channels = queryvalues.ContainsKey("Channels") ? Convert.ToInt32(queryvalues["Channels"]) : 0;

            string  _StartDate      = queryvalues.ContainsKey("StartDate") ? queryvalues["StartDate"] : DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
            string  _ExpirationDate = queryvalues.ContainsKey("ExpirationDate") ? queryvalues["ExpirationDate"] : DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
            groupby _Groupby        = (groupby)(queryvalues.ContainsKey("groupby") ? Convert.ToInt32(queryvalues["groupby"]) : 1);

            string _UserList   = AgentUserBLL.GetUserListString(0); //new
            string _MasterList = AgentUserBLL.GetUserListString(0); //new

            if (_Channels != 0)
            {
                _UserList = _Channels.ToString();
            }

            BaseDataView vbd = new BaseDataView {
                UserList = _UserList, StartDate = _StartDate, ExpirationDate = _ExpirationDate, Groupby = _Groupby, Channels = _Channels
            };

            List <SelectListItem> ieList = AgentUserBLL.GetUserList(_MasterList).Select(
                x => new SelectListItem {
                Text = x.AgentName, Value = x.Id.ToString(), Selected = x.Id == _Channels
            }
                ).ToList();

            ieList.Insert(0, new SelectListItem {
                Text = "所有渠道", Value = "0", Selected = 0 == _Channels
            });
            ViewData["Channels"] = ieList;

            vbd.BaseDataList = new List <BaseDataInfo>(BaseDataBLL.GetActiveUsers(vbd));


            return(View(vbd));
        }