예제 #1
0
        public List<BAgentRoute> FindTaocans(int agencyId, string sp, string province, BitScope scope, bool? enable = null)
        {
            if (agencyId <= 0)
            {
                if (CurrentLoginUser != null)
                {
                    agencyId = CurrentLoginUser.User.Id;
                }
            }
            AgentAdminMenagement agentAdminMgt = new AgentAdminMenagement(this.CurrentLoginUser);

            int total = 0;
            List<BAgentRoute> routes = agentAdminMgt.FindRoutes(0, agencyId, 0, 0, out total, enable);
            //根据资源对号码归属省的限制
            routes = (from r in routes where r.Taocan.NumberProvince == null || (r.Taocan.NumberProvince.Name.Contains(province)) select r).ToList<BAgentRoute>();

            List<BAgentRoute> globalRoutes = (from r in routes where r.Taocan.SP == null select r).ToList<BAgentRoute>();
            List<BAgentRoute> spRoutes = new List<BAgentRoute>();
            List<BAgentRoute> returnRoutes = new List<BAgentRoute>();
            if (!string.IsNullOrEmpty(sp))
            {
                spRoutes = (from r in routes where r.Taocan.SP != null && r.Taocan.SP.Name == sp select r).ToList<BAgentRoute>();
            }
            globalRoutes = globalRoutes.Concat<BAgentRoute>(spRoutes).ToList<BAgentRoute>();
            returnRoutes = globalRoutes;
            if (scope == BitScope.Local)
            {
                //本地流量
                returnRoutes = (from r in globalRoutes
                                where
                                 (
                                 r.Taocan.Province != null && r.Taocan.Province.Name.Contains(province))
                                 //||
                                 //(r.Taocan.NumberProvince != null && r.Taocan.NumberProvince.Name.Contains(province)))
                                select r).ToList<BAgentRoute>();
            }
            else if (scope == BitScope.Global)
            {
                returnRoutes = (from r in globalRoutes
                                where
                                 (r.Taocan.Province == null)
                                select r).ToList<BAgentRoute>();
            }

            return returnRoutes;
        }
예제 #2
0
        public ApiMessage GetAgencyResourceTaocans()
        {
            this.IniRequest();
            ApiMessage message = new ApiMessage();
            AgentAdminMenagement agentMgtMgr = new AgentAdminMenagement(User.Identity.Name);
            int agencyId = 0;
            int resourceId = 0;
            int.TryParse(request["agencyId"], out agencyId);
            int.TryParse(request["resourceId"], out resourceId);
            if(agencyId==0 && resourceId==0)
            {
                message.Status = "ERROR";
                message.Item = null;
                message.Message = "代理商编号和资源编号都不能为空";
                return message;
            }
            List<BResourceTaocan> taocans = new List<BResourceTaocan>();
            if(resourceId>0 && agencyId>0)
            {
                taocans = agentMgtMgr.FindAgencyResourceTaocans(agencyId, resourceId);
            }else if(resourceId>0 && agencyId<=0)
            {
                ResourceManagement resourceMgr = new ResourceManagement(agentMgtMgr.CurrentLoginUser);
                taocans = resourceMgr.FindResourceTaocans(resourceId, 0, false);
            }

            message.Status = "OK";
            message.Item = taocans;
            return message;
        }
예제 #3
0
        public ApiMessage GetAgencyResources()
        {
            this.IniRequest();
            ApiMessage message = new ApiMessage();
            AgentAdminMenagement agentMgtMgr = new AgentAdminMenagement(User.Identity.Name);
            int agencyId = 0;
            int.TryParse(request["agencyId"],out agencyId);
            if(agencyId>0)
            {
                List<BResource> rs = agentMgtMgr.FindAgentResources(agencyId);
                message.Status = "OK";
                message.Item = rs;
            }else
            {
                ResourceManagement resourceMgr = new ResourceManagement(agentMgtMgr.CurrentLoginUser);
                int total = 0;
                List<BResource> rs = resourceMgr.FindResources(0, null, 0, out total);
                message.Status = "OK";
                message.Item = rs;
            }

            return message;
        }
