SetRange() private method

private SetRange ( System.DateTime startDate, System.DateTime stopDate ) : void
startDate System.DateTime
stopDate System.DateTime
return void
Exemplo n.º 1
0
 private void DeleteRange()
 {
     if (this.dataSeries.Count == 0L)
     {
         int num1 = (int)MessageBox.Show((IWin32Window)this, "The series is empty.", "", MessageBoxButtons.OK, MessageBoxIcon.None);
     }
     else
     {
         DeleteRangeForm deleteRangeForm = new DeleteRangeForm();
         deleteRangeForm.SetRange(this.dataSeries.DateTime1, this.dataSeries.DateTime2);
         if (deleteRangeForm.ShowDialog((IWin32Window)this) == DialogResult.OK)
         {
             try
             {
                 this.Cursor = Cursors.WaitCursor;
                 if (deleteRangeForm.From > this.dataSeries.DateTime2 || deleteRangeForm.To < this.dataSeries.DateTime1)
                 {
                     int num2 = (int)MessageBox.Show((IWin32Window)this, "No items found with in the specified range.", "", MessageBoxButtons.OK, MessageBoxIcon.None);
                 }
                 int num3 = (int)this.dataSeries.GetIndex(deleteRangeForm.From.AddTicks(-1L), SearchOption.Next);
                 int num4 = (int)this.dataSeries.GetIndex(deleteRangeForm.To.AddTicks(1L), SearchOption.Prev);
                 if (num3 != -1 && num4 != -1 && MessageBox.Show((IWin32Window)this, "Are you sure you want to delete " + (num4 - num3 + 1).ToString() + " items?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     for (int index = num3; index <= num4; ++index)
                     {
                         this.dataSeries.Remove((long)num3);
                     }
                     this.Init();
                     int num5 = (int)MessageBox.Show((IWin32Window)this, (num4 - num3 + 1).ToString() + " items removed successfully", "", MessageBoxButtons.OK, MessageBoxIcon.None);
                 }
                 this.Cursor = Cursors.Default;
             }
             catch
             {
                 this.Cursor = Cursors.Default;
                 int num2 = (int)MessageBox.Show((IWin32Window)this, "An error occuired while searching position. See log file for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
         deleteRangeForm.Dispose();
     }
 }
Exemplo n.º 2
0
 private void DeleteRange()
 {
   if (this.dataSeries.Count == 0L)
   {
     int num1 = (int) MessageBox.Show((IWin32Window) this, "The series is empty.", "", MessageBoxButtons.OK, MessageBoxIcon.None);
   }
   else
   {
     DeleteRangeForm deleteRangeForm = new DeleteRangeForm();
     deleteRangeForm.SetRange(this.dataSeries.DateTime1, this.dataSeries.DateTime2);
     if (deleteRangeForm.ShowDialog((IWin32Window) this) == DialogResult.OK)
     {
       try
       {
         this.Cursor = Cursors.WaitCursor;
         if (deleteRangeForm.From > this.dataSeries.DateTime2 || deleteRangeForm.To < this.dataSeries.DateTime1)
         {
           int num2 = (int) MessageBox.Show((IWin32Window) this, "No items found with in the specified range.", "", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
         int num3 = (int) this.dataSeries.GetIndex(deleteRangeForm.From.AddTicks(-1L), SearchOption.Next);
         int num4 = (int) this.dataSeries.GetIndex(deleteRangeForm.To.AddTicks(1L), SearchOption.Prev);
         if (num3 != -1 && num4 != -1 && MessageBox.Show((IWin32Window) this, "Are you sure you want to delete " + (num4 - num3 + 1).ToString() + " items?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
           for (int index = num3; index <= num4; ++index)
             this.dataSeries.Remove((long) num3);
           this.Init();
           int num5 = (int) MessageBox.Show((IWin32Window) this, (num4 - num3 + 1).ToString() + " items removed successfully", "", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
         this.Cursor = Cursors.Default;
       }
       catch
       {
         this.Cursor = Cursors.Default;
         int num2 = (int) MessageBox.Show((IWin32Window) this, "An error occuired while searching position. See log file for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
       }
     }
     deleteRangeForm.Dispose();
   }
 }