protected void Btn_Aceptar_Click(object sender, EventArgs e) { string idSoliMate = this.Txt_idSoli.Text.Replace(";", "").Replace("--", ""); int empleado = Convert.ToInt32(Session["id"].ToString()); string fecha = this.Cld_fecha.SelectedDate.ToString(); string articulo = this.Lstbx_articulo.Text; string descripcion = this.Txt_descripcionProblema.Text.Replace(";", "").Replace("--", ""); string tipo = this.Txt_tipoUso.Text.Replace(";", "").Replace("--", ""); int cantidad = Convert.ToInt32(this.Txt_cantidad.Text.Replace(";", "").Replace("--", "")); SolicitudMaterial soliMate = new SolicitudMaterial(idSoliMate,empleado,fecha,articulo,descripcion,tipo,cantidad); try { SolicitudMaterialDAO.Ingresar_Solicitud(soliMate); SolicitudMaterialDAO.Ingresar_Detalle(soliMate); this.Ltl_Mensaje.Text = @"<div class='alert alert-success'> <strong>Enviado!</strong> Esperamos atender tu solicitud pronto. </div>"; VaciarCampos(); } catch(Exception ex){ this.Ltl_Mensaje.Text = @"<div class='alert alert-danger'> <strong>Error!</strong> " + ex.Message.ToString() + "</div>"; } }
public static void Ingresar_Solicitud(SolicitudMaterial soliMate) { string sql = @"exec pa_solicitar_Material @id, @empleado, @fecha"; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TribunalesDB2ConnectionString"].ToString())) { conn.Open(); SqlCommand command = new SqlCommand(sql, conn); command.Parameters.AddWithValue("@id", soliMate.IdSoliMate); command.Parameters.AddWithValue("@empleado", soliMate.Empleado); command.Parameters.AddWithValue("@fecha", soliMate.Fecha); command.ExecuteNonQuery(); } }
public static void Ingresar_Detalle(SolicitudMaterial soliMate) { string sql = @"exec pa_detallar_Solicitud @id, @articulo, @descripcion, @tipo, @cantidad"; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TribunalesDB2ConnectionString"].ToString())) { conn.Open(); SqlCommand command = new SqlCommand(sql, conn); command.Parameters.AddWithValue("@id", soliMate.IdSoliMate); command.Parameters.AddWithValue("@articulo", soliMate.Articulo); command.Parameters.AddWithValue("@descripcion", soliMate.Descripcion); command.Parameters.AddWithValue("@tipo", soliMate.Tipo); command.Parameters.AddWithValue("@cantidad", soliMate.Cantidad); command.ExecuteNonQuery(); } }