Example #1
0
        public ActionResult Index()
        {
            List <ParkDerate>  derates        = ParkDerateServices.QueryBySellerID(SellerLoginUser.SellerID);
            List <EnumContext> derateContexts = new List <EnumContext>();

            foreach (var item in derates)
            {
                EnumContext model = new EnumContext();
                model.EnumString  = item.DerateID;
                model.Description = item.Name;
                model.EnumValue   = (int)item.DerateType;
                derateContexts.Add(model);
            }
            ViewBag.DerateContexts  = derateContexts;
            ViewBag.CarDerateStatus = EnumHelper.GetEnumContextList(typeof(CarDerateStatus), true);
            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");
            return(View());
        }
Example #2
0
        public ActionResult GetSellerDerateData()
        {
            JsonResult result = new JsonResult();

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

                List <ParkDerate> derates = ParkDerateServices.QueryBySellerID(sellerId);
                result.Data = derates;
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "优免券发放获取优免信息失败");
                return(result);
            }
        }
Example #3
0
        public string GetSellerDerateTree(bool needDefaultValue = false)
        {
            try
            {
                if (string.IsNullOrEmpty(Request.Params["sellerId"]))
                {
                    return("[]");
                }

                string        sellerId = Request.Params["sellerId"].ToString();
                StringBuilder strTree  = new StringBuilder();
                strTree.Append("[");
                if (needDefaultValue)
                {
                    strTree.Append("{\"id\":\"\",");
                    strTree.Append("\"text\":\"不限\"");
                    strTree.Append("}");
                }
                List <ParkDerate> derates = ParkDerateServices.QueryBySellerID(sellerId);
                foreach (var item in derates)
                {
                    if (strTree.ToString() != "[")
                    {
                        strTree.Append(",");
                    }
                    strTree.Append("{\"id\":\"" + item.DerateID + "\",");
                    strTree.Append("\"text\":\"" + item.Name + "\"");
                    strTree.Append("}");
                }
                strTree.Append("]");
                return(strTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "优免二维码根据商家编号获取优免信息失败");
                return("[]");
            }
        }
Example #4
0
        public ActionResult Edit(string recordId)
        {
            try
            {
                ParkDerateQRcode derate = new ParkDerateQRcode();
                if (!string.IsNullOrWhiteSpace(recordId))
                {
                    derate = ParkDerateQRcodeServices.QueryByRecordId(recordId);
                }
                else
                {
                    derate.StartTime = DateTime.Now;
                    derate.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
                }

                List <ParkDerate>  derates        = ParkDerateServices.QueryBySellerID(SellerLoginUser.SellerID);
                List <EnumContext> derateContexts = new List <EnumContext>();
                foreach (var item in derates)
                {
                    EnumContext model = new EnumContext();
                    model.EnumString  = item.DerateID;
                    model.Description = item.Name;
                    model.EnumValue   = (int)item.DerateType;
                    derateContexts.Add(model);
                }
                ViewBag.DerateContexts = derateContexts;
                return(View(derate));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "微信修优免二维码失败", LogFrom.WeiXin);
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "操作失败" }));
            }
        }
Example #5
0
        public JsonResult GetSellerDerateData()
        {
            JsonResult json = new JsonResult();

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

                string            sellerId = Request.Params["sellerId"].ToString();
                List <ParkDerate> derates  = ParkDerateServices.QueryBySellerID(sellerId);
                var result = from p in derates select new {
                    DerateID          = p.DerateID,
                    SellerID          = p.SellerID,
                    Name              = p.Name,
                    DerateSwparate    = (int)p.DerateSwparate,
                    DerateSwparateDes = p.DerateSwparate.GetDescription(),
                    DerateType        = (int)p.DerateType,
                    DerateTypeDes     = p.DerateType.GetDescription(),
                    DerateMoney       = p.DerateMoney,
                    FreeTime          = p.FreeTime,
                    StartTime         = p.StartTime != DateTime.MinValue?p.StartTime.ToString("HH:mm"):"00:00",
                    EndTime           = p.EndTime != DateTime.MinValue ? p.EndTime.ToString("HH:mm") : "00:00",
                    FeeRuleID         = p.FeeRuleID,
                    DerateIntervar    = GetDerateIntervar(p.DerateIntervar),
                };
                json.Data = result;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "根据商家编号获取优免信息失败");
            }
            return(json);
        }