예제 #1
0
        private int SpeedingProcess()
        {
            int           processCount    = 0;
            CommandResult result          = null;
            OperatorInfo  processOperator = OperatorInfo.CurrentOperator;
            string        processMemo     = this.txtDealMemo.Text.Trim();

            SpeedingRecordBll bll = new SpeedingRecordBll(AppSettings.CurrentSetting.ParkConnect);

            DataGridViewRow[] rows = new DataGridViewRow[this.dgvSpeedingRecord.Rows.Count];
            this.dgvSpeedingRecord.Rows.CopyTo(rows, 0);
            foreach (DataGridViewRow row in rows)
            {
                SpeedingRecord record = row.Tag as SpeedingRecord;
                if (record != null)
                {
                    result = bll.SpeedingProcessing(record, processOperator, DateTime.Now, processMemo);
                    if (result.Result == ResultCode.Successful)
                    {
                        processCount++;
                        this.dgvSpeedingRecord.Rows.Remove(row);
                    }
                }
            }
            return(processCount);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 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);
 }
예제 #4
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);
 }
예제 #5
0
 private void ShowSpeedingRecordOnGrid(DataGridViewRow row, SpeedingRecord record)
 {
     row.Tag = record;
     row.Cells["colSpeedingDateTime"].Value = record.SpeedingDateTime.ToString("yyyy-MM-dd HH:mm:ss");
     row.Cells["colSpeed"].Value            = record.Speed;
     row.Cells["colPlace"].Value            = record.Place;
     row.Cells["colMemo"].Value             = record.Memo;
 }
예제 #6
0
 private void ShowSpeedingRecordOnRow(DataGridViewRow row, SpeedingRecord info)
 {
     row.Tag = info;
     row.Cells["colSpeedingDateTime"].Value = info.SpeedingDateTime.ToString("yyyy-MM-dd HH:mm:ss");
     row.Cells["colPlateNumber"].Value      = info.PlateNumber;
     row.Cells["colPlace"].Value            = info.Place;
     row.Cells["colSpeed"].Value            = info.Speed;
     row.Cells["colMemo"].Value             = info.Memo;
 }
예제 #7
0
        /// <summary>
        /// 修改未处理超速记录
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public CommandResult Update(SpeedingRecord info)
        {
            SpeedingRecord original = GetByID(info.SpeedingID).QueryObject;

            if (original != null)
            {
                return(provider.Update(info, original));
            }
            else
            {
                return(new CommandResult(ResultCode.NoRecord));
            }
        }
예제 #8
0
        private void dgvSpeeding_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = this.dgvSpeeding.Rows[e.RowIndex];

            if (row != null)
            {
                SpeedingRecord record = row.Tag as SpeedingRecord;
                if (record != null)
                {
                    //this.pbPhoto.ImageLocation = record.Photo;
                    this.pbPhoto.LoadAsync(record.Photo);
                }
            }
        }
예제 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            SpeedingRecord info = new SpeedingRecord();

            info.SpeedingID       = Guid.NewGuid();
            info.SpeedingDateTime = DateTime.Now;
            info.PlateNumber      = "粤A123ab";
            info.Place            = "A区监测点";
            info.Speed            = "100";
            info.Photo            = @"http://wenwen.soso.com/p/20101016/20101016200301-1077351978.jpg";
            info.Memo             = "逆行";


            SpeedingRecord info1 = new SpeedingRecord();

            info1.SpeedingID       = Guid.NewGuid();
            info1.SpeedingDateTime = DateTime.Now;
            info1.PlateNumber      = "粤A456ab";
            info1.Place            = "B区测速点";
            info1.Speed            = "150";
            info1.Photo            = @"http://img2.duitang.com/uploads/item/201209/20/20120920165508_EuenZ.jpeg";
            info1.Memo             = "超速";

            SpeedingRecordBll bll    = new SpeedingRecordBll(AppSettings.CurrentSetting.ParkConnect);
            CommandResult     result = bll.Insert(info);

            if (result.Result != ResultCode.Successful)
            {
                MessageBox.Show(result.Message);
            }
            else
            {
                MessageBox.Show(result.Result.ToString());
            }
            result = bll.Insert(info1);
            if (result.Result != ResultCode.Successful)
            {
                MessageBox.Show(result.Message);
            }
            else
            {
                MessageBox.Show(result.Result.ToString());
            }
        }
예제 #10
0
        /// <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));
        }
예제 #11
0
 /// <summary>
 /// 增加未处理超速记录
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public CommandResult Insert(SpeedingRecord info)
 {
     return(provider.Insert(info));
 }
예제 #12
0
 /// <summary>
 /// 删除未处理超速记录
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 /// <exception cref=" "></exception>
 public CommandResult Delete(SpeedingRecord info)
 {
     return(provider.Delete(info));
 }