예제 #1
0
        public JsonResult GetExpenseDetail(int limit, int offset, string gameName, DateTime?startday, DateTime?endday)
        {
            //
            string guid = Request["cpyUserId"];
            //从分布式缓存拿出来的对象不能进行延迟加载。
            var currentCpy = Common.CacheHelper.Get(guid) as Company;
            var Rused      = RechargedUsedBll.LoadEntities(ru => true);
            var recharge   = RechargeBll.LoadEntities(r => r.Id > 0);
            var service    = OpenServiceBll.LoadEntities(s => s.Id > 0);
            var data       = from ru in Rused
                             join r in recharge on ru.RechargeId equals r.Id
                             join s in service on ru.OpenServiceId equals s.Id
                             where r.CompanyId == s.CompanyId && r.CompanyId == currentCpy.Id
                             //intime  消费日期    buytime购买日期, BuyTime = r.InTime
                             select new { InTime = ru.InTime, Id = s.Id, GameName = s.GameName, ServerName = s.ServerName, StartTime = s.StartTime, BuyTime = r.InTime, Rec_hot = s.Rec_Hot };

            if (!string.IsNullOrEmpty(gameName))
            {
                data = data.Where(d => d.GameName.Contains(gameName));
            }
            if (startday.HasValue || endday.HasValue)
            {
                endday = endday.Value.AddDays(1);
                data   = data.Where(d => d.InTime >= startday && d.InTime <= endday);
            }
            var rows = data.OrderByDescending(d => d.InTime)
                       .Skip(offset).Take(limit).ToList();

            return(Json(new { total = data.Count(), rows = rows }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult GetRecharge_Record(int limit, int offset, DateTime?startday, DateTime?endday)
        {
            string guid = Request["cpyUserId"];

            var currentCpy = Common.CacheHelper.Get(guid) as Company;
            var recharge   = RechargeBll.LoadEntities(r => r.CompanyId == currentCpy.Id).Select(r => new { r.Id, r.CompanyId, r.Money, r.Num, Total = (r.Num - r.Used), r.InTime, r.Remark, r.ComboName });

            if (startday.HasValue || endday.HasValue)
            {
                endday   = endday.Value.AddDays(1);
                recharge = recharge.Where(d => d.InTime > startday && d.InTime <= endday);
            }
            var total = recharge.Count();
            var rows  = recharge.OrderByDescending(d => d.InTime)
                        .Skip(offset).Take(limit).ToList();

            return(Json(new { total = total, rows = rows }, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult AddOpenService()
        {
            var    currenCpy = GetCurrentUser();
            string type      = Request["rec_hot"];

            OpenService service = new OpenService()
            {
                CompanyId    = currenCpy.Id,
                GameName     = Request["gamename"],
                ServerName   = Request["serverName"],
                Url          = Request["url"],
                PackageId    = int.Parse(Request["packageId"].ToString()),
                Rec_Hot      = Request["rec_hot"],
                InTime       = DateTime.Now,
                Rec_Datetime = DateTime.Now,
                State        = "2",
                CheckName    = null,
                StartTime    = DateTime.Parse(Request["starttime"])
            };
            Recharge recharge;

            if (type == "2")//全天开服
            {
                recharge = RechargeBll.LoadEntities(r => r.CompanyId == currenCpy.Id && r.Num > r.Used && r.ComboName == "全天置顶").OrderBy(r => r.InTime).FirstOrDefault();
                if (recharge == null)
                {
                    return(Content("noNum,全天开服点数不足,请先充值"));
                }
                if (OpenServiceBll.Add(service) != null)
                {
                    RechargedUsed ru = new RechargedUsed()
                    {
                        RechargeId = recharge.Id, OpenServiceId = service.Id, InTime = DateTime.Now
                    };
                    RechargedUsedBll.Add(ru);
                    recharge.Used = recharge.Used + 1;
                    RechargeBll.Update(recharge);
                    return(Content("ok"));
                }
                else
                {
                    return(Content("no"));
                }
            }//置顶开服
            else if (type == "1")
            {
                recharge = RechargeBll.LoadEntities(r => r.CompanyId == currenCpy.Id && r.Num > r.Used && r.ComboName != "全天置顶").OrderBy(r => r.InTime).FirstOrDefault();
                if (recharge == null)
                {
                    return(Content("noNum,点数不足,请先充值"));
                }
                if (OpenServiceBll.Add(service) != null)
                {
                    RechargedUsed ru = new RechargedUsed()
                    {
                        RechargeId = recharge.Id, OpenServiceId = service.Id, InTime = DateTime.Now
                    };
                    RechargedUsedBll.Add(ru);
                    recharge.Used = recharge.Used + 1;
                    RechargeBll.Update(recharge);
                    return(Content("ok"));
                }
                else
                {
                    return(Content("no"));
                }
            }
            else
            {
                return(Content("typeError,提示:请先选择开服类型"));
            }
        }