Esempio n. 1
0
        public JsonResult GetParkFeeRuleData()
        {
            JsonResult json = new JsonResult();

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

                string parkingId = Request.Params["parkingId"].ToString();

                List <ParkCarType>     carTypes  = ParkCarTypeServices.QueryParkCarTypeByParkingId(parkingId);
                List <ParkCarModel>    carModels = ParkCarModelServices.QueryByParkingId(parkingId);
                List <ParkFeeRule>     rules     = ParkFeeRuleServices.QueryParkFeeRuleByParkingId(parkingId);
                List <ParkArea>        areas     = ParkAreaServices.GetParkAreaByParkingId(parkingId);
                List <ParkFeeRuleView> models    = new List <ParkFeeRuleView>();
                foreach (var item in rules)
                {
                    ParkFeeRuleView view = new ParkFeeRuleView().ToParkFeeRuleView(item, areas, carTypes, carModels);
                    view.ParkingID = parkingId;
                    models.Add(view);
                }
                json.Data = models;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取收费规则集合失败");
            }
            return(json);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据车场信息获取区域信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetParkAreaData(string parkingId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(parkingId))
                {
                    return("{\"rows\":[]}");
                }

                List <ParkArea> parkAreas = ParkAreaServices.GetParkAreaByParkingId(parkingId);

                string json     = "{\"rows\":[";
                var    topAreas = parkAreas.Where(p => string.IsNullOrWhiteSpace(p.MasterID));
                foreach (var dr in topAreas)
                {
                    json += "{\"id\":" + dr.ID + ",";
                    json += "\"AreaID\":\"" + dr.AreaID + "\"";
                    json += ",\"AreaName\":\"" + dr.AreaName + "\"";
                    json += ",\"PKID\":\"" + dr.PKID + "\"";
                    json += ",\"CarbitNum\":" + dr.CarbitNum + "";
                    json += ",\"MasterID\":\"" + dr.MasterID + "\"";
                    json += ",\"Remark\":\"" + dr.Remark + "\"";
                    json += ",\"NeedToll\":\"" + (int)dr.NeedToll + "\"";
                    json += ",\"TwoCameraWait\":\"" + (int)dr.TwoCameraWait + "\"";
                    json += ",\"CameraWaitTime\":\"" + dr.CameraWaitTime + "\"";
                    json += ",\"iconCls\":\"my-pkarea-icon\"},";
                    var childs = parkAreas.Where(p => p.MasterID == dr.AreaID);
                    foreach (var obj in childs)
                    {
                        json += "{\"id\":" + obj.ID + ",";
                        json += "\"AreaID\":\"" + obj.AreaID + "\"";
                        json += ",\"AreaName\":\"" + obj.AreaName + "\"";
                        json += ",\"PKID\":\"" + obj.PKID + "\"";
                        json += ",\"ParkingID\":\"" + obj.PKID + "\"";
                        json += ",\"CarbitNum\":" + obj.CarbitNum + "";
                        json += ",\"MasterID\":\"" + obj.MasterID + "\"";
                        json += ",\"Remark\":\"" + obj.Remark + "\"";
                        json += ",\"NeedToll\":\"" + (int)obj.NeedToll + "\"";
                        json += ",\"TwoCameraWait\":\"" + (int)obj.TwoCameraWait + "\"";
                        json += ",\"CameraWaitTime\":\"" + obj.CameraWaitTime + "\"";
                        json += ",\"_parentId\":\"" + dr.AreaID + "\"";
                        json += ",\"iconCls\":\"my-pkarea-icon\"},";
                    }
                }
                if (topAreas.Count() > 0)
                {
                    json = json.Substring(0, json.Length - 1);
                }
                json += "]}";
                return(json);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "根据车场编号获取车场区域信息失败");
                return("{\"rows\":[]}");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取区域
        /// </summary>
        /// <returns></returns>
        public JsonResult GetAreas()
        {
            string     parkingid = Request.Params["parkingid"];
            JsonResult json      = new JsonResult();

            try
            {
                json.Data = ParkAreaServices.GetParkAreaByParkingId(parkingid);
            }
            catch { }
            return(json);
        }