예제 #4
0
        public async Task<ActionResult> UpdateAgency(CreateAgencyModel model)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            bool result = false;
            try
            {
                if (ModelState.IsValid)
                {
                    KMBit.DAL.Users dbUser = new DAL.Users();
                    dbUser.Address = model.Address;
                    dbUser.City_id = model.City ;
                    dbUser.Province_id = model.Province ;
                    dbUser.Description = model.Description;
                    dbUser.Enabled = model.Enabled;
                    dbUser.Pay_type = model.PayType;
                    dbUser.Type = model.Type;
                    dbUser.PhoneNumber = model.Phone;

                    if (model.Id > 0)
                    {
                        dbUser.Id = model.Id;
                        dbUser.Update_time = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                        result = agentAdminMgt.UpdateAgency(dbUser);
                    }
                    else
                    {
                        dbUser.Email = model.Email;
                        dbUser.PasswordHash = "111111";
                        dbUser.Name = model.Name;
                        dbUser.CreatedBy = User.Identity.GetUserId<int>();
                        dbUser.Regtime = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                        result = await agentAdminMgt.CreateAgency(dbUser);
                    }

                    if(result)
                    {
                        return RedirectToAction("Agencies");
                    }else
                    {
                        ViewBag.Exception = new KMBitException("创建失败");
                    }
                }
            }
            catch (KMBitException ex)
            {
                ViewBag.Exception = ex;
            }

            List<KMBit.DAL.User_type> userTypes = agentAdminMgt.GetUserTypes();
            List<KMBit.DAL.Area> provinces = agentAdminMgt.GetAreas(0);
            List<KMBit.DAL.PayType> payTypes = agentAdminMgt.GetPayTypes();

            ViewBag.UserTypes = new SelectList(userTypes, "Id", "Name");
            ViewBag.PayTypes = new SelectList(payTypes, "Id", "Name");
            ViewBag.Provinces = new SelectList(provinces, "Id", "Name");
            if (model.Province >0)
            {
                ViewBag.Cities = new SelectList(agentAdminMgt.GetAreas((int)model.Province), "Id", "Name");
            }
            else
            {
                ViewBag.Cities = new SelectList(new List<KMBit.DAL.Area>(), "Id", "Name");
            }

            return View("CreateAgency",model);
        }
예제 #5
0
        public ActionResult ChargeAccount(AdminChargeAccountModel model)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            if (!agentAdminMgt.CurrentLoginUser.Permission.UPDATE_USER)
            {
                ViewBag.Message = "您没有充值代理商账户的权限";
                return View("Error");
            }
            //if(!ModelState.IsValid)
            //{
            //    ViewBag.Message = "输入信息错误";
            //    return View("Error");
            //}
            if(ModelState.IsValid)
            {
                try
                {
                    bool result = agentAdminMgt.ChargeAgencyAccount(model.UserId, model.Amount);
                    if (!result)
                    {
                        ViewBag.Message = "您没有充值代理商账户的权限";
                        return View("Error");
                    }
                    return Redirect("/Admin/Agencies");
                }
                catch (KMBitException ex)
                {
                    ViewBag.Message = ex.Message;
                    return View("Error");
                }
            }

            return View(model);
        }
예제 #6
0
        public ActionResult ChargeAccount(int agencyId)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            if (!agentAdminMgt.CurrentLoginUser.Permission.UPDATE_USER)
            {
                ViewBag.Message = "您没有充值代理商账户的权限";
                return View("Error");
            }
            if (agencyId<=0)
            {
                ViewBag.Message = "参数错误";
                return View("Error");
            }

            BUser user = agentAdminMgt.GetUserInfo(agencyId);
            if(user==null)
            {
                ViewBag.Message = "代理商不存在";
                return View("Error");
            }
            AdminChargeAccountModel model = new AdminChargeAccountModel()
            {
                UserId = agencyId,
                Name=user.User.Name,
                Amount = 0,
                Remaining = user.User.Remaining_amount
            };
            return View(model);
        }
