示例#1
0
        protected void btInsert_Click(object sender, EventArgs e)
        {
            int        ArendaID;
            SqlCommand command = new SqlCommand("", DBConnection.connection);

            if (DBConnection.userID == 0)
            {
                Response.Redirect("Authorization.aspx");
            }
            else
            {
                decimal Cost;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = "SELECT (Cena) FROM [Tovari] where [ID_Tovara] = " + Convert.ToInt32(ddlTovari.SelectedValue) + "";
                DBConnection.connection.Open();
                Cost = Convert.ToDecimal(command.ExecuteScalar().ToString());
                command.ExecuteNonQuery();
                DBConnection.connection.Close();
                int          Sum          = Convert.ToInt32(tbKolichestvo.Text) * Convert.ToInt32(Cost);
                string       time         = DateTime.Now.ToString("h:mm");
                DateTime     theDate      = DateTime.ParseExact(tbDate.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                string       date         = theDate.ToString("dd.MM.yyyy");
                DBProcedures dBProcedures = new DBProcedures();
                dBProcedures.Arenda_Insert(Convert.ToInt32(ddlTovari.SelectedValue), Convert.ToInt32(tbKolichestvo.Text), Convert.ToInt32(ddlKlienti.SelectedValue), Convert.ToDecimal(Sum));
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = "SELECT MAX(ID_Order) FROM [Order]";
                DBConnection.connection.Open();
                ArendaID = Convert.ToInt32(command.ExecuteScalar().ToString());
                command.ExecuteNonQuery();
                DBConnection.connection.Close();
                gvFill(QR);
            }
        }
示例#2
0
 protected void gvTovari_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         decimal     Cymma;
         GridViewRow rows = gvTovari.SelectedRow;
         DBConnection.selectedRow = Convert.ToInt32(rows.Cells[1].Text);
         Cymma = Convert.ToDecimal(rows.Cells[4].Text);
         DBProcedures dBProcedures = new DBProcedures();
         dBProcedures.Arenda_Insert(DBConnection.selectedRow, 1, DBConnection.userID, Cymma);
     }
     catch
     {
     }
     finally
     {
         gvFill(QR);
         DBConnection.selectedRow = 0;
     }
 }