Esempio n. 4
0
        public JsonResult GetParkArea()
        {
            JsonResult json = new JsonResult();

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

            json.Data = ParkAreaServices.GetParkAreaByParkingId(parkingId);
            return(json);
        }
Esempio n. 5
0
        /// <summary>
        /// 根据车场ID获取区域树
        /// </summary>
        /// <returns></returns>
        public string GetAreaTreeData()
        {
            string parkingId     = Request.Params["parkingId"].ToString();
            string excludeAreaID = string.Empty;

            if (!string.IsNullOrWhiteSpace(Request.Params["excludeAreaID"]))
            {
                excludeAreaID = Request.Params["excludeAreaID"].ToString();
            }
            List <ParkArea> models = ParkAreaServices.GetParkAreaByParkingId(parkingId);

            List <ParkArea> parkAreas = new List <ParkArea>();

            if (!string.IsNullOrWhiteSpace(excludeAreaID))
            {
                //是修改,并且存在下属区域
                List <ParkArea> childParkAreas = models.Where(p => p.MasterID == excludeAreaID).ToList();
                if (childParkAreas.Count == 0)
                {
                    parkAreas = models.Where(p => string.IsNullOrWhiteSpace(p.MasterID) && p.AreaID != excludeAreaID).ToList();
                }
            }
            else
            {
                parkAreas = models.Where(p => string.IsNullOrWhiteSpace(p.MasterID)).ToList();
            }

            parkAreas.Insert(0, new ParkArea {
                AreaID = string.Empty, AreaName = "顶级"
            });

            string json = "[";

            foreach (var dr in parkAreas)
            {
                json += "{\"id\":\"" + dr.AreaID + "\",";
                json += "\"attributes\":{\"type\":0},";
                json += "\"text\":\"" + dr.AreaName + "\"";
                json += "},";
            }
            if (parkAreas.Count() > 0)
            {
                json = json.Substring(0, json.Length - 1);
            }
            json += "]";
            return(json);
        }
Esempio n. 6
0
        public string GetAreaDataByParkingId(string parkingId)
        {
            StringBuilder strTree = new StringBuilder();

            strTree.Append("[");
            strTree.Append("{\"id\":\"-1\",");
            strTree.Append("\"text\":\"所有\",\"selected\":true");
            strTree.Append("}");

            if (!string.IsNullOrWhiteSpace(parkingId))
            {
                List <ParkArea> areas = ParkAreaServices.GetParkAreaByParkingId(parkingId);
                foreach (var item in areas)
                {
                    strTree.Append(",{\"id\":\"" + item.AreaID + "\",");
                    strTree.Append("\"text\":\"" + item.AreaName + "\"");
                    strTree.Append("}");
                }
            }
            strTree.Append("]");
            return(strTree.ToString());
        }
Esempio n. 7
0
        public ActionResult Passed(string recordId)
        {
            try
            {
                List <BaseVillage> villages     = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone);
                List <EnumContext> parkContexts = new List <EnumContext>();
                if (villages.Count > 0)
                {
                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(villages.Select(p => p.VID).ToList());
                    foreach (var item in parkings)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = item.PKName;
                        model.EnumString  = item.PKID;
                        parkContexts.Add(model);
                    }
                }
                ViewBag.ParkContexts = parkContexts;

                ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId);
                if (monthlyCarApply == null)
                {
                    throw new MyException("申请信息不存在");
                }

                List <ParkArea>    areas        = ParkAreaServices.GetParkAreaByParkingId(monthlyCarApply.PKID);
                List <EnumContext> areaContexts = new List <EnumContext>();
                foreach (var item in areas)
                {
                    EnumContext model = new EnumContext();
                    model.Description = item.AreaName;
                    model.EnumString  = item.AreaID;
                    areaContexts.Add(model);
                }
                ViewBag.AreaContexts = areaContexts;

                List <EnumContext> gateContexts = new List <EnumContext>();
                foreach (var item in areaContexts)
                {
                    List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>()
                    {
                        item.EnumString
                    });

                    foreach (var gate in gates)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = gate.GateName;
                        model.EnumString  = string.Format("{0}|{1}", gate.GateID, item.EnumString);
                        gateContexts.Add(model);
                    }
                }

                ViewBag.GateContexts = gateContexts;

                return(View(monthlyCarApply));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "审核失败" }));
            }
        }