예제 #7
0
        public ActionResult CreateAgentRoute(CreateAgentRouteModel model)
        {            
            int agencyId = model.AgencyId;
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());

            resourceMgt = new ResourceManagement(User.Identity.GetUserId<int>());
            List<BUser> users = agentAdminMgt.FindAgencies((int)agencyId, null, null, 0, 0, out total);
            if (users == null || users.Count == 0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的代理商存在");
                return View("Error");
            }

            BUser agency = users[0];
            ViewBag.Agency = agency;
            if(ModelState.IsValid)
            {
                KMBit.DAL.Agent_route ruote;
                if(model.ResouceTaocans.Length>0)
                {
                    foreach(int tId in model.ResouceTaocans)
                    {
                        ruote = new DAL.Agent_route()
                        {
                            CreatedBy = User.Identity.GetUserId<int>(),
                            Create_time = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now),
                            Discount = model.Discount,
                            Enabled = model.Enabled,
                            Resource_Id = model.ResourceId,
                            Resource_taocan_id = tId,
                            User_id = model.AgencyId
                        };

                        bool ret = agentAdminMgt.CreateRoute(ruote);
                    }
                }

                return Redirect("/Admin/AgentRoutes?agencyId=" + model.AgencyId);
            }
            List<BResource> resources = resourceMgt.FindResources(0, null, 0, out total);
            ViewBag.Resources = new SelectList((from r in resources select r.Resource).ToList<KMBit.DAL.Resource>(), "Id", "Name");
            List<BResourceTaocan> taocans = new List<BResourceTaocan>();
            if(model.ResourceId>0)
            {
                taocans = resourceMgt.FindEnabledResourceTaocansForAgent(model.ResourceId,model.AgencyId);
            }
            
            ViewBag.ResourceTaocans1 = taocans;
            return View(model);
        }
예제 #8
0
        public ActionResult ChargeOrders(OrderSearchModel searchModel)
        {
            OrderManagement orderMgt = new OrderManagement(User.Identity.GetUserId<int>());
            agentAdminMgt = new AgentAdminMenagement(orderMgt.CurrentLoginUser);
            resourceMgt = new ResourceManagement(orderMgt.CurrentLoginUser);
            if (!orderMgt.CurrentLoginUser.Permission.CHARGE_HISTORY)
            {
                ViewBag.Message = "没有权限查看流量充值记录";
                return View("Error");
            }
            int pageSize = 40;
            DateTime sDate = DateTime.MinValue;
            DateTime eDate = DateTime.MinValue;
            if(!string.IsNullOrEmpty(searchModel.StartTime))
            {
                DateTime.TryParse(searchModel.StartTime, out sDate);
            }
            if (!string.IsNullOrEmpty(searchModel.EndTime))
            {
                DateTime.TryParse(searchModel.EndTime, out eDate);
            }
            long sintDate = sDate!=DateTime.MinValue?DateTimeUtil.ConvertDateTimeToInt(sDate):0;
            long eintDate= eDate != DateTime.MinValue ? DateTimeUtil.ConvertDateTimeToInt(eDate) : 0;
            int page = 1;
            if(Request["page"]!=null)
            {
                int.TryParse(Request["page"],out page);
            }
            searchModel.Page = page;
            List<BOrder> orders = orderMgt.FindOrders(searchModel.OrderId!=null?(int)searchModel.OrderId:0, 
                                                      searchModel.AgencyId!=null?(int)searchModel.AgencyId:0, 
                                                      searchModel.ResourceId!=null?(int)searchModel.ResourceId:0, 
                                                      searchModel.ResourceTaocanId!=null?(int)searchModel.ResourceTaocanId:0, 
                                                      searchModel.RuoteId!=null?(int)searchModel.RuoteId:0, 
                                                      searchModel.SPName, searchModel.MobileNumber,
                                                      searchModel.Status,
                                                      sintDate,
                                                      eintDate,
                                                      out total,
                                                      pageSize,
                                                      searchModel.Page, true);
            PageItemsResult<BOrder> result = new PageItemsResult<BOrder>() { CurrentPage = searchModel.Page, Items = orders, PageSize = pageSize, TotalRecords = total,EnablePaging=true };
            KMBit.Grids.KMGrid<BOrder> grid = new Grids.KMGrid<BOrder>(result);
            BigOrderSearchModel model = new BigOrderSearchModel() { SearchModel = searchModel, OrderGrid = grid };

            List<KMBit.Beans.BUser> agencies = agentAdminMgt.FindAgencies(0, null, null, 0, 0, out total, 0, 0, false,null);
            List<BResource> resources = new List<BResource>();
            if(searchModel.AgencyId!=null)
            {
                resources = agentAdminMgt.FindAgentResources((int)searchModel.AgencyId);
            }else
            {
                resources = resourceMgt.FindResources(0,null,0,out total);
            }
            ViewBag.Agencies = new SelectList((from a in agencies select a.User).ToList<Users>(),"Id","Name");
            ViewBag.Resources = new SelectList((from r in resources select r.Resource).ToList<Resource>(), "Id", "Name");

            List<BResourceTaocan> taocans = new List<BResourceTaocan>();
            if(searchModel.ResourceId!=null)
            {
                if(searchModel.AgencyId==null)
                {
                    taocans = resourceMgt.FindResourceTaocans((int)searchModel.ResourceId, 0, false);
                }
                else
                {
                    taocans = agentAdminMgt.FindAgencyResourceTaocans((int)searchModel.AgencyId, (int)searchModel.ResourceId);
                }                
            }
            ViewBag.Taocans = new SelectList((from t in taocans select new { Id=t.Taocan.Id,Name=t.Taocan2.Name}), "Id", "Name");
            ViewBag.StatusList = new SelectList((from s in StaticDictionary.GetChargeStatusList() select new { Id=s.Id,Name=s.Value}),"Id","Name");
            return View(model);
        }
