コード例 #1
0
        public JsonResult DownloadQRCode(string gateId, 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>();
                ParkGate      gate = ParkGateServices.QueryByRecordId(gateId);
                if (gate == null)
                {
                    throw new MyException("获取通道信息失败");
                }
                BaseCompany company = CompanyServices.QueryByBoxID(gate.BoxID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                ParkBox box = ParkBoxServices.QueryByRecordId(gate.BoxID);
                if (box == null)
                {
                    throw new MyException("获取岗亭信息失败");
                }

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

                BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(area.PKID);
                if (parking == null)
                {
                    throw new MyException("获取车场信息失败");
                }
                string content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}", SystemDefaultConfig.SystemDomain, parking.PKID, gate.GateID);
                foreach (var item in dics)
                {
                    string parkingName = string.Format("{0}_{1}_{2}_{3}_{4}", parking.PKName, area.AreaName, box.BoxName, gate.GateName, 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("下载二维码失败")));
            }
        }
コード例 #2
0
        private string GetParkingId(string pid, string bid, string gid)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(pid))
                {
                    return(pid);
                }
                if (!string.IsNullOrWhiteSpace(bid))
                {
                    ParkBox box = ParkBoxServices.QueryByRecordId(bid);
                    if (box != null)
                    {
                        ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID);
                        if (area != null)
                        {
                            return(area.PKID);
                        }
                    }
                }

                if (!string.IsNullOrWhiteSpace(gid))
                {
                    ParkGate gate = ParkGateServices.QueryByRecordId(gid);
                    if (gate != null)
                    {
                        ParkBox box = ParkBoxServices.QueryByRecordId(gate.BoxID);
                        if (box != null)
                        {
                            ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID);
                            if (area != null)
                            {
                                return(area.PKID);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "GetParkingId方法处理异常", ex, LogFrom.WeiXin);
            }
            return(string.Empty);
        }