예제 #1
0
        private void cmbDepartamento_SelectionChangeCommitted_1(object sender, EventArgs e)
        {
            int indice = int.Parse(cmbDepartamento.SelectedItem.ToString().Substring(0, 1));

            using (abcEntities db = new abcEntities())
            {
                string numero;
                string nombre;

                var lstClase = from d in db.Clase select d;

                cmbClase.Items.Clear();
                foreach (var element in lstClase)
                {
                    if (element.IdDepartamento == indice)
                    {
                        numero = element.IdClase.ToString();
                        nombre = element.NombreClase;

                        cmbClase.Items.Add(numero + " - " + nombre);
                    }
                }
            }
            cmbClase.Enabled = true;
        }
예제 #2
0
        private void cmbOptions_SelectionChangeCommitted(object sender, EventArgs e)
        {
            pnlSku.Visible      = false;
            pnlArticulo.Visible = false;
            pnlDCF.Visible      = false;
            switch (cmbOptions.SelectedItem)
            {
            case "Sku":
                pnlSku.Visible = true;
                break;

            case "Articulo":
                pnlArticulo.Visible = true;
                break;

            case "DCF":
                pnlDCF.Visible = true;
                using (abcEntities db = new abcEntities())
                {
                    string numero;
                    string nombre;
                    var    lst = from d in db.Departamento select d;

                    cmbDepartamento.Items.Clear();
                    foreach (var element in lst)
                    {
                        numero = element.IdDepartamento.ToString();
                        nombre = element.NombreDepartamento;

                        cmbDepartamento.Items.Add(numero + "-" + nombre);
                    }
                };
                break;
            }
        }
예제 #3
0
        private void cmbClase_SelectionChangeCommitted(object sender, EventArgs e)
        {
            int indice  = int.Parse(cmbClase.SelectedItem.ToString().Substring(0, 1));
            int indice2 = int.Parse(cmbDepartamento.SelectedItem.ToString().Substring(0, 1));


            using (abcEntities db = new abcEntities())
            {
                string numero;
                string nombre;

                var lstClase = from d in db.Familia select d;

                cmbFamilia.Items.Clear();
                foreach (var element in lstClase)
                {
                    if (element.IdClase == indice && element.IdDepartamento == indice2)
                    {
                        numero = element.IdFamilia;
                        nombre = element.NombreFamilia;

                        cmbFamilia.Items.Add(numero + " - " + nombre);
                    }
                }
                var lst = from d in db.ABCC.Where(p => p.Departamento.ToString().Contains(indice2.ToString()) && p.Clase.ToString().Contains(indice.ToString())) select d;
                dataGridView1.DataSource = lst.ToList();
                EstiloFila(dataGridView1);
            }
            cmbFamilia.Enabled = true;
        }
예제 #4
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            txtArticulo.Enabled      = true;
            txtMarca.Enabled         = true;
            txtModelo.Enabled        = true;
            cmbDepartamento.Enabled  = true;
            txtCantidad.Enabled      = true;
            txtStock.Enabled         = true;
            btnAceptar.Enabled       = true;
            cbxDescontinuado.Enabled = true;

            using (abcEntities db = new abcEntities()) {
                string numero;
                string nombre;
                var    lst2 = from d in db.Departamento select d;

                cmbDepartamento.Items.Clear();
                foreach (var element in lst2)
                {
                    numero = element.IdDepartamento.ToString();
                    nombre = element.NombreDepartamento;

                    cmbDepartamento.Items.Add(numero + "-" + nombre);
                }
            }

            bandera = "cambio";
        }
예제 #5
0
 private void Baja(int id)
 {
     using (abcEntities db = new abcEntities())
     {
         db.spBaja(id);
     }
 }
예제 #6
0
        private void txtModelo_KeyDown(object sender, KeyEventArgs e)
        {
            using (abcEntities db = new abcEntities())
            {
                var lst = from d in db.ABCC.Where(p => p.Modelo.Contains(txtModelo.Text))

                          select d;
                dataGridView1.DataSource = lst.ToList();
                EstiloFila(dataGridView1);
            }
        }
예제 #7
0
        private void txtSku_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                using (abcEntities db = new abcEntities())
                {
                    var lst = from d in db.ABCC.Where(p => p.Sku.ToString().Contains(txtSku.Text))

                              select d;
                    dataGridView1.DataSource = lst.ToList();
                    EstiloFila(dataGridView1);
                }
            }
        }
예제 #8
0
        private void cmbFamilia_SelectionChangeCommitted(object sender, EventArgs e)
        {
            int    indice  = int.Parse(cmbClase.SelectedItem.ToString().Substring(0, 1));
            int    indice2 = int.Parse(cmbDepartamento.SelectedItem.ToString().Substring(0, 1));
            string indice3 = cmbFamilia.SelectedItem.ToString().Substring(0, 2);

            using (abcEntities db = new abcEntities())
            {
                var lst = from d in db.ABCC.Where(p => p.Departamento.ToString().Contains(indice2.ToString()) && p.Clase.ToString().Contains(indice.ToString()) && p.Familia.Contains(indice3)) select d;
                dataGridView1.DataSource = lst.ToList();

                EstiloFila(dataGridView1);
            }
        }
