Esempio n. 1
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult GetCarTypeSingle(string carTypeId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(carTypeId))
                {
                    throw new MyException("获取车类编号失败");
                }
                List <ParkCarTypeSingle> models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    ParkCarTypeSingleServices.AddDefault(carTypeId);
                }
                models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    throw new MyException("获取单双车牌配置失败");
                }

                return(Json(MyResult.Success("获取成功", models)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取单双车牌配置失败");
                return(Json(MyResult.Error("获取单双车牌配置失败")));
            }
        }
Esempio n. 2
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult SaveCarTypeSingle(ParkCarTypeSingle model)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(model.CarTypeID))
                {
                    throw new MyException("获取车类编号失败");
                }
                if (string.IsNullOrWhiteSpace(model.SingleID))
                {
                    throw new MyException("获取编号失败");
                }

                bool result = ParkCarTypeSingleServices.Update(model);
                if (!result)
                {
                    throw new MyException("保存失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存单双车牌配置失败");
                return(Json(MyResult.Error("保存单双车牌配置失败")));
            }
        }
Esempio n. 3
0
        public static bool AddDefault(string parkingId, DbOperator dbOperator)
        {
            if (string.IsNullOrWhiteSpace(parkingId))
            {
                throw new ArgumentNullException("parkingId");
            }

            IParkCarType       factory     = ParkCarTypeFactory.GetFactory();
            List <ParkCarType> listcartype = GetDefaultParkCarTypes(parkingId);

            foreach (var obj in listcartype)
            {
                ParkCarTypeSingleServices.AddDefault(obj.CarTypeID, dbOperator);
            }
            return(factory.Add(listcartype, dbOperator));
        }
Esempio n. 4
0
        protected override void ProcessRule(InputAgs args, ResultAgs rst)
        {
            string errorMsg  = "";
            var    blackList = ParkBlacklistServices.GetBlacklist(args.AreadInfo.PKID, args.Plateinfo.LicenseNum, out errorMsg);

            if (blackList != null)
            {
                if (blackList.Status == BlackListStatus.NotEnterAndOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                }
                else if (args.GateInfo.IoState == IoState.GoOut &&
                         blackList.Status == BlackListStatus.CanEnterAndNotOut)
                {
                    rst.ResCode = ResultCode.BlacklistCar;
                }
                else
                {
                    rst.ValidMsg = "黑名单车辆";
                }
            }
            if (args.CardInfo != null && args.CarTypeInfo != null)
            {
                var siglelist = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(args.CarTypeInfo.CarTypeID);
                if (siglelist == null || siglelist.Count <= 0)
                {
                    return;
                }
                var sigle = siglelist.Find(s => s.Week == (int)DateTime.Now.DayOfWeek);
                if (sigle == null)
                {
                    return;
                }
                if (sigle.SingleType == 0)
                {
                    return;
                }
                // sigle.SingleType 0 单双可进出 1 单可进出 2 双可进出
                if (args.Plateinfo.LicenseNum.Length < 1)
                {
                    return;
                }
                List <string> stringplates = new List <string> {
                    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
                    "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
                };
                var cplate = args.Plateinfo.LicenseNum.Substring(args.Plateinfo.LicenseNum.Length - 2, 1);
                var index  = 0;
                if (cplate.IsInteger())
                {
                    index = cplate.ToInt();
                }
                else
                {
                    index = stringplates.IndexOf(cplate) + 1;
                }
                if (index.IsEvennumber() && sigle.SingleType == 2)//偶数
                {
                    return;
                }
                else if (!index.IsEvennumber() && sigle.SingleType == 1)//奇数
                {
                    return;
                }
                else
                {
                    rst.ResCode  = ResultCode.NoPermissionsInOut;
                    rst.ValidMsg = "车辆在限行时间";
                }
            }
        }