public int UpdateEventoZona(ZonaEventoBE obj) { try { using (SqlConnection connection = new SqlConnection(cadena)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("pr_UpdateEventoZona", connection)) { cmd.Parameters.AddWithValue("@eventoid", obj.eventoid); cmd.Parameters.AddWithValue("@zona", obj.zona); cmd.Parameters.AddWithValue("@precio", obj.precio); cmd.Parameters.AddWithValue("@cantidadMax", obj.cantidadMax); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); connection.Close(); return(1); } } } catch (Exception ex) { return(0); } }
public void CargarZona() { List <ZonaEventoBE> lista = new List <ZonaEventoBE>(); int cantidad = 0; for (int i = 0; i < 5; i++) { ZonaEventoBE obj = new ZonaEventoBE(); cantidad = cantidad + 1; obj.num = cantidad; lista.Add(obj); } gZona.DataSource = lista; gZona.DataBind(); }
public void CargarZona() { List <ZonaEventoBE> lista = new List <ZonaEventoBE>(); lista = iZonaEvento.ObtenerEventoZona(eventoid); if (lista.Count < 5) { for (int i = lista.Count; i < 5; i++) { ZonaEventoBE obj = new ZonaEventoBE(); obj.num = i + 1; lista.Add(obj); } } gZona.DataSource = lista; gZona.DataBind(); }
public List <ZonaEventoBE> ObtenerEventoZona(int eventoid) { try { List <ZonaEventoBE> resultado = new List <ZonaEventoBE>(); using (SqlConnection connection = new SqlConnection(cadena)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("pr_ObtenerEventoZona", connection)) { cmd.Parameters.Add("@eventoid", SqlDbType.VarChar).Value = eventoid; cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.HasRows) { while (dr.Read()) { ZonaEventoBE entidad = new ZonaEventoBE(); entidad.num = dr.GetInt32(0); entidad.zona = dr.GetString(1); entidad.precio = dr.GetDecimal(2); entidad.cantidadMax = dr.GetInt32(3); resultado.Add(entidad); } } dr.Dispose(); } } connection.Close(); return(resultado); } } catch (Exception ex) { } return(null); }
public int UpdateEventoZona(ZonaEventoBE obj) { return(interfac.UpdateEventoZona(obj)); }
public int InsertEventoZona(ZonaEventoBE obj) { return(interfac.InsertEventoZona(obj)); }
protected void btnGrabar_Click(object sender, EventArgs e) { // Read the file and convert it to Byte Array string filename = Path.GetFileName(FileUpload1.PostedFile.FileName); string contentType = FileUpload1.PostedFile.ContentType; //string filePath = FileUpload1.PostedFile.FileName; //string filename2 = Path.GetFileName(filePath); string ext = Path.GetExtension(filename); string contenttype = String.Empty; //Set the contenttype based on File Extension switch (ext) { case ".jpg": contenttype = "image/jpg"; break; case ".png": contenttype = "image/png"; break; case ".gif": contenttype = "image/gif"; break; } Stream fs = FileUpload1.PostedFile.InputStream; BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); EventoBE obj = new EventoBE(); obj.titulo = txtTitulo.Text; obj.descripcion = txtDescripcion.Text; obj.descripcionAdicional = txtDescripcionAdicional.Text; obj.categoriaid = Convert.ToInt32(string.IsNullOrEmpty(cboCategoria.SelectedValue) ? "-1" : cboCategoria.SelectedValue); obj.RutaImagen = bytes; obj.fechaInicio = Convert.ToDateTime(txtFechaInicio.Text); obj.fechaFin = Convert.ToDateTime(txtFechaFin.Text); obj.estado = 1; obj.usuarioCreacion = -1; obj.usuarioActualiza = -1; int resultado; resultado = iEvento.InsertEvento(obj); if (resultado != 0) { foreach (GridViewRow row in gZona.Rows) { TextBox vzona = (TextBox)row.FindControl("txtZona"); TextBox vprecio = (TextBox)row.FindControl("txtPrecio"); TextBox vcantidad = (TextBox)row.FindControl("txtCantidad"); if (vzona.Text != "" && vprecio.Text != "" && vcantidad.Text != "") { ZonaEventoBE obj2 = new ZonaEventoBE(); obj2.eventoid = resultado; obj2.zona = vzona.Text; obj2.precio = Convert.ToDecimal(vprecio.Text); obj2.cantidadMax = Convert.ToInt32(vcantidad.Text); iZonaEvento.InsertEventoZona(obj2); } } Response.Redirect("ListarEvento.aspx?descripcionAdicional=" + ""); } }