protected void btnGuardar_Click(object sender, EventArgs e) { try { int IdCliente = int.Parse(lblIdCliente.Text); string Nombre = txtNombre.Text; string ApPaterno = txtApPaterno.Text; string ApMaterno = txtApMaterno.Text; string Telefono = txtTelefono.Text; string Correo = txtCorreo.Text; string urlfoto = UrlFoto.InnerText; bool Disponibilidad = chkDisponibilidad.Checked; string Resultado = BLLClientes.UpdCliente(IdCliente, Nombre, ApPaterno, ApMaterno, Telefono, Correo, urlfoto, Disponibilidad); if (Resultado.IndexOf("Cliente actualizado correctamente") > -1) { Util.Library.UtilControls.SweetBoxConfirm("OK!", Resultado, "success", "ListaClientes.aspx", this.Page, this.GetType()); } else { //Mensaje de error Util.Library.UtilControls.SweetBox("Atención!", Resultado, "warning", this.Page, this.GetType()); } } catch (Exception ex) { //Enviar mensaje de error Util.Library.UtilControls.SweetBox("ERROR!", ex.Message, "danger", this.Page, this.GetType()); } } // del btnGuardar_Click
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) //Primera carga de la página { //Obtenemos la información del Camión seleccionado string Id = Request.QueryString["Id"]; if ((Id == null) || (!IsNumeric(Id))) { Response.Redirect("ListaClientes.aspx"); } else { //Verificamos que el camion exista ClientesVO Cliente = BLLClientes.GetClienteById(int.Parse(Id)); if (Cliente.IdCliente == int.Parse(Id)) { //Desplegamos la información del camion lblIdCliente.Text = Cliente.IdCliente.ToString(); txtNombre.Text = Cliente.Nombre; txtApPaterno.Text = Cliente.ApPaterno; txtApMaterno.Text = Cliente.ApMaterno; txtTelefono.Text = Cliente.Telefono; txtCorreo.Text = Cliente.Correo; UrlFoto.InnerText = Cliente.UrlFoto; chkDisponibilidad.Checked = Cliente.Disponibilidad; } else { Response.Redirect("ListaClientes.aspx"); } } } }
protected void GVClientes_RowUpdating(object sender, GridViewUpdateEventArgs e) { string IdCliente = GVClientes.DataKeys[e.RowIndex].Values["IdCliente"].ToString(); string Nombre = e.NewValues["Nombre"].ToString(); string ApPaterno = e.NewValues["ApPaterno"].ToString(); string ApMaterno = e.NewValues["ApMaterno"].ToString(); string Telefono = e.NewValues["Telefono"].ToString(); string Correo = e.NewValues["Correo"].ToString(); //Disponibilidad CheckBox ChkAux = (CheckBox)GVClientes.Rows[e.RowIndex].FindControl("ChkEditDisponible"); bool Disponibilidad = ChkAux.Checked; try { string resultado = BLLClientes.UpdCliente(int.Parse(IdCliente), Nombre, ApPaterno, ApMaterno, Telefono, Correo, null, Disponibilidad); GVClientes.EditIndex = -1; RefrescaGrid(); Util.Library.UtilControls.SweetBox(resultado, "", "success", this.Page, this.GetType()); } catch (Exception ex) { Util.Library.UtilControls.SweetBox("ERROR!", ex.Message, "danger", this.Page, this.GetType()); } }// fin metodo
} //btnSubeImagen protected void btnGuardar_Click(object sender, EventArgs e) { try { string Nombre = txtNombre.Text; string ApPaterno = txtApPaterno.Text; string ApMaterno = txtApMaterno.Text; string Telefono = txtTelefono.Text; string Correo = txtCorreo.Text; string urlfoto = UrlFoto.InnerText; string Resultado = BLLClientes.InsCliente(Nombre, ApPaterno, ApMaterno, Telefono, Correo, urlfoto); if (Resultado.IndexOf("Cliente agregado") > -1) { Util.Library.UtilControls.SweetBoxConfirm("OK!", Resultado, "success", "ListaClientes.aspx", this.Page, this.GetType()); } else { //Mensaje de error Util.Library.UtilControls.SweetBox("Atención!", Resultado, "warning", this.Page, this.GetType()); } } catch (Exception ex) { //Enviar mensaje de error Util.Library.UtilControls.SweetBox("ERROR!", ex.Message, "danger", this.Page, this.GetType()); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) // es la primer carga de la pagina { //Llena las lista del formulario Util.Library.UtilControls.EnumToListBox(typeof(Comidas), DDLComidas, true); //Util.Library.UtilControls.EnumToListBox(typeof(Comidas), DDLComidas, false); DDLComidas.Items.Insert(0, new ListItem("Selecciona Comida", "")); DDLComidas.SelectedIndex = 0; //Llenamos los combos de camión y chofer UtilControls.FillDropDownList(DDLTipoEvento, "IdTipoEvento", "Nombre", BLLTipoEventos.GetLstTipoEventos(true), "", "Selecciona Tipo Evento"); UtilControls.FillDropDownList(DDLCliente, "IdCliente", "Nombre", BLLClientes.GetLstClientes(true), "", "Selecciona Cliente"); Session["CargaRuta"] = null; } }
}// fin metodo protected void GVClientes_RowDeleting(object sender, GridViewDeleteEventArgs e) { string IdCliente = GVClientes.DataKeys[e.RowIndex].Values["IdCliente"].ToString(); try { string Resultado = BLLClientes.DelCliente(int.Parse(IdCliente)); string mensaje = ""; //string sub = ""; string clase = ""; if (Resultado == "Cliente eliminado") { mensaje = "OK!"; clase = "success"; //sub = Resultado; } else { mensaje = "Atención!"; clase = "warning"; //sub = Resultado; } //Creamos el log de borrado string[] args = new string[3]; args[0] = mensaje; args[1] = Resultado;// sub; args[2] = DateTime.Now.ToShortDateString(); WriteLog(args); RefrescaGrid(); Util.Library.UtilControls.SweetBox(mensaje, Resultado, clase, this.Page, this.GetType()); } catch (Exception ex) { Util.Library.UtilControls.SweetBox("ERROR!", ex.Message, "danger", this.Page, this.GetType()); } } // fin de metodo
} //del PageLoad private void RefrescaGrid() { //Llenar el grid con una lista de CamionVO GVClientes.DataSource = BLLClientes.GetLstClientes(null); GVClientes.DataBind(); } // del RefrescaGrid