예제 #1
0
        public ActionResult GetParkingData()
        {
            JsonResult result = new JsonResult();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["sellerId"]))
                {
                    return(result);
                }
                string sellerId = Request.Params["sellerId"].ToString();

                ParkSeller seller = ParkSellerServices.QueryBySellerId(sellerId);
                if (seller == null)
                {
                    throw new MyException("获取商家信息失败");
                }

                List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(seller.VID);
                result.Data = parkings;
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "优免券发放车场信息失败");
                return(result);
            }
        }
예제 #2
0
 /// <summary>
 /// 获取车场数据
 /// </summary>
 /// <param name="plateNumber"></param>
 /// <returns></returns>
 public JsonResult GetParkingData(string villageId)
 {
     try
     {
         List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(villageId);
         return(Json(MyResult.Success("", parkings)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("H5CarVisitorError", "获取车场信息失败", ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("获取车场信息失败")));
     }
 }
예제 #3
0
        /// <summary>
        /// 打折记录
        /// </summary>
        /// <returns></returns>
        public ActionResult DiscountRecord()
        {
            ViewBag.StartTime = DateTime.Now.AddDays(-7).Date.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            ViewBag.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            List <BaseParkinfo> parkinfos       = ParkingServices.QueryParkingByVillageId(SellerLoginUser.VID);
            List <EnumContext>  parkingContexts = new List <EnumContext>();

            foreach (var item in parkinfos)
            {
                EnumContext model = new EnumContext();
                model.EnumString  = item.PKID;
                model.Description = item.PKName;
                parkingContexts.Add(model);
            }
            ViewBag.CarDerateParkings = parkingContexts;
            ViewBag.CarDerateStatus   = EnumHelper.GetEnumContextList(typeof(CarDerateStatus), true);

            return(View());
        }
예제 #4
0
        public ActionResult GetParkDerateQRcodeData(string derateId, int?status, int page)
        {
            try
            {
                int rows  = 10;
                int total = 0;
                List <ParkDerateQRcode> models = ParkDerateQRcodeServices.QueryPage(SellerLoginUser.SellerID, derateId, 0, status, DerateQRCodeSource.Seller, rows, page, out total);
                if (models.Count > 0)
                {
                    ParkSeller seller = ParkSellerServices.QueryBySellerId(SellerLoginUser.SellerID);
                    if (seller == null)
                    {
                        throw new MyException("获取商家信息失败");
                    }

                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(seller.VID);

                    Dictionary <string, int> result = ParkCarDerateServices.QuerySettlementdCarDerate(models.Select(p => p.RecordID).ToList());
                    foreach (var item in models)
                    {
                        int    useTimes    = result.ContainsKey(item.RecordID) ? result[item.RecordID] : 0;
                        string canUseTimes = item.CanUseTimes == 0 ? "不限" : item.CanUseTimes.ToString();
                        item.UseTimesDes = string.Format("{0}/{1}", canUseTimes, useTimes);
                        BaseParkinfo park = parkings.FirstOrDefault(p => p.PKID == item.PKID);
                        if (park != null)
                        {
                            item.ParkName = park.PKName;
                        }
                    }
                }
                return(Json(MyResult.Success("", models)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取优免二维码失败", LogFrom.WeiXin);
                return(Json(MyResult.Error("获取优免二维码失败")));
            }
        }
예제 #5
0
        public JsonResult GetParkFeeRuleTreeData()
        {
            JsonResult json = new JsonResult();

            if (string.IsNullOrEmpty(Request.Params["sellerId"]))
            {
                return(json);
            }

            string     sellerId = Request.Params["sellerId"].ToString();
            ParkSeller seller   = ParkSellerServices.QueryBySellerId(sellerId);

            if (seller == null)
            {
                throw new MyException("获取商家信息失败");
            }

            List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(seller.VID);

            if (parkings.Count == 0)
            {
                return(json);
            }

            List <ParkFeeRule> rules = new List <ParkFeeRule>();

            foreach (var item in parkings)
            {
                List <ParkFeeRule> rule = ParkFeeRuleServices.QueryParkFeeRuleByParkingId(item.PKID);
                if (rule.Count > 0)
                {
                    rules.AddRange(rule);
                }
            }
            json.Data = rules;
            return(json);
        }
예제 #6
0
        public string GetParkDerateQRcodeData()
        {
            StringBuilder strData = new StringBuilder();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["sellerId"]))
                {
                    return(string.Empty);
                }
                string sellerId = Request.Params["sellerId"].ToString();
                string derateId = Request.Params["derateId"].ToString();

                int?queryStatus = null;
                int status      = 0;
                if (!string.IsNullOrWhiteSpace(Request.Params["status"]) && int.TryParse(Request.Params["status"].ToString(), out status))
                {
                    queryStatus = status;
                }
                DerateQRCodeSource?derateQRCodeSource = null;
                int source = 0;
                if (!string.IsNullOrWhiteSpace(Request.Params["DerateQRCodeSource"]) && int.TryParse(Request.Params["DerateQRCodeSource"].ToString(), out source))
                {
                    derateQRCodeSource = (DerateQRCodeSource)source;
                }


                int page  = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows  = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
                int total = 0;
                List <ParkDerateQRcode> models = ParkDerateQRcodeServices.QueryPage(sellerId, derateId, 1, queryStatus, derateQRCodeSource, rows, page, out total);
                if (models.Count > 0)
                {
                    ParkSeller seller = ParkSellerServices.QueryBySellerId(sellerId);
                    if (seller == null)
                    {
                        throw new MyException("获取商家信息失败");
                    }

                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(seller.VID);

                    Dictionary <string, int> result = ParkCarDerateServices.QuerySettlementdCarDerate(models.Select(p => p.RecordID).ToList());
                    foreach (var item in models)
                    {
                        int    useTimes    = result.ContainsKey(item.RecordID)?result[item.RecordID]:0;
                        string canUseTimes = item.CanUseTimes == 0 ? "不限" : item.CanUseTimes.ToString();
                        item.UseTimesDes = string.Format("{0}/{1}", canUseTimes, useTimes);
                        BaseParkinfo park = parkings.FirstOrDefault(p => p.PKID == item.PKID);
                        if (park != null)
                        {
                            item.ParkName = park.PKName;
                        }
                    }
                }
                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(models) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取一次性优免二维码失败");
            }
            return(strData.ToString());
        }