public static bool Add(BWYGateMapping model) { model.RecordID = GuidGenerator.GetGuidString(); IBWYGateMapping factory = BWYGateMappingFactory.GetFactory(); return(factory.Add(model)); }
public bool Update(BWYGateMapping model) { using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { return(Update(model, dbOperator)); } }
public JsonResult SaveEdit(BWYGateMapping model) { try { bool result = false; if (string.IsNullOrWhiteSpace(model.RecordID)) { model.DataSource = 0; result = BWYGateMappingServices.Add(model); if (!result) { throw new MyException("添加失败"); } return(Json(MyResult.Success())); } else { result = BWYGateMappingServices.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("保存岗亭信息失败"))); } }
public bool Add(BWYGateMapping model, DbOperator dbOperator) { model.DataStatus = DataStatus.Normal; model.LastUpdateTime = DateTime.Now; model.HaveUpdate = SystemDefaultConfig.DataUpdateFlag; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BWYGateMapping(RecordID,ParkingID,ParkingName,ParkBoxID,ParkBoxName,GateID,GateName,CreateTime,DataSource,DataStatus,LastUpdateTime,HaveUpdate)"); strSql.Append(" values(@RecordID,@ParkingID,@ParkingName,@ParkBoxID,@ParkBoxName,@GateID,@GateName,@CreateTime,@DataSource,@DataStatus,@LastUpdateTime,@HaveUpdate)"); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", model.RecordID); dbOperator.AddParameter("ParkingID", model.ParkingID); dbOperator.AddParameter("ParkingName", model.ParkingName); dbOperator.AddParameter("ParkBoxID", model.ParkBoxID); dbOperator.AddParameter("ParkBoxName", model.ParkBoxName); dbOperator.AddParameter("GateID", model.GateID); dbOperator.AddParameter("GateName", model.GateName); dbOperator.AddParameter("CreateTime", DateTime.Now); dbOperator.AddParameter("DataSource", model.DataSource); dbOperator.AddParameter("DataStatus", (int)model.DataStatus); dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime); dbOperator.AddParameter("HaveUpdate", model.HaveUpdate); return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0); }
private string GetBWYParkingName(string parkingId, List <BWYGateMapping> gates) { if (string.IsNullOrWhiteSpace(parkingId)) { return(string.Empty); } BWYGateMapping model = gates.FirstOrDefault(p => p.ParkingID == parkingId); if (model != null) { return(model.ParkingName); } return(string.Empty); }
public static TempParkingFeeResult SFMTempParkingFeeResult(string ParkNo, string GateID) { TempParkingFeeResult result = new TempParkingFeeResult(); result.Result = APPResult.OtherException; result.ErrorDesc = "车场或通道编号未配置"; if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID) && !string.IsNullOrWhiteSpace(ParkNo) && !string.IsNullOrWhiteSpace(GateID)) { try { BWYGateMapping gate = BWYGateMappingServices.QueryByGateID(1, ParkNo, GateID); if (gate == null) { result.Result = APPResult.OtherException; result.ErrorDesc = "获取车场信息失败"; TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,获取车场信息失败,通道编号:{0}", GateID)); return(result); } TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,SFMInterfaceUrl:{0},SFMSecretKey:{1},SFMPKID:{2}", SFMInterfaceUrl, SFMSecretKey, SFMPKID)); if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID)) { OutCarInfoResult sfmResult = SFMInterfaceProcess.QueryOutCarOrder(gate.ParkNo, GateID); if (!sfmResult.Success) { result.Result = APPResult.OtherException; result.ErrorDesc = string.Format("{0}[{1}]", sfmResult.Message, sfmResult.Code); return(result); } if (sfmResult.Data == null) { result.Result = APPResult.NoCarInBox; result.ErrorDesc = string.Empty; return(result); } return(SFMTransforTempParkingFeeResult(result, sfmResult)); } } catch (Exception ex) { TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,异常:{0}", ex.Message)); } } else { TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.SFMPKID, GateID)); } return(result); }
/// <summary> /// 修改赛菲姆车场信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool UpdateSFMParking(List <BWYGateMapping> models) { IBWYGateMapping factory = BWYGateMappingFactory.GetFactory(); List <BWYGateMapping> oldModels = factory.QueryByDataSource(1); using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { try { dbOperator.BeginTransaction(); foreach (var item in models) { if (item.DataSource != 1) { throw new MyException("数据来源不正确"); } BWYGateMapping oldModel = oldModels.FirstOrDefault(p => p.ParkingID == item.ParkingID && p.ParkBoxID == item.ParkBoxID && p.GateID == item.GateID); if (oldModel == null) { item.RecordID = GuidGenerator.GetGuidString(); bool result = factory.Add(item, dbOperator); if (!result) { throw new MyException("添加车场信息失败"); } } else { oldModel.ParkingName = item.ParkingName; oldModel.ParkBoxName = item.ParkBoxName; oldModel.GateName = item.GateName; bool result = factory.Update(oldModel, dbOperator); if (!result) { throw new MyException("修改车场信息失败"); } } } dbOperator.CommitTransaction(); return(true); } catch { dbOperator.RollbackTransaction(); throw; } } }
public static bool UpdateParkNo(string recordId, string parkNo) { if (string.IsNullOrWhiteSpace(recordId)) { throw new ArgumentNullException("recordId"); } if (string.IsNullOrWhiteSpace(parkNo)) { throw new ArgumentNullException("parkNo"); } IBWYGateMapping factory = BWYGateMappingFactory.GetFactory(); BWYGateMapping molde = factory.QueryByRecordId(recordId); if (molde == null) { throw new MyException("需要修改的信息不存在"); } return(factory.UpdateParkNo(recordId, parkNo)); }
public JsonResult SaveQRCodeParkNo(BWYGateMapping model) { try { bool result = BWYGateMappingServices.UpdateParkNo(model.RecordID, model.ParkNo); 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("保存二维码车场编号失败"))); } }
public bool Update(BWYGateMapping model, DbOperator dbOperator) { model.DataStatus = DataStatus.Normal; model.LastUpdateTime = DateTime.Now; model.HaveUpdate = SystemDefaultConfig.DataUpdateFlag; StringBuilder strSql = new StringBuilder(); strSql.Append("update BWYGateMapping set ParkingID=@ParkingID,ParkingName=@ParkingName,GateID=@GateID,GateName=@GateName,DataSource=@DataSource"); strSql.Append(",LastUpdateTime=@LastUpdateTime,HaveUpdate=@HaveUpdate where RecordID=@RecordID"); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", model.RecordID); dbOperator.AddParameter("ParkingID", model.ParkingID); dbOperator.AddParameter("ParkingName", model.ParkingName); dbOperator.AddParameter("GateID", model.GateID); dbOperator.AddParameter("GateName", model.GateName); dbOperator.AddParameter("DataSource", model.DataSource); dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime); dbOperator.AddParameter("HaveUpdate", model.HaveUpdate); dbOperator.AddParameter("DataStatus", (int)model.DataStatus); return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0); }
public static bool Update(BWYGateMapping model) { IBWYGateMapping factory = BWYGateMappingFactory.GetFactory(); return(factory.Update(model)); }
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>(); BWYGateMapping gate = BWYGateMappingServices.QueryByRecordId(gateId); if (gate == null) { throw new MyException("获取车场信息失败"); } if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain)) { throw new MyException("获取域名失败"); } BaseCompany company = null; if (gate.DataSource == 0) { if (string.IsNullOrWhiteSpace(SystemDefaultConfig.BWPKID)) { throw new MyException("获取车场编号失败"); } company = CompanyServices.QueryByParkingId(SystemDefaultConfig.BWPKID); } else { if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID)) { throw new MyException("获取车场编号失败"); } if (string.IsNullOrWhiteSpace(gate.ParkNo)) { throw new MyException("二维码车场编号不能为空"); } company = CompanyServices.QueryByParkingId(SystemDefaultConfig.SFMPKID); } if (company == null) { throw new MyException("获取单位编号失败"); } string content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}^source=0", SystemDefaultConfig.SystemDomain, SystemDefaultConfig.BWPKID, gate.GateID); if (gate.DataSource == 1) { content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}^source=0", SystemDefaultConfig.SystemDomain, SystemDefaultConfig.SFMPKID, gate.ParkNo + "$" + gate.GateID); } foreach (var item in dics) { string parkingName = string.Format("{0}_{1}_{2}", gate.ParkingName, 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("下载外部车场二维码失败"))); } }
public JsonResult ImportSFMParking() { try { SFMParkInfoResult result = SFMInterfaceProcess.GetParkInfo(); if (result == null || !result.Success) { throw new MyException("获取车场信息失败"); } if (result.Data == null || result.Data.TotalRecord == 0 || result.Data.ResultList == null || result.Data.ResultList.Count == 0) { throw new MyException("无车场信息"); } List <BWYGateMapping> models = new List <BWYGateMapping>(); foreach (var item in result.Data.ResultList) { BWYGateMapping model = new BWYGateMapping(); model.ParkingID = item.parkKey; model.ParkingName = item.parkName; model.DataSource = 1; List <ParkSentry> parkSentry = item.parkSentry; if (parkSentry != null && parkSentry.Count > 0) { foreach (var sentry in parkSentry) { model.ParkBoxID = sentry.sentryNo; model.ParkBoxName = sentry.sentryName; List <ParkLane> parkLanes = sentry.parkLane; if (parkLanes != null) { foreach (var lane in parkLanes) { if (lane.vehicleType != "1") { continue; } BWYGateMapping gateMap = new BWYGateMapping(); gateMap.ParkingID = model.ParkingID; gateMap.ParkingName = model.ParkingName; gateMap.DataSource = model.DataSource; gateMap.ParkBoxID = model.ParkBoxID; gateMap.ParkBoxName = model.ParkBoxName; gateMap.GateID = lane.vehicleNo; gateMap.GateName = lane.vehicleName; models.Add(gateMap); } } } } } if (models.Count == 0) { throw new MyException("请核实塞菲姆车场数据的完整性"); } bool addResult = BWYGateMappingServices.UpdateSFMParking(models); if (!addResult) { 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("导入塞菲姆车场信息失败"))); } }
public bool Update(BWYGateMapping model, DbOperator dbOperator) { throw new NotImplementedException(); }