Exemplo n.º 1
0
        public JsonResult GetParkCarTypeData()
        {
            JsonResult json = new JsonResult();

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

                string             parkingid = Request.Params["parkingid"].ToString();
                BaseParkinfo       parking   = ParkingServices.QueryParkingByRecordId(parkingid);
                List <ParkCarType> carTypes  = ParkCarTypeServices.QueryParkCarTypeByParkingId(parkingid);
                foreach (var item in carTypes)
                {
                    ProcessListShowData(item);
                }
                var result = from p in carTypes select new {
                    CarTypeID                = p.CarTypeID,
                    CarTypeName              = p.CarTypeName,
                    PKID                     = p.PKID,
                    BaseTypeID               = (int)p.BaseTypeID,
                    BaseTypeDes              = p.BaseTypeID.GetDescription(),
                    RepeatIn                 = p.RepeatIn,
                    ParkName                 = parking.PKName,
                    RepeatOut                = p.RepeatOut,
                    AffirmIn                 = p.AffirmIn,
                    AffirmOut                = p.AffirmOut,
                    InBeginTime              = p.InBeginTime != DateTime.MinValue ? p.InBeginTime.ToString("yyyy-MM-dd HH:mm:ss") : "",
                    InEdnTime                = p.InEdnTime != DateTime.MinValue ? p.InEdnTime.ToString("yyyy-MM-dd HH:mm:ss") : "",
                    MaxUseMoney              = p.MaxUseMoney,
                    AllowLose                = p.AllowLose,
                    LpDistinguish            = (int)p.LpDistinguish,
                    LpDistinguishDes         = p.LpDistinguish.GetDescription(),
                    InOutEditCar             = p.InOutEditCar,
                    InOutTime                = p.InOutTime,
                    CarNoLike                = p.CarNoLike,
                    IsAllowOnlIne            = p.IsAllowOnlIne,
                    Amount                   = p.Amount,
                    MaxMonth                 = p.MaxMonth,
                    MaxValue                 = p.MaxValue,
                    OnlineUnit               = p.OnlineUnit,
                    OverdueToTemp            = p.OverdueToTemp,
                    OverdueToTempDes         = p.OverdueToTemp.GetDescription(),
                    LotOccupy                = p.LotOccupy,
                    LotOccupyDes             = p.LotOccupy.GetDescription(),
                    Deposit                  = p.Deposit,
                    MonthCardExpiredEnterDay = p.MonthCardExpiredEnterDay,
                    AffirmBegin              = string.IsNullOrWhiteSpace(p.AffirmBegin)?"00:00":p.AffirmBegin,
                    AffirmEnd                = string.IsNullOrWhiteSpace(p.AffirmEnd) ? "23:59" : p.AffirmEnd,
                    IsDispatch               = p.IsDispatch
                };
                json.Data = result;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取车类型集合失败");
            }
            return(json);
        }
Exemplo n.º 2
0
        public JsonResult DownloadQRCode(string boxId, int size)
        {
            try
            {
                List <int> dics = new List <int>();
                dics.Add(258);
                dics.Add(344);
                dics.Add(430);
                dics.Add(860);
                dics.Add(1280);

                List <string> imgs = new List <string>();

                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取域名失败");
                }
                ParkBox box = ParkBoxServices.QueryByRecordId(boxId);
                if (box == null)
                {
                    throw new MyException("获取岗亭信息失败");
                }

                ParkArea area = ParkAreaServices.GetParkAreaByParkBoxRecordId(boxId);
                if (area == null)
                {
                    throw new MyException("获取区域信息失败");
                }

                BaseParkinfo parking = ParkingServices.QueryParkingByRecordId(area.PKID);
                if (parking == null)
                {
                    throw new MyException("获取车场信息失败");
                }

                BaseCompany company = CompanyServices.QueryByBoxID(boxId);
                if (company == null)
                {
                    throw new MyException("获取单位编号失败");
                }

                string content = string.Format("{0}/qrl/qrp_ix_bid={1}", SystemDefaultConfig.SystemDomain, boxId);
                foreach (var item in dics)
                {
                    string parkingName = string.Format("{0}_{1}_{2}_{3}", parking.PKName, area.AreaName, box.BoxName, item);
                    string result      = QRCodeServices.GenerateQRCode(company.CPID, content, item, parkingName);
                    imgs.Add(item.ToString() + "|" + result);
                }

                return(Json(MyResult.Success("", imgs)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "下载岗亭二维码失败");
                return(Json(MyResult.Error("下载二维码失败")));
            }
        }