Esempio n. 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("下载二维码失败")));
            }
        }
Esempio n. 2
0
 public JsonResult SaveEdit(ParkBox model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.BoxID))
         {
             result = ParkBoxServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else
         {
             result = ParkBoxServices.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 JsonResult GetParkBoxData()
        {
            JsonResult json = new JsonResult();

            if (string.IsNullOrEmpty(Request.Params["areaId"]))
            {
                return(json);
            }
            List <ParkBox> parkBoxs = ParkBoxServices.QueryByParkAreaId(Request.Params["areaId"].ToString());

            var parkBoxDatas = from p in parkBoxs
                               select new
            {
                BoxID           = p.BoxID,
                BoxNo           = p.BoxNo,
                BoxName         = p.BoxName,
                ComputerIP      = p.ComputerIP,
                AreaID          = p.AreaID,
                Remark          = p.Remark,
                IsCenterPayment = p.IsCenterPayment,
                AreaName        = !string.IsNullOrEmpty(Request.Params["areaName"]) ? Request.Params["areaName"].ToString() : string.Empty,
                ParkingName     = !string.IsNullOrEmpty(Request.Params["parkName"]) ? Request.Params["parkName"].ToString() : string.Empty,
            };

            json.Data = parkBoxDatas;
            return(json);
        }
Esempio n. 4
0
        /// <summary>
        /// 获得岗亭
        /// </summary>
        /// <returns></returns>
        public JsonResult GetBoxes()
        {
            string     parkingid = Request.Params["parkingid"];
            JsonResult json      = new JsonResult();

            try
            {
                json.Data = ParkBoxServices.QueryByParkingID(parkingid);
            }
            catch
            { }
            return(json);
        }
Esempio n. 5
0
        public string GetParkBoxTreeData()
        {
            try
            {
                StringBuilder       strBoxTree = new StringBuilder();
                List <BaseParkinfo> parkings   = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                if (parkings.Count == 0)
                {
                    return(string.Empty);
                }
                List <ParkArea> parkAreas = ParkAreaServices.GetParkAreaByParkingIds(parkings.Select(p => p.PKID).ToList());
                List <ParkBox>  parkBoxs  = ParkBoxServices.QueryByParkAreaIds(parkAreas.Select(p => p.AreaID).ToList());
                strBoxTree.Append("[");
                int index = 1;

                foreach (var item in GetLoginUserVillages)
                {
                    BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID);
                    if (company == null)
                    {
                        continue;
                    }

                    string text = string.Format("{0}【{1}】", item.VName, company.CPName);
                    strBoxTree.Append("{\"id\":\"" + item.VID + "\",");
                    strBoxTree.Append("\"attributes\":{\"type\":0},");
                    strBoxTree.Append("\"iconCls\":\"my-village-icon\",");
                    strBoxTree.Append("\"text\":\"" + text + "\"");
                    GetParkingTreeData(parkings, parkAreas, item.VID, parkBoxs, strBoxTree);
                    strBoxTree.Append("}");
                    if (index != GetLoginUserVillages.Count)
                    {
                        strBoxTree.Append(",");
                    }
                    index++;
                }

                strBoxTree.Append("]");
                return(strBoxTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建岗亭树结构失败");
                return(string.Empty);
            }
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 public JsonResult Delete(string recordId)
 {
     try
     {
         bool result = ParkBoxServices.Delete(recordId);
         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("删除岗亭信息失败")));
     }
 }