Guest User

Untitled

a guest
May 26th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.56 KB | None | 0 0
  1. protected void btnLOU_Click(object sender, EventArgs e)
  2.         {
  3.             this.purge();
  4.             using (SqlConnection connection = new SqlConnection(GetConnectionInfo()))
  5.             {
  6.                 SqlCommand command;
  7.                 SqlCommand command2;
  8.                 SqlCommand command3;
  9.                 update = false;
  10.                 connection.Open();
  11.  
  12.                 using (command3 = new SqlCommand("SELECT Fraction FROM ReserveNumbers", connection))
  13.                 {
  14.                     this.cbInitialReservesRequested.Items.Clear();
  15.                     this.cbInitialReservesRequested.Items.Add(" ");
  16.  
  17.                     SqlDataReader reader = command3.ExecuteReader();
  18.                     while (reader.Read())
  19.                     {
  20.                         this.cbInitialReservesRequested.Items.Add(reader.GetValue(0).ToString());
  21.                     }
  22.                      
  23.                     reader.Close();
  24.                 }
  25.  
  26.                 using (command = new SqlCommand("SELECT MAX(RecordNumber) FROM LossOfUnit", connection))
  27.                 {
  28.                     SqlDataReader reader = command.ExecuteReader();
  29.                     while (reader.Read())
  30.                     {
  31.                         recordID = int.Parse(reader.GetValue(0).ToString()) + 1;
  32.                     }
  33.                     reader.Close();
  34.                 }
  35.  
  36.  
  37.                 if (!base.IsPostBack)
  38.                 {
  39.                     using (command2 = command = new SqlCommand(string.Format("DELETE FROM ReserveRecords WHERE AssociatedLossOfUnitRecord={0}", recordID), connection))
  40.                     {
  41.                         command.ExecuteNonQuery();
  42.                     }
  43.                 }
  44.                
  45.                
  46.                 this.FTMSGV.SelectCommand = string.Format("SELECT [Participant], [Fraction], convert(CHAR(5), ReqTime, 8) AS ReqTime, [FMPP], [FPL], [GVL], [JEA], [HST], [NSB], [PEF], [RCI], [SEC], [TEC], [TAL], [FRCC], [FRSG], [RecordNumber] FROM [ReserveRecords] WHERE [AssociatedLossOfUnitRecord] = {0}", recordID);
  47.                 this.FTMSGV.DataBind();
  48.                 this.gvReserveRecords.DataBind();
  49.             }
  50.  
  51.  
  52.             this.pnlForm.Visible = true;
  53.             this.txtSubmit.Visible = true;
  54.             this.pnlGrid.Visible = false;
  55.             this.lblError.Visible = false;
  56.             this.lblError.Text = null;
  57.             this.lblInitialReservesRequested.Text = null;
  58.             this.lblInitialReservesRequested.Visible = false;
  59.             this.cbInitialReservesRequested.Visible = true;
  60.  
  61.         }
Add Comment
Please, Sign In to add comment