private bool SyncToECar(ECardRecord record) { try { double limitationRemain = (double)(record.LimitationRemain == null ? 35 : record.LimitationRemain.Value); int sheetID = 0; if (!string.IsNullOrEmpty(record.SheetID)) { int.TryParse(record.SheetID, out sheetID); } ECardService.NightParkingSoapClient client = new ECardService.NightParkingSoapClient(); ECardService.ResultMessage ret = client.AddParkingHistory(record.CardID, sheetID, record.Carplate, record.EnterDt.Value, record.EventDt, limitationRemain, string.Empty, string.Empty, string.Empty); if (!ret.status) { ShowMessage("上传车辆出场记录失败,原因:" + ret.Message, Color.Red); Ralid.GeneralLibrary.LOG.FileLog.Log("一车通上传", ret.Message); } return(ret.status); } catch (Exception ex) { ShowMessage("上传车辆出场记录调用出现异常:" + ex.Message, Color.Red); } return(false); }
protected override bool DeletingItem(object item) { ECardRecord info = item as ECardRecord; CommandResult ret = ProviderFactory.Create <IECardRecordProvider>(AppSettings.CurrentSetting.ParkConnect).Delete(info); if (ret.Result != ResultCode.Successful) { MessageBox.Show(ret.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(ret.Result == ResultCode.Successful); }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { ECardRecord info = item as ECardRecord; row.Tag = info; row.Cells["colSheetID"].Value = info.SheetID; row.Cells["colCardID"].Value = info.CardID; row.Cells["colCarplate"].Value = info.Carplate; row.Cells["colEnterDt"].Value = info.EnterDt; row.Cells["colExitDt"].Value = info.EventDt; row.Cells["colLimitation"].Value = info.LimitationRemain; }
/// <summary> /// 保存卡片与卡片事件信息(用于停车场产生事件时更新卡片状态并保存事件) /// </summary> /// <param name="card"></param> /// <param name="report"></param> /// <returns></returns> public CommandResult SaveCardAndEvent(CardInfo card, CardEventReport report) { IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri); if (card.CardType == CardType.Ticket && report.IsExitEvent) ////纸票出场后将其删除 { _Provider.Delete(card, unitWork); } else { CardInfo info = card.Clone(); //卡片状态保持用数据库中的状态 info.ParkingStatus = report.ParkingStatus; info.LastDateTime = report.EventDateTime; info.LastEntrance = report.EntranceID; info.LastCarPlate = report.CarPlate; if (report.LimitationRemain != info.LimitationRemain) { info.LimitationRemain = report.LimitationRemain; info.LimitationTimestamp = report.EventDateTime; } //入口刷卡事件时,将缴费时间,停车费用,累计停车费用清空 if (!report.IsExitEvent) { info.ClearPaidData(); } _Provider.Update(info, card, unitWork); } ICardEventProvider icp = ProviderFactory.Create <ICardEventProvider>(_RepoUri); icp.Insert((new CardEventRecord(report)), unitWork); if (report.IsExitEvent && report.Limitation > 0) //出场事件且有限时停车的记录才要记录到上传表中。 { ECardRecord ecr = new ECardRecord() { SheetID = card.SheetID, Carplate = report.CarPlate, CardID = report.CardID, EventDt = report.EventDateTime, EnterDt = report.LastDateTime, Limitation = report.Limitation, LimitationRemain = report.LimitationRemain }; IECardRecordProvider iecr = ProviderFactory.Create <IECardRecordProvider>(_RepoUri); iecr.Insert(ecr, unitWork); } CommandResult ret = unitWork.Commit(); if (ret.Result == ResultCode.Successful) //如果成功,则改变卡片状态 { //卡片状态保持用数据库中的状态 card.ParkingStatus = report.ParkingStatus; card.LastDateTime = report.EventDateTime; card.LastEntrance = report.EntranceID; card.LastCarPlate = report.CarPlate; card.LimitationRemain = report.LimitationRemain; //入口刷卡事件时,将缴费时间,停车费用,累计停车费用清空 if (!report.IsExitEvent) { card.ClearPaidData(); } } return(ret); }