Ejemplo n.º 1
0
        private void modificarButton_Click(object sender, EventArgs e)
        {
            int    h = 0;
            string f = "";

            try
            {
                EnviosDAO envdao = new EnviosDAO();
                char      status;
                if (comboBox1.Text == "Activo")
                {
                    status = 'A';
                }
                else
                {
                    status = 'I';
                }
                Modelo.Envios env = new Modelo.Envios(envios.idenvio, dateTimePicker1.Value, ((Transporte)comboBox2.SelectedItem).ID, status);
                envdao.Editar(env);
            }
            catch (Exception ex)
            {
                f = "" + ex;
                h = 1;
            }
            if (h == 1)
            {
                Mensajes.Error(f);
            }
            else
            {
                Mensajes.Info("Los campos se editaron correctamente");
            }
            this.Close();
        }
Ejemplo n.º 2
0
 public AddEnvio(Modelo.Envios env)
 {
     InitializeComponent();
     this.envios             = env;
     label8.Text             = "Modificar";
     modificarButton.Visible = true;
     btnNuevo.Visible        = false;
 }
Ejemplo n.º 3
0
 private void paginacionTabla_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         DataGridViewRow renglon    = paginacionTabla.Rows[e.RowIndex];
         string          sql_where  = " where idenvio=@id";
         List <string>   parametros = new List <string>();
         List <object>   valores    = new List <object>();
         parametros.Add("@id");
         valores.Add(renglon.Cells["ID"].Value);
         Modelo.Envios env    = enviosDAO.ConsultaGeneral(sql_where, parametros, valores)[0];
         AddEnvio      envgui = new AddEnvio(env);
         envgui.ShowDialog();
         actualizarTabla();
     }
     else
     {
         Mensajes.Error("Selecciona un registro");
     }
 }
Ejemplo n.º 4
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem == null || comboBox2.SelectedItem == null)
     {
         Mensajes.Error("Rellene los campos vacios antes de realizar el registro");
     }
     else
     {
         int    h = 0;
         string f = "";
         try
         {
             EnviosDAO envdao = new EnviosDAO();
             char      status;
             if (comboBox1.Text == "Activo")
             {
                 status = 'A';
             }
             else
             {
                 status = 'I';
             }
             Modelo.Envios env = new Modelo.Envios(1, dateTimePicker1.Value, ((Transporte)comboBox2.SelectedItem).ID, status);
             envdao.Registrar(env);
         }
         catch (Exception ex)
         {
             f = "" + ex;
             h = 1;
         }
         if (h == 1)
         {
             Mensajes.Error(f);
         }
         else
         {
             Mensajes.Info("Registro completado");
         }
         this.Close();
     }
 }