예제 #9
0
 private void Cambio(int id)
 {
     using (abcEntities db = new abcEntities())
     {
         ABCC.Models.ABCC oTabla = new Models.ABCC();
         string           d      = "0";
         if (cbxDescontinuado.Checked == true)
         {
             d = "1";
             db.spCambio(
                 int.Parse(txtSku.Text),
                 txtArticulo.Text,
                 txtMarca.Text,
                 txtModelo.Text,
                 int.Parse(cmbDepartamento.Text.Substring(0, 1)),
                 int.Parse(cmbClase.Text.Substring(0, 1)),
                 cmbFamilia.Text.Substring(0, 2),
                 int.Parse(txtStock.Text),
                 int.Parse(txtCantidad.Text),
                 dtpFA.Value,
                 dtpFA.Value,
                 d
                 );
         }
         else
         {
             db.spCambio(
                 int.Parse(txtSku.Text),
                 txtArticulo.Text,
                 txtMarca.Text,
                 txtModelo.Text,
                 int.Parse(cmbDepartamento.Text.Substring(0, 1)),
                 int.Parse(cmbClase.Text.Substring(0, 1)),
                 cmbFamilia.Text.Substring(0, 2),
                 int.Parse(txtStock.Text),
                 int.Parse(txtCantidad.Text),
                 dtpFA.Value,
                 dtpFB.Value,
                 d
                 );
         }
     }
 }
예제 #10
0
        public void Consulta(int?id)
        {
            using (abcEntities db = new abcEntities())
            {
                var lst = db.spConsulta(id);
                foreach (var element in lst)
                {
                    cmbDepartamento.DropDownStyle = ComboBoxStyle.DropDown;
                    cmbClase.DropDownStyle        = ComboBoxStyle.DropDown;
                    cmbFamilia.DropDownStyle      = ComboBoxStyle.DropDown;

                    txtArticulo.Text = element.Articulo;
                    txtMarca.Text    = element.Marca;
                    txtModelo.Text   = element.Modelo;
                    txtStock.Text    = element.Stock.ToString();
                    txtCantidad.Text = element.Cantidad.ToString();
                    dtpFA.Value      = element.Fecha_Alta;
                    dtpFB.Value      = element.Fecha_Baja.Value;
                    var lst2 = db.Departamento.Single(p => p.IdDepartamento.ToString().Contains(element.Departamento.ToString()));
                    var lst3 = db.Clase.Single(p => p.IdClase.ToString().Contains(element.Clase.ToString()) && p.IdDepartamento.ToString().Contains(element.Departamento.ToString()));
                    var lst4 = db.Familia.Single(p => p.IdClase.ToString().Contains(element.Clase.ToString()) && p.IdDepartamento.ToString().Contains(element.Departamento.ToString()) && p.IdFamilia.Contains(element.Familia.ToString()));
                    cmbDepartamento.Text = lst2.IdDepartamento.ToString() + " - " + lst2.NombreDepartamento.ToString();
                    cmbClase.Text        = lst3.IdClase.ToString() + " - " + lst3.NombreClase.ToString();
                    cmbFamilia.Text      = lst4.IdFamilia.ToString() + " - " + lst4.NombreFamilia.ToString();
                    if (element.Descontinuado == "1")
                    {
                        cbxDescontinuado.Checked = true;
                    }
                    else
                    {
                        cbxDescontinuado.Checked = false;
                    }



                    btnEliminar.Enabled = true;
                    btnEditar.Enabled   = true;
                }
            }
        }
예제 #11
0
 private void Alta()
 {
     using (abcEntities db = new abcEntities())
     {
         ABCC.Models.ABCC oTabla = new Models.ABCC();
         db.spAlta(
             int.Parse(txtSku.Text),
             txtArticulo.Text,
             txtMarca.Text,
             txtModelo.Text,
             int.Parse(cmbDepartamento.Text.Substring(0, 1)),
             int.Parse(cmbClase.Text.Substring(0, 1)),
             cmbFamilia.Text.Substring(0, 2),
             int.Parse(txtStock.Text),
             int.Parse(txtCantidad.Text),
             dtpFA.Value,
             dtpFB.Value,
             "0"
             );
         db.SaveChanges();
     }
 }
예제 #12
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            using (abcEntities db = new abcEntities())
            {
                ABCC.Models.ABCC oTabla = new Models.ABCC();
                var lst = from d in db.ABCC.Where(p => p.Sku.ToString().Contains(txtSku.Text)) select d;
                if (lst.Count() > 0)
                {
                    Consulta(int.Parse(txtSku.Text));
                    bandera = "consulta";
                }
                else
                {
                    txtArticulo.Enabled     = true;
                    txtMarca.Enabled        = true;
                    txtModelo.Enabled       = true;
                    cmbDepartamento.Enabled = true;
                    txtCantidad.Enabled     = true;
                    txtStock.Enabled        = true;
                    btnAceptar.Enabled      = true;

                    string numero;
                    string nombre;
                    var    lst2 = from d in db.Departamento select d;

                    cmbDepartamento.Items.Clear();
                    foreach (var element in lst2)
                    {
                        numero = element.IdDepartamento.ToString();
                        nombre = element.NombreDepartamento;

                        cmbDepartamento.Items.Add(numero + "-" + nombre);
                    }


                    bandera = "nuevo";
                }
            }
        }