예제 #9
0
        public ActionResult EditAgentRoute(CreateAgentRouteModel model)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            if (ModelState.IsValid)
            {
                if (agentAdminMgt.UpdateAgentRuote(model.Id, model.Discount, model.Enabled))
                {
                    return Redirect("/Admin/AgentRoutes?agencyId=" + model.AgencyId);
                }
                
            }else
            {
                string validationErrors = string.Join(",",
                    ModelState.Values.Where(E => E.Errors.Count > 0)
                    .SelectMany(E => E.Errors)
                    .Select(E => E.ErrorMessage)
                    .ToArray());

                ViewBag.ErrMsg = validationErrors;
            }

            List<BAgentRoute> routes = agentAdminMgt.FindRoutes(model.Id, 0, 0, 0, out total);
            if (routes == null || routes.Count == 0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的路由不存在", model.Id);
                return View("Error");
            }
            BAgentRoute route = routes[0];
            List<BUser> users = agentAdminMgt.FindAgencies(route.Route.User_id, null, null, 0, 0, out total);
            if (users == null || users.Count == 0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的代理商存在");
                return View("Error");
            }
            ViewBag.Agency = users[0];
            ViewBag.Ruote = route;
            return View("EditAgentRoute",model);
        }
예제 #10
0
        public ActionResult EditAgentRoute(int routeId)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());

            List<BAgentRoute> routes = agentAdminMgt.FindRoutes(routeId, 0, 0, 0, out total);
            if(routes==null || routes.Count==0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的路由不存在",routeId);
                return View("Error");
            }
            BAgentRoute route = routes[0];
            List<BUser> users = agentAdminMgt.FindAgencies(route.Route.User_id, null, null, 0, 0, out total);
            if (users == null || users.Count == 0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的代理商存在");
                return View("Error");
            }

            BUser agency = users[0];
            CreateAgentRouteModel model = new CreateAgentRouteModel()
            {
                Id = route.Route.Id,
                AgencyId = route.Route.User_id,
                Discount = route.Route.Discount,
                Enabled = route.Route.Enabled,
                ResouceTaocans = new int[] { route.Route.Resource_taocan_id },
                ResourceId = route.Route.Resource_Id
            };

            ViewBag.Agency = agency;
            ViewBag.Ruote = route;
            return View("EditAgentRoute", model);
        }
