Пример #1
0
        protected void RowDeltingEvent(object sender, GridViewDeleteEventArgs e)
        {
            Bibliotecas.Negocio.Peaje us = new Bibliotecas.Negocio.Peaje();
            string valor = GBPeaje.Rows[e.RowIndex].Cells[0].Text;

            us.EliminarPeaje(valor);
        }
Пример #2
0
        protected void GBPeaje_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = (GridViewRow)GBPeaje.Rows[e.RowIndex];

            TextBox tprecio  = (TextBox)row.FindControl("txtprecio2");
            TextBox tdesc    = (TextBox)row.FindControl("txtDesc2");
            TextBox tcantpor = (TextBox)row.FindControl("txtCantPor2");
            string  pre      = tprecio.Text;
            string  des      = tdesc.Text;
            string  can      = tcantpor.Text;


            #region CodigoVaLidacion
            Bibliotecas.Negocio.Peaje pej = new Bibliotecas.Negocio.Peaje();

            string ruta = GBPeaje.Rows[e.RowIndex].Cells[0].Text;


            if (vacio(pre, can, des))
            {
                if (EsNumero(pre, can, des))
                {
                    pej.Ruta             = ruta;
                    pej.Precio           = Convert.ToDecimal(pre);
                    pej.Descuento        = Convert.ToSingle(des);
                    pej.Cantidad_portico = Convert.ToInt32(can);
                    pej.UpdateCompleto();
                }
                else
                {
                    e.Cancel = true;
                    string script = @"<script type='text/javascript'>
                            alerta('Debe ingresar numeros enteros');
                        </script>";

                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                }
            }
            else
            {
                e.Cancel = true;
                string script = @"<script type='text/javascript'>
                            alerta('Ningun campo puede estar vacio');
                        </script>";

                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
            }
            #endregion
        }
 public void UpdateMasivoDescuento(int desc)
 {
     try
     {
         var   bibliotecas = CommonBC.ModeloSmartPay.Peaje;
         Peaje pe          = new Peaje();
         foreach (Bibliotecas.Dalc.Peaje item in bibliotecas.ToList())
         {
             item.descuento = desc;
             CommonBC.ModeloSmartPay.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }