protected void GVCamiones_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string IdCamion    = GVCamiones.DataKeys[e.RowIndex].Values["IdCamion"].ToString();
            string Matricula   = e.NewValues["Matricula"].ToString();
            string Modelo      = e.NewValues["Modelo"].ToString();
            string Marca       = e.NewValues["Marca"].ToString();
            int    Capacidad   = Convert.ToInt32(e.NewValues["Capacidad"].ToString());
            float  Kilometraje = float.Parse(e.NewValues["Kilometraje"].ToString());

            DropDownList TipoCamionAux = (DropDownList)GVCamiones.Rows[e.RowIndex].FindControl("DDLTipoCamion");
            string       Tipocamion    = TipoCamionAux.SelectedValue;

            bool Disponibilidad = bool.Parse(e.NewValues["Disponibilidad"].ToString());

            try
            {
                string Resultado = BLLCamiones.UpdCamion(int.Parse(IdCamion), Matricula, Tipocamion, int.Parse(Modelo), Marca, Capacidad, Kilometraje, Disponibilidad, null);
                GVCamiones.EditIndex = -1;
                RefrescarGrid();
                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());
            }
        }        //EndOnUpdating
示例#2
0
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         int    IdCamion       = int.Parse(lblIdCamion.Text);
         string Matricula      = txtMatricula.Text;
         string TipoCamion     = DDLTipoCamion.SelectedValue;
         int    Modelo         = int.Parse(DDLModelo.SelectedValue);
         string Marca          = DDLMarca.SelectedValue;
         int    Capacidad      = int.Parse(txtCapacidad.Text);
         float  Kilometraje    = float.Parse(txtKilometraje.Text);
         string urlfoto        = UrlFoto.InnerText;
         bool   Disponibilidad = chkDisponibilidad.Checked;
         string Resultado      = BLLCamiones.UpdCamion(IdCamion, Matricula, TipoCamion, Modelo, Marca, Capacidad, Kilometraje, Disponibilidad, urlfoto);
         if (Resultado.IndexOf("Camión actualizado correctamente") > -1)
         {
             Util.Library.UtilControls.SweetBoxConfirm("OK!", Resultado, "success", "ListaCamiones.aspx", this.Page, this.GetType());
         }
         else
         {
             //Mensaje de error
             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());
     }
 }