예제 #1
0
 private void btnAddAddres_Click(object sender, EventArgs e)
 {
     if (txtAddAddress.Text.Equals(""))
     {
         MessageBox.Show("Direccion agregada con exito", "Error", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     else
     {
         ADDRESS address = new ADDRESS();
         address.idUser  = usuario.idUser;
         address.address = txtAddAddress.Text;
         try
         {
             ConsultaADDRESS.Add(address);
             this.Close();
             MessageBox.Show("Acceso concedido, Binevenido", "Confirmacion", MessageBoxButtons.OK,
                             MessageBoxIcon.Asterisk);
         }
         catch (Exception exception)
         {
             MessageBox.Show("Ha ocurrido un error", "ERROR",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
예제 #2
0
        private void buttonagregar_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxdireccion.Text.Length > 0)
                {
                    ConsultaADDRESS.crearNuevoADDRESS(usuario.idUser, textBoxdireccion.Text);

                    MessageBox.Show("¡Direccion agregada!",
                                    "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    textBoxdireccion.Clear();
                    Actualizarcontrol();
                }
                else
                {
                    MessageBox.Show("Favor complete los campos",
                                    "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("La direccion  no se encuentra disponible agregue otro.",
                                "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        public void LoadCombo(int id)
        {
            list  = new List <ADDRESS>();
            list1 = new List <string>();
            list  = ConsultaADDRESS.getLista(id);
            foreach (var x in list)
            {
                list1.Add(x.address);
            }

            cmbAddress.DataSource = list1;
        }
예제 #4
0
        private void butteliminar_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Seguro que desea eliminar la direccion ?",
                                "SourceCode", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                int D = (int)comboBoxDireccion.SelectedValue;

                ConsultaADDRESS.eliminar(D);

                MessageBox.Show("¡Direccion eliminada exitosamente!",
                                "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Actualizarcontrol();
            }
        }
예제 #5
0
        public void LoadCombo(int id)
        {
            list  = new List <ADDRESS>();
            list1 = new List <string>();
            list  = ConsultaADDRESS.getLista(id);
            foreach (var x in list)
            {
                list1.Add(x.address);
            }

            cmbSAddress.DataSource = list1;

            lista  = new List <PRODUCT>();
            list1a = new List <string>();
            lista  = ConsultaPRODUCT.getLista();
            foreach (var x in lista)
            {
                list1a.Add(x.name);
            }

            cmbProducts.DataSource = list1a;
        }
예제 #6
0
        private void Actualizarcontrol()
        {
            List <ADDRESS>    lista1 = ConsultaADDRESS.GetListaDAd(usuario.idUser);
            List <APPORDER>   lista2 = ConsultaAPPORDER.getLista();
            List <Inventario> lista3 = ConsultaInventario.getLista();

            comboBoxDireccion.DataSource    = null;
            comboBoxDireccion.ValueMember   = "idaddress";
            comboBoxDireccion.DisplayMember = "address";
            comboBoxDireccion.DataSource    = lista1;
            comboOrdenar.DataSource         = null;
            comboOrdenar.ValueMember        = "idproduct";
            comboOrdenar.DisplayMember      = "name";
            comboOrdenar.DataSource         = lista3;
            cmbdireccionOrden.DataSource    = null;
            cmbdireccionOrden.ValueMember   = "idaddress";
            cmbdireccionOrden.DisplayMember = "Aaddress";
            cmbdireccionOrden.DataSource    = lista1;
            cmbeliminarorden.DataSource     = null;
            cmbeliminarorden.ValueMember    = "idproduct";
            cmbeliminarorden.DisplayMember  = "idorder";
            cmbeliminarorden.DataSource     = lista2;
        }