protected void EliminarButton_Click(object sender, EventArgs e) { EventosClass Evento = new EventosClass(); try { ObtenerDatos(Evento); if (Evento.Buscar(Evento.EventoId)) { if (Evento.Eliminar()) { Limpiar(); EliminarButton.Visible = false; GuardarButton.Text = "Guardar"; Utilities.ShowToastr(this, "bien", "Se elimino con exito!", "success"); } else { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } } } catch (Exception) { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } }
private bool ObtenerDatos(EventosClass Evento) { bool Retorno = true; int id = Utilities.intConvertir(EventoIdTextBox.Text); int tipoEventoid = Utilities.intConvertir(TipoEventoIdDropDownList.SelectedValue); if (id > 0) { Evento.EventoId = id; } else { Retorno = false; } if (tipoEventoid > 0) { Evento.TipoEventoId = tipoEventoid; } else { Retorno = false; } if (NombreEventoTextBox.Text.Length > 0) { Evento.NombreEvento = NombreEventoTextBox.Text; } else { Retorno = false; } if (FechaEventoTextBox.Text.Length > 0) { Evento.FechaEvento = FechaEventoTextBox.Text; } else { Retorno = false; } if (LugarEventoTextBox.Text.Length > 0) { Evento.LugarEvento = LugarEventoTextBox.Text; Evento.Imagen = Imagen.ImageUrl; } else { Retorno = false; } if (EventosGridView.Rows.Count > 0) { foreach (GridViewRow var in EventosGridView.Rows) { Evento.AgregarTickets(var.Cells[0].Text, Convert.ToInt32(var.Cells[1].Text), Convert.ToInt32(var.Cells[2].Text)); } } else { Retorno = false; } return(Retorno); }
private string Buscar(EventosClass Evento) { string filtro = ""; if (!FechaCheckBox.Checked) { if (string.IsNullOrWhiteSpace(BuscarTextBox.Text)) { filtro = "1=1"; } else { if (CamposDropDownList.SelectedIndex == 0) { filtro = "VentaId = " + BuscarTextBox.Text; } else { filtro = CamposDropDownList.SelectedValue + " like '%" + BuscarTextBox.Text + "%'"; } } ConsultaGridView.DataSource = Evento.Listado("*", filtro, ""); ConsultaGridView.DataBind(); } else { filtro = "Fecha between '" + DesdeTextBox.Text + "' and '" + HastaTextBox.Text + "'"; ConsultaGridView.DataSource = Evento.Listado("*", filtro, ""); ConsultaGridView.DataBind(); } return(filtro); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EventosClass Evento = new EventosClass(); DataList1.DataSource = Evento.Dat(); DataList1.DataBind(); } }
private void CargarDropDownList() { EventosClass Evento = new EventosClass(); EventoDropDownList.DataSource = Evento.Listado(" * ", "1=1", ""); EventoDropDownList.DataTextField = "NombreEvento"; EventoDropDownList.DataValueField = "EventoId"; EventoDropDownList.DataBind(); }
private void Reportes(ReportViewer rv) { rv.LocalReport.DataSources.Clear(); rv.ProcessingMode = ProcessingMode.Local; rv.LocalReport.ReportPath = @"Reportes\EventosReport.rdlc"; ReportDataSource sourse = new ReportDataSource("EventosDataset", EventosClass.ListadoDt("1=1")); rv.LocalReport.DataSources.Add(sourse); rv.LocalReport.Refresh(); }
protected void ImagenButton_Click(object sender, EventArgs e) { EventosClass Evento = new EventosClass(); Evento.Imagen = "/Flayers/" + ImagenFileUpload.FileName; ImagenFileUpload.SaveAs(Server.MapPath("/Flayers/" + ImagenFileUpload.FileName)); if (ImagenFileUpload.HasFile) { Imagen.ImageUrl = "/Flayers/" + ImagenFileUpload.FileName; } }
private void ObtenerDatos(EventosClass Evento) { Evento.EventoId = Utilities.intConvertir(EventoIdTextBox.Text); Evento.TipoEventoId = Utilities.intConvertir(TipoEventoIdDropDownList.SelectedValue); Evento.NombreEvento = NombreEventoTextBox.Text; Evento.FechaEvento = FechaEventoTextBox.Text; Evento.LugarEvento = LugarEventoTextBox.Text; Evento.Imagen = Imagen.ImageUrl; foreach (GridViewRow var in EventosGridView.Rows) { Evento.AgregarTickets(var.Cells[0].Text, Convert.ToInt32(var.Cells[1].Text), Convert.ToInt32(var.Cells[2].Text)); } }
public void DevolverDatos(EventosClass Evento) { DataTable dt = new DataTable(); EventoIdTextBox.Text = Evento.EventoId.ToString(); NombreEventoTextBox.Text = Evento.NombreEvento.ToString(); FechaEventoTextBox.Text = Evento.FechaEvento.ToString(); LugarEventoTextBox.Text = Evento.LugarEvento.ToString(); Imagen.ImageUrl = Evento.Imagen; foreach (var item in Evento.Detalle) { dt = (DataTable)ViewState["EventosClass"]; dt.Rows.Add(item.DescTicket, item.CantDisponible, item.PrecioTicket); ViewState["EventosClass"] = dt; EventosGridView.DataSource = (DataTable)ViewState["EventosClass"]; EventosGridView.DataBind(); } }
protected void GuardarButton_Click(object sender, EventArgs e) { EventosClass Evento = new EventosClass(); if (Evento.UnicoEvento(NombreEventoTextBox.Text)) { Utilities.ShowToastr(this, "error", "Ese evento ya existe!", "error"); NombreEventoTextBox.Text = string.Empty; } else { if (string.IsNullOrWhiteSpace(EventoIdTextBox.Text)) { ObtenerDatos(Evento); if (Evento.Insertar()) { Limpiar(); Utilities.ShowToastr(this, "bien", "Se guardo con exito!", "success"); } else { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } } if (EventoIdTextBox.Text.Length > 0) { ObtenerDatos(Evento); if (Evento.Editar()) { Limpiar(); EliminarButton.Visible = false; GuardarButton.Text = "Guardar"; Utilities.ShowToastr(this, "bien", "Se modifico con exito!", "success"); } else { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CargarDropDownList(); CargarGridView(); EliminarButton.Visible = false; EventosClass Evento = new EventosClass(); int Id = 0; if (Request.QueryString["ID"] != null) { Id = Utilities.intConvertir(Request.QueryString["ID"].ToString()); if (Evento.Buscar(Id)) { if (EventosGridView.Rows.Count == 0) { DevolverDatos(Evento); } } } } }
protected void BuscarButton_Click(object sender, EventArgs e) { EventosClass Evento = new EventosClass(); int id = Utilities.intConvertir(EventoIdTextBox.Text); if (id < 0) { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } else { if (Evento.Buscar(id)) { EliminarButton.Visible = true; GuardarButton.Text = "Modificar"; DevolverDatos(Evento); } else { Utilities.ShowToastr(this, "error", "Mensaje", "error"); } } }
private void CargarDropDownList() { UsuariosClass Usuario = new UsuariosClass(); UsuarioIdDropDownList.DataSource = Usuario.Listado(" * ", "1=1", ""); UsuarioIdDropDownList.DataTextField = "NombreUsuario"; UsuarioIdDropDownList.DataValueField = "UsuarioId"; UsuarioIdDropDownList.DataBind(); EventosClass Evento = new EventosClass(); EventoDropDownList.DataSource = Evento.Listado(" * ", "1=1", ""); EventoDropDownList.DataTextField = "NombreEvento"; EventoDropDownList.DataValueField = "EventoId"; EventoDropDownList.DataBind(); EventosDetalleClass Ticket = new EventosDetalleClass(); TicketDropDownList.DataSource = Ticket.Listado(" * ", "1=1", ""); TicketDropDownList.DataTextField = "DescTicket"; TicketDropDownList.DataValueField = "PrecioTicket"; TicketDropDownList.DataBind(); }
private void VentasForm_Load(object sender, EventArgs e) { EventosClass evento = new EventosClass(); EventocomboBox.DataSource = evento.Listado("*", "1=1", ""); EventocomboBox.DisplayMember = "NombreEvento"; EventocomboBox.ValueMember = "EventoId"; FechadateTimePicker.Enabled = false; Eliminarbutton.Enabled = false; EventosDetalleClass det = new EventosDetalleClass(); TicketcomboBox.DataSource = det.Listado("*", "1=1", ""); TicketcomboBox.DisplayMember = "Descripcion"; TicketcomboBox.ValueMember = "PrecioTicket"; UsuariosClass usuario = new UsuariosClass(); UsuarioscomboBox.DataSource = usuario.Listado("*", "1=1", ""); UsuarioscomboBox.DisplayMember = "NombreUsuario"; UsuarioscomboBox.ValueMember = "UsuarioId"; }
protected void BuscarButton_Click(object sender, EventArgs e) { EventosClass Evento = new EventosClass(); Buscar(Evento); }