Exemplo n.º 1
0
        protected void btInsert_Click(object sender, EventArgs e)
        {
            SqlCommand   command = new SqlCommand("", DBConnection.connection);
            int          orderID;
            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.Fired_Order_Insert(tbReason.Text, Convert.ToInt32(ddlEmployee.SelectedValue.ToString()), date);
            command.CommandType = System.Data.CommandType.Text;
            command.CommandText = "SELECT MAX(ID_Fired_Order) FROM [Fired_Order]";
            DBConnection.connection.Open();
            orderID = Convert.ToInt32(command.ExecuteScalar().ToString());
            command.ExecuteNonQuery();
            DBConnection.connection.Close();
            dBProcedures.File_Insert(Convert.ToInt32(ddlEmployee.SelectedValue.ToString()), orderID);
            gvFill(QR);
            DeleteDate();
        }