예제 #11
0
 public ActionResult AgentRoutes(int agencyId)
 {
     if(agencyId<=0)
     {
         ViewBag.Message = "参数非法";
         return View("Error");
     }
     int page = 1;
     int.TryParse(Request["page"], out page);
     page = page > 0 ? page : 1;
     int pageSize = 30;
     if (agentAdminMgt == null)
         agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
     List<BUser> users = agentAdminMgt.FindAgencies((int)agencyId, null, null, 0, 0, out total);
     if (users == null || users.Count == 0)
     {
         ViewBag.Message = string.Format("编号为 {0} 的代理商存在");
         return View("Error");
     }
     BUser agency = users[0];
     List<BAgentRoute> routes = agentAdminMgt.FindRoutes(0,(int)agencyId, 0, 0, out total,null, page, pageSize, true);
     PageItemsResult<BAgentRoute> result = new PageItemsResult<BAgentRoute>() { CurrentPage=page, Items=routes, PageSize=30, TotalRecords=total,EnablePaging=true };
     KMBit.Grids.KMGrid<BAgentRoute> grid = new KMBit.Grids.KMGrid<BAgentRoute>(result);
     ViewBag.Agency = agency;
     return View(grid);
 }
예제 #12
0
        public ActionResult EditAgency(int agencyId)
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            List<BUser> users = agentAdminMgt.FindAgencies(agencyId, null, null, 0, 0,out total);
            if(users==null || users.Count==0)
            {
                ViewBag.Message =string.Format("编号为 {0} 的代理商存在");
                return View("Error");
            }

            BUser agency = users[0];
            CreateAgencyModel model = new CreateAgencyModel() { Enabled = agency.User.Enabled, Address=agency.User.Address, City=agency.User.City_id, Description=agency.User.Description,
                                                                Phone=agency.User.PhoneNumber,Email=agency.User.Email, Id=agencyId, Name=agency.User.Name, PayType=agency.User.Pay_type, Type=agency.User.Type,Province=agency.User.Province_id};           
            List<KMBit.DAL.User_type> userTypes = agentAdminMgt.GetUserTypes();
            List<KMBit.DAL.Area> provinces = agentAdminMgt.GetAreas(0);
            List<KMBit.DAL.PayType> payTypes = agentAdminMgt.GetPayTypes();

            ViewBag.UserTypes = new SelectList(userTypes, "Id", "Name");
            ViewBag.PayTypes = new SelectList(payTypes, "Id", "Name");
            ViewBag.Provinces = new SelectList(provinces, "Id", "Name");
            if(model.Province>0)
            {
                ViewBag.Cities = new SelectList(agentAdminMgt.GetAreas((int)model.Province), "Id", "Name");
            }
            else {
                ViewBag.Cities = new SelectList(new List<KMBit.DAL.Area>(), "Id", "Name");
            }
            
            ViewBag.Agency = agency;
            return View("CreateAgency",model);
        }
예제 #13
0
        public ActionResult CreateAgency()
        {
            CreateAgencyModel model = new CreateAgencyModel() {Enabled=true,Id=0};
            agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());
            List<KMBit.DAL.User_type> userTypes = agentAdminMgt.GetUserTypes();
            List<KMBit.DAL.Area> provinces = agentAdminMgt.GetAreas(0);
            List<KMBit.DAL.PayType> payTypes = agentAdminMgt.GetPayTypes();

            ViewBag.UserTypes = new SelectList(userTypes, "Id", "Name");
            ViewBag.PayTypes = new SelectList(payTypes, "Id", "Name");
            ViewBag.Provinces = new SelectList(provinces, "Id", "Name");
            ViewBag.Cities = new SelectList(new List<KMBit.DAL.Area>(), "Id", "Name");
            return View("CreateAgency",model);
        }
예제 #14
0
        public ActionResult Agencies()
        {
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());

            int pageSize = 30;
            int requestPage = 1;
            int.TryParse(Request["page"], out requestPage);
            requestPage = requestPage == 0 ? 1 : requestPage;
            List<BUser> users = agentAdminMgt.FindAgencies(0, null, null, 0, 0, out total,requestPage,pageSize);
            PageItemsResult<BUser> result = new PageItemsResult<BUser>() { CurrentPage = requestPage, Items = users, PageSize = pageSize, TotalRecords = total };
            KMBit.Grids.KMGrid<BUser> grid = new Grids.KMGrid<BUser>(result);
            ViewBag.LoginUser = agentAdminMgt.CurrentLoginUser;
            return View(grid);
        }
