private void ItemSearching_Handler(object sender, EventArgs e) { this.customDataGridview1.Rows.Clear(); RecordSearchCondition con = new RecordSearchCondition(); con.RecordDateTimeRange = new DateTimeRange(); con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime; con.RecordDateTimeRange.End = this.ucDateTimeInterval1.EndDateTime; con.CardID = this.txtCardID.Text.Trim(); con.Operator = this.comOperator.SelectecOperator; con.StationID = this.comWorkStation.Text.Trim(); FreeAuthorizationLogBll bll = new FreeAuthorizationLogBll(Ralid.Park.BusinessModel.Configuration.AppSettings.CurrentSetting.ParkConnect); QueryResultList <FreeAuthorizationLog> result = bll.GetFreeAuthorizationLogs(con); if (result.Result == ResultCode.Successful) { List <FreeAuthorizationLog> items = (from log in result.QueryObjects orderby log.LogDateTime descending select log).ToList(); foreach (FreeAuthorizationLog alarm in items) { int row = this.customDataGridview1.Rows.Add(); ShowFreeAuthorizationLogOnRow(this.customDataGridview1.Rows[row], alarm); } } else { MessageBox.Show(result.Message); } }
private void SaveAuthensToPark(List <string> records) { FrmProcessing frmP = new FrmProcessing(); Action action = delegate() { try { int success = 0; int fail = 0; FreeAuthorizationLogBll bll = new FreeAuthorizationLogBll(AppSettings.CurrentSetting.ParkConnect); foreach (string record in records) { Ralid.Park.POS.Model.FreeAuthorizationLog p = Ralid.Park.POS.Model.FreeAuthorizationLogSerializer.Deserialize(record); if (p != null) { FreeAuthorizationLog item = CreateFrom(p); CommandResult ret = bll.InsertRecordWithCheck(item); if (ret.Result == ResultCode.Successful) { success++; } else { fail++; } } else { fail++; } frmP.ShowProgress(string.Format(Resource1.FrmMain_ImportAuthenLog + " " + Resource1.FrmMain_Success + ":{0} " + Resource1.FrmMain_Fail + ":{1} " + Resource1.FrmMain_ImportTotal + ": {2}", success, fail, records.Count), (decimal)(success + fail) / records.Count); } ShowMessage(string.Format(Resource1.FrmMain_ImportAuthenLog + " " + Resource1.FrmMain_Success + ":{0} " + Resource1.FrmMain_Fail + ":{1} " + Resource1.FrmMain_ImportTotal + ": {2}", success, fail, records.Count), Color.Black); } catch (ThreadAbortException) { } catch (Exception ex) { frmP.ShowProgress(ex.Message, 1); ShowMessage(ex.Message, Color.Red); } }; Thread t = new Thread(new ThreadStart(action)); t.Start(); if (frmP.ShowDialog() != DialogResult.OK) { t.Abort(); } }
/// <summary> /// 免费授权 /// </summary> private void FreeAuthorization(CardInfo cardinfo) { bool offlineHandleCard = AppSettings.CurrentSetting.EnableWriteCard && cardinfo != null && !cardinfo.OnlineHandleWhenOfflineMode; CardBll _CardBll = new CardBll(AppSettings.CurrentSetting.ParkConnect); bool success = _CardBll.CardFreeAuthorizationWithStandby(_cardInfo, WorkStationInfo.CurrentStation.HasStandbyDatabase, AppSettings.CurrentSetting.CurrentStandbyConnect).Result == ResultCode.Successful; //写卡模式时需要将授权信息写入卡片扇区,并且只需要写入卡片成功就可以了 if (offlineHandleCard) { success = CardOperationManager.Instance.WriteCardLoop(cardinfo) == CardOperationResultCode.Success; if (!success) { //写入失败时,将数据库的卡片授权信息还原 _CardBll.CardFreeAuthorization(_OriginalCard); if (!string.IsNullOrEmpty(AppSettings.CurrentSetting.CurrentStandbyConnect)) { //还原备用数据库 CardBll standbyCardBll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect); standbyCardBll.CardFreeAuthorization(_OriginalCard); } } } if (success) { //插入授权记录 FreeAuthorizationLog log = CreateFreeAuthorizationLog(_cardInfo); FreeAuthorizationLogBll logBll = new FreeAuthorizationLogBll(AppSettings.CurrentSetting.ParkConnect); logBll.Insert(log); MessageBox.Show(Resource1.FrmHotelAuthorization_Authe + Resource1.Form_Success); ClearInput(); } else { MessageBox.Show(Resource1.FrmHotelAuthorization_Authe + Resource1.Form_Fail); } }