private void dgvSpeedingRecord_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex >= 0) { _EventIndex = e.RowIndex; string path = string.Empty; if (this.GridView.Rows[e.RowIndex].Tag is SpeedingRecord) { SpeedingRecord info = this.GridView.Rows[e.RowIndex].Tag as SpeedingRecord; path = info.Photo; } else if (this.GridView.Rows[e.RowIndex].Tag is SpeedingLog) { SpeedingLog info = this.GridView.Rows[e.RowIndex].Tag as SpeedingLog; path = info.Photo; } FrmPhotoViewer frm = new FrmPhotoViewer(); frm.PreRecord += new RecordPositionEventHandler(frm_PreRecord); frm.NextRecord += new RecordPositionEventHandler(frm_NextRecord); frm.ShowImage(path); frm.ShowDialog(); frm.PreRecord -= new RecordPositionEventHandler(frm_PreRecord); frm.NextRecord -= new RecordPositionEventHandler(frm_NextRecord); } }
private void frm_PreRecord(object sender, RecordPositionEventArgs e) { if (_EventIndex > 0) { this.GridView.Rows[_EventIndex].Selected = false; _EventIndex--; this.GridView.Rows[_EventIndex].Selected = true; if (_EventIndex < this.GridView.FirstDisplayedScrollingRowIndex) { if (this.GridView.FirstDisplayedScrollingRowIndex >= this.GridView.DisplayedRowCount(false)) { this.GridView.FirstDisplayedScrollingRowIndex -= this.GridView.DisplayedRowCount(false); } else { this.GridView.FirstDisplayedScrollingRowIndex = 0; } } string path = string.Empty; if (this.GridView.Rows[_EventIndex].Tag is SpeedingRecord) { SpeedingRecord info = this.GridView.Rows[_EventIndex].Tag as SpeedingRecord; path = info.Photo; } else if (this.GridView.Rows[_EventIndex].Tag is SpeedingLog) { SpeedingLog info = this.GridView.Rows[_EventIndex].Tag as SpeedingLog; path = info.Photo; } FrmPhotoViewer frm = sender as FrmPhotoViewer; frm.ShowImage(path); } e.IsTopRecord = (_EventIndex == 0); }
private void frm_NextRecord(object sender, RecordPositionEventArgs e) { if (_EventIndex < this.GridView.Rows.Count - 1) { this.GridView.Rows[_EventIndex].Selected = false; _EventIndex++; this.GridView.Rows[_EventIndex].Selected = true; if (_EventIndex > this.GridView.FirstDisplayedScrollingRowIndex + this.GridView.DisplayedRowCount(false) - 1) { this.GridView.FirstDisplayedScrollingRowIndex += this.GridView.DisplayedRowCount(false); } string path = string.Empty; if (this.GridView.Rows[_EventIndex].Tag is SpeedingRecord) { SpeedingRecord info = this.GridView.Rows[_EventIndex].Tag as SpeedingRecord; path = info.Photo; } else if (this.GridView.Rows[_EventIndex].Tag is SpeedingLog) { SpeedingLog info = this.GridView.Rows[_EventIndex].Tag as SpeedingLog; path = info.Photo; } FrmPhotoViewer frm = sender as FrmPhotoViewer; frm.ShowImage(path); } e.IsButtonRecord = (_EventIndex == GridView.Rows.Count - 1); }
private void ShowSpeedingLogOnRow(DataGridViewRow row, SpeedingLog info) { row.Tag = info; row.Cells["colLSpeedingDateTime"].Value = info.SpeedingDateTime.ToString("yyyy-MM-dd HH:mm:ss"); row.Cells["colLPlateNumber"].Value = info.PlateNumber; row.Cells["colLPlace"].Value = info.Place; row.Cells["colLSpeed"].Value = info.Speed; row.Cells["colLMemo"].Value = info.Memo; row.Cells["colLDealDateTime"].Value = info.DealDateTime.HasValue ? info.DealDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty; row.Cells["colLDealOperator"].Value = info.DealOperator != null ? info.DealOperator.OperatorName : info.DealOperatorID; row.Cells["colLDealMemo"].Value = info.DealMemo; }
/// <summary> /// 修改未处理超速记录 /// </summary> /// <param name="info"></param> /// <returns></returns> public CommandResult Update(SpeedingLog info) { SpeedingLog original = GetByID(info.SpeedingID).QueryObject; if (original != null) { return(provider.Update(info, original)); } else { return(new CommandResult(ResultCode.NoRecord)); } }
/// <summary> /// 处理超速记录 /// </summary> /// <param name="info">未处理的超速记录</param> /// <param name="operatorInfo">处理人员</param> /// <param name="dateTime">处理时间</param> /// <param name="memo">处理备注信息</param> /// <returns></returns> public CommandResult SpeedingProcessing(SpeedingRecord info, OperatorInfo operatorInfo, DateTime dateTime, string memo) { if (info != null) { SpeedingLog log = new SpeedingLog(); log.SpeedingID = info.SpeedingID; log.SpeedingDateTime = info.SpeedingDateTime; log.PlateNumber = info.PlateNumber; log.Place = info.Place; log.Speed = info.Speed; log.Photo = info.Photo; log.Memo = info.Memo; log.DealOperatorID = operatorInfo.OperatorID; log.DealDateTime = dateTime; log.DealMemo = memo; IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(_repoUri); ISpeedingLogProvider ilProvider = ProviderFactory.Create <ISpeedingLogProvider>(_repoUri); ilProvider.Insert(log, unitWork); provider.Delete(info, unitWork); return(unitWork.Commit()); } return(new CommandResult(ResultCode.NoRecord)); }
/// <summary> /// 增加已处理超速记录 /// </summary> /// <param name="info"></param> /// <returns></returns> public CommandResult Insert(SpeedingLog info) { return(provider.Insert(info)); }
/// <summary> /// 删除未处理超速记录 /// </summary> /// <param name="info"></param> /// <returns></returns> /// <exception cref=" "></exception> public CommandResult Delete(SpeedingLog info) { return(provider.Delete(info)); }