예제 #15
0
        public ActionResult CreateAgentRoute(int agencyId)
        {            
            if (agentAdminMgt == null)
                agentAdminMgt = new AgentAdminMenagement(User.Identity.GetUserId<int>());

            resourceMgt = new ResourceManagement(User.Identity.GetUserId<int>());
            List<BUser> users = agentAdminMgt.FindAgencies((int)agencyId, null, null, 0, 0, out total);
            if (users == null || users.Count == 0)
            {
                ViewBag.Message = string.Format("编号为 {0} 的代理商存在");
                return View("Error");
            }

            BUser agency = users[0];
            ViewBag.Agency = agency;
            CreateAgentRouteModel model = new CreateAgentRouteModel() { Enabled = true, AgencyId = agency.User.Id,Id=0 };
            List<BResource> resources = resourceMgt.FindResources(0, null, 0, out total);
            ViewBag.Resources = new SelectList((from r in resources select r.Resource).ToList<KMBit.DAL.Resource>(), "Id", "Name");
            List<BResourceTaocan> taocans = new List<BResourceTaocan>();
            //taocans = resourceMgt.FindResourceTaocans(0, 1, 0, out total);
            //ViewBag.ResourceTaocans = new SelectList((from t in taocans select new { Id = t.Taocan.Id, Name = t.City.Name + " " + t.SP.Name + " " + t.Taocan.Quantity }).ToList(), "Id", "Name");
            ViewBag.ResourceTaocans1 = taocans;
            return View("CreateAgentRoute",model);
        }
예제 #16
0
 public List<BAgentRoute> FindTaocans(int routeId,bool? enable=null)
 {
     List<BAgentRoute> taocans = new List<BAgentRoute>();
     AgentAdminMenagement agentAdminMgt = new AgentAdminMenagement(this.CurrentLoginUser);
     int total = 0;
     taocans = agentAdminMgt.FindRoutes(routeId, CurrentLoginUser.User.Id, 0, 0, out total, enable);
     return taocans;
 }
예제 #17
0
 public ActionResult AccountChargeHistory(PaymentHistoryModel searchModel)
 {
     PaymentManagement paymentMgt = new PaymentManagement(User.Identity.GetUserId<int>());
     agentAdminMgt = new AgentAdminMenagement(paymentMgt.CurrentLoginUser);
     int pageSize = 30;
     int page = 1;
     if (Request["page"] != null)
     {
         int.TryParse(Request["page"], out page);
     }
     searchModel.Page = page;
     List<BPaymentHistory> records = paymentMgt.FindAgentPayments(0, searchModel.AgentId!=null?(int)searchModel.AgentId:0, 0, searchModel.PayType, searchModel.TranfserType!=null?(int)searchModel.TranfserType:0, searchModel.OprUser, searchModel.Status, out total, true,pageSize,page);
     PageItemsResult<BPaymentHistory> result = new PageItemsResult<BPaymentHistory>() { CurrentPage = page, Items = records, PageSize = pageSize, TotalRecords = total, EnablePaging = true };
     KMBit.Grids.KMGrid<BPaymentHistory> grid = new Grids.KMGrid<BPaymentHistory>(result);
     BigPaymentSearchModel bidModel = new BigPaymentSearchModel() { SearchModel = searchModel, Grid = grid };
     List<KMBit.Beans.BUser> agencies = agentAdminMgt.FindAgencies(0, null, null, 0, 0, out total, 0, 0, false, null);
     ViewBag.Agencies = new SelectList((from a in agencies select a.User).ToList<Users>(), "Id", "Name");
     ViewBag.PayTypes = new SelectList((from s in StaticDictionary.GetPaymentTypeList2() select new { Id = s.Id, Name = s.Value }), "Id", "Name");
     ViewBag.StatusList = new SelectList((from s in StaticDictionary.GetPaymentStatusList() select new { Id = s.Id, Name = s.Value }), "Id", "Name");
     ViewBag.TranfserTypes = new SelectList((from s in StaticDictionary.GetTranfserTypeList() select new { Id = s.Id, Name = s.Value }), "Id", "Name");
     return View(bidModel);
 }