Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)            //Primera carga de la página
     {
         string Id = Request.QueryString["Id"];
         if ((string.IsNullOrEmpty(Id)) || (!IsNumeric(Id)))
         {
             Response.Redirect("ListaChoferes.aspx");
         }
         else
         {
             ChoferVO Chofer = BLLChofer.GetChoferById(int.Parse(Id));
             if (Chofer.IdChofer == int.Parse(Id))
             {
                 lblIdChofer.Text          = Chofer.IdChofer.ToString();
                 txtNombre.Text            = Chofer.Nombre;
                 txtApPaterno.Text         = Chofer.ApPaterno.ToString();
                 txtApMaterno.Text         = Chofer.ApMaterno.ToString();
                 txtTelefono.Text          = Chofer.Telefono.ToString();
                 inFechaNacimiento.Value   = Chofer.FechaNacimiento.ToString();
                 txtLicencia.Text          = Chofer.Licencia.ToString();
                 imgFotoChofer.ImageUrl    = Chofer.Urlfoto;
                 UrlFoto.InnerText         = Chofer.Urlfoto;
                 chkDisponibilidad.Checked = Chofer.Disponibilidad;
             }
             else
             {
                 Response.Redirect("ListaChoferes.aspx");
             }
         }
     }
 }
Пример #2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                int      IdChofer        = int.Parse(lblIdChofer.Text);
                string   Nombre          = txtNombre.Text;
                string   ApPaterno       = txtApPaterno.Text;
                string   ApMaterno       = txtApMaterno.Text;
                string   Telefono        = txtTelefono.Text;
                DateTime FechaNacimiento = DateTime.Parse(inFechaNacimiento.Value);
                string   Licencia        = txtLicencia.Text;
                string   urlFoto         = UrlFoto.InnerText;
                bool     Dispobilidad    = chkDisponibilidad.Checked;

                string Resultado = BLLChofer.UpdChofer(IdChofer, Nombre, ApPaterno, ApMaterno, Telefono, FechaNacimiento, Licencia, Dispobilidad, urlFoto);

                if (Resultado.IndexOf("Chofer Actualizado") > -1)
                {
                    Util.Library.UtilControls.SweetBoxConfirm("OK!", Resultado, "success", "/Catalogos/Choferes/ListaChoferes.aspx", this.Page, this.GetType());
                }
                else
                {
                    Util.Library.UtilControls.SweetBox("Atención!", Resultado, "warning", this.Page, this.GetType());
                }
            }
            catch (Exception ex)
            {
                Util.Library.UtilControls.SweetBox("ERROR!", ex.Message, "danger", this.Page, this.GetType());
            }
        }
Пример #3
0
 protected void GVChoferes_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         string IdChofer  = GVChoferes.DataKeys[e.RowIndex].Values["IdChofer"].ToString();
         string Resultado = BLLChofer.DelChofer(int.Parse(IdChofer));
         RecargarGrid();
         string msj   = "";
         string clase = "";
         if (Resultado == "Chofer Eliminado")
         {
             msj   = "Ok";
             clase = "success";
         }
         else
         {
             msj   = "Atención!";
             clase = "danger";
         }
         //Creamos el log de borrado
         string[] args = new string[3];
         args[0] = msj;
         args[1] = Resultado;                // sub;
         args[2] = DateTime.Now.ToShortDateString();
         WriteLog(args);
         Util.Library.UtilControls.SweetBox(msj, Resultado, clase, this.Page, this.GetType());
     }
     catch (Exception ex)
     {
         Util.Library.UtilControls.SweetBox("Error!", ex.Message, "danger", this.Page, this.GetType());
     }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Llenamos los combos de camión y chofer
         UtilControls.FillDropDownList(DDLChofer, "IdChofer", "Nombre", BLLChofer.GetChoferes(true), "", "Selecciona Chofer");
         UtilControls.FillDropDownList(DDLCamion, "IdCamion", "Matricula", BLLCamiones.GetlistCamiones(true), "", "Selecciona Camión");
         Session["CargaRuta"] = null;
     }
 }
Пример #5
0
        protected void GVChoferes_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string   IdChofer        = GVChoferes.DataKeys[e.RowIndex].Values["IdChofer"].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();
            DateTime FechaNacimiento = DateTime.Parse(e.NewValues["FechaNacimiento"].ToString());
            string   Licencia        = e.NewValues["Licencia"].ToString();
            bool     Disponibilidad  = bool.Parse(e.NewValues["Disponibilidad"].ToString());

            try
            {
                string Resultado = BLLChofer.UpdChofer(int.Parse(IdChofer), Nombre, ApPaterno, ApMaterno, Telefono, FechaNacimiento, Licencia, Disponibilidad, null);
                GVChoferes.EditIndex = -1;
                RecargarGrid();
                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());
            }
        }
Пример #6
0
 private void RecargarGrid()
 {
     GVChoferes.DataSource = BLLChofer.GetChoferes(null);
     GVChoferes.DataBind();
 }