Ejemplo n.º 1
0
        private void GrabarUpdateRegistro()
        {
            ClassProduct producto = new ClassProduct
            {
                Product_id  = txt_product_id.Text,
                ProductName = txt_product_name.Text,
                Descripcion = txt_descrip_product.Text,
                Referencia  = txt_referencia.Text,
                Codebar     = txt_code_bar.Text,
                Categoria   = cbo_category.Text,
                Precio      = Convert.ToDouble(txt_precio.Text),
                MasterRolls = RAD_MASTER_ROLLS.Checked,
                Resmas      = RAD_RESMAS.Checked,
                Code_RC     = "",
                Anulado     = CHK_ANULADO.Checked,
                Graphics    = RAD_GRAPHICS.Checked,
                Ratio       = Convert.ToDecimal(txt_ratio.Text)
            };
            ProductsManager productoManager = new ProductsManager();

            productoManager.Update(producto);
            txt_descrip_product.ReadOnly = true;
            txt_product_name.ReadOnly    = true;
            txt_referencia.ReadOnly      = true;
            txt_code_bar.ReadOnly        = true;
            txt_precio.ReadOnly          = true;
            txt_ratio.ReadOnly           = true;
            cbo_category.Enabled         = false;
            CHK_ANULADO.Enabled          = false;
            RAD_GRAPHICS.Enabled         = false;
            RAD_MASTER_ROLLS.Enabled     = false;
            RAD_RESMAS.Enabled           = false;
            BOT_PRIMERO.Enabled          = true;
            BOT_SIGUIENTE.Enabled        = true;
            BOT_ULTIMO.Enabled           = true;
            BOT_ANTERIOR.Enabled         = true;
            BOT_NUEVO.Enabled            = true;
            BOT_MODIFICAR.Enabled        = true;
            BOT_BUSCAR.Enabled           = true;
            BOT_GRABAR.Enabled           = false;
            BOT_CANCELAR.Enabled         = false;
            EditMode = 0;
        }
Ejemplo n.º 2
0
        private ClassProduct CreateProductRollCut(ClassProduct producto)
        {
            //creo el producto rollo cortado.
            DataRow dr = ds.Tables["dtproducto"].NewRow();

            dr["product_id"]    = producto.Product_id + "0";
            dr["product_name"]  = producto.ProductName + " RC";
            dr["rollo_Cortado"] = true;
            dr["MasterRolls"]   = false;
            dr["Graphics"]      = false;
            dr["Resmas"]        = false;
            dr["Product_Ref"]   = "";
            dr["Anulado"]       = false;
            dr["Codebar"]       = "";
            dr["Code_RC"]       = "";
            dr["precio"]        = 0;
            ds.Tables["dtproducto"].Rows.Add(dr);
            //Creo el objeto y lo agrego a la base de datos.
            ClassProduct rollo_cortado = new ClassProduct
            {
                Product_id    = Convert.ToString(dr["product_id"]),
                ProductName   = producto.ProductName,
                Rollo_Cortado = true,
                MasterRolls   = false,
                Graphics      = false,
                Resmas        = false,
                Referencia    = "",
                Anulado       = false,
                Codebar       = "",
                Descripcion   = "",
                Categoria     = "",
                Precio        = 0,
                Code_RC       = ""
            };

            return(rollo_cortado);
        }
Ejemplo n.º 3
0
        private void GrabarNuevoRegistro()
        {
            //Actualizo la Interfaz Grafica.
            DataRowView FilaActual;

            FilaActual                 = (DataRowView)bs.Current;
            FilaActual["precio"]       = txt_precio.Text;
            FilaActual["product_name"] = txt_product_name.Text;
            FilaActual["MasterRolls"]  = RAD_MASTER_ROLLS.Checked;
            FilaActual["Resmas"]       = RAD_RESMAS.Checked;
            FilaActual["Graphics"]     = RAD_GRAPHICS.Checked;
            FilaActual["Product_Ref"]  = txt_referencia.Text;
            FilaActual["Codebar"]      = txt_code_bar.Text;
            FilaActual["Ratio"]        = txt_ratio.Text;

            if (RAD_MASTER_ROLLS.Checked)
            {
                FilaActual["Code_RC"] = txt_product_id.Text + "0";
            }
            else
            {
                FilaActual["Code_RC"] = "";
            }
            bs.EndEdit();
            //Crear el Objeto producto.
            ClassProduct producto = new ClassProduct
            {
                Precio      = 0,
                Product_id  = txt_product_id.Text,
                ProductName = txt_product_name.Text,
                Descripcion = txt_descrip_product.Text,
                Referencia  = txt_referencia.Text,
                Codebar     = txt_code_bar.Text,
                Categoria   = cbo_category.Text,
                MasterRolls = RAD_MASTER_ROLLS.Checked,
                Resmas      = RAD_RESMAS.Checked,
                Graphics    = RAD_GRAPHICS.Checked,
                Code_RC     = FilaActual["Code_RC"].ToString(),
                Ratio       = Convert.ToDecimal(txt_ratio.Text)
            };

            producto.Precio  = Convert.ToDouble(txt_precio.Text);
            producto.Anulado = false;
            ProductsManager productoManager = new ProductsManager();

            // Validar la entidad Producto.
            if (producto.Product_id == string.Empty)
            {
                MessageBox.Show("Introduzca el Part Number.");
                return;
            }
            if (producto.ProductName == string.Empty)
            {
                MessageBox.Show("Introduzca el nombre del producto.");
                return;
            }
            if (producto.MasterRolls == false && producto.Resmas == false && producto.Graphics == false)
            {
                MessageBox.Show("Introduzca el tipo de producto Master Roll,Resma,Graphics.");
                return;
            }
            productoManager.Add(producto, false);
            // Verifico que el producto creado es un master rolls
            // para crear tambien el producto como rollo cortado.
            if (producto.MasterRolls)
            {
                productoManager.Add(CreateProductRollCut(producto), true);
            }
            txt_product_id.ReadOnly      = true;
            txt_product_name.ReadOnly    = true;
            txt_descrip_product.ReadOnly = true;
            txt_code_bar.ReadOnly        = true;
            txt_referencia.ReadOnly      = true;
            txt_precio.ReadOnly          = true;
            txt_ratio.ReadOnly           = true;
            cbo_category.Enabled         = true;
            RAD_MASTER_ROLLS.Enabled     = false;
            RAD_RESMAS.Enabled           = false;
            RAD_GRAPHICS.Enabled         = false;
            cbo_category.Enabled         = false;
            CHK_ANULADO.DataBindings.Add("checked", bs, "anulado");
            RAD_MASTER_ROLLS.DataBindings.Add("checked", bs, "MasterRolls");
            RAD_ROLLO_CORTADO.DataBindings.Add("checked", bs, "rollo_cortado");
            RAD_RESMAS.DataBindings.Add("checked", bs, "Resmas");
            RAD_GRAPHICS.DataBindings.Add("checked", bs, "graphics");
            ContadorRegistros();
            EditMode              = 0;
            BOT_PRIMERO.Enabled   = true;
            BOT_SIGUIENTE.Enabled = true;
            BOT_ANTERIOR.Enabled  = true;
            BOT_ULTIMO.Enabled    = true;
            BOT_NUEVO.Enabled     = true;
            BOT_CANCELAR.Enabled  = false;
            BOT_GRABAR.Enabled    = false;
            BOT_MODIFICAR.Enabled = true;
            BOT_BUSCAR.Enabled    = true;
        }