コード例 #1
0
        private void backButt_Click(object sender, EventArgs e)
        {
            int numtotalPg = calculpg();

            --currentpg;

            DataAcces           db       = new DataAcces();
            List <ProductModel> products = new List <ProductModel>();

            if (currentpg <= 0)
            {
                listBoxProducts.Items.Clear();

                currentpg       = 0;
                numPgLabel.Text = "Pag " + (currentpg) + " of " + numtotalPg;
            }
            else
            {
                --currentpg;
                numPgLabel.Text = "Pag " + (currentpg) + " of " + numtotalPg;

                listBoxProducts.Items.Clear();

                products = db.UpdateViewRowsPage(lenguageComboBox.Text, currentpg, numFilasComboBox.Text);

                Lectura(products);
            }
        }
コード例 #2
0
        private void updateButt_Click(object sender, EventArgs e)
        {
            // No se como aconseguir fer l'update serc pero no em queda clar i el que se m'ocorr me
            // dona se sencacio de que es molt enfarragos com per que sigui valid
            string element = "";
            string name    = updateElementcomboBox.Text;

            string[] word     = productCompletListBox.Text.Split('|');
            int      category = updateElementTextBox.SelectionLength;

            string contingut = word[category];

            switch (updateElementcomboBox.Text)
            {
            case "ProductCategory":
                element = "ProductCategory";
                name    = "Name";
                break;

            case "ProductSubcategory":
                element = "ProductSubCategory";
                name    = "Name";
                break;

            default:
                element = "Product";
                break;
            }
            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            products = db.updateProduct(element, name, name, contingut);
        }
コード例 #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            products = db.GetShow(lenguageComboBox.Text);

            Lectura(products);
        }
コード例 #4
0
        private void filterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            listBoxProducts.Items.Clear();

            products = db.Filtro(lenguageComboBox.Text, filterComboBox.Text);

            foreach (ProductModel product in products)
            {
                listBoxProducts.Items.Add(product.PNamFiltro);
            }
        }
コード例 #5
0
        private void numFilasComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentpg = 0;

            int numtotalPg = calculpg();

            numPgLabel.Text = "Pag " + (currentpg + 1) + " of " + numtotalPg;

            DataAcces           db       = new DataAcces();
            List <ProductModel> products = new List <ProductModel>();

            listBoxProducts.Items.Clear();
            products = db.UpdateViewRowsPage(lenguageComboBox.Text, currentpg, numFilasComboBox.Text);

            Lectura(products);
        }
コード例 #6
0
        public ProductCompletForm(string leng, string name)
        {
            InitializeComponent();

            string[] words = name.Split('|');

            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            products = db.GetShowAll(leng, words[0]);

            //Aixo es un foreach, porque no se como fer que m'entri es contingut de products si no
            foreach (ProductModel product in products)
            {
                productCompletListBox.Items.Add(product.FullInfo);
            }
        }
コード例 #7
0
        private void serchProductButt_Click(object sender, EventArgs e)
        {
            listBoxProducts.Items.Clear();

            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            products = db.producName(lenguageComboBox.Text, enterProduct.Text, aviabelCheckBox.Checked);

            if (aviabelCheckBox.Checked == true)
            {
                Lectura(products);
            }
            else if (aviabelCheckBox.Checked == false)
            {
                foreach (ProductModel product in products)
                {
                    listBoxProducts.Items.Add(product.PshowAll);
                }
            }
        }
コード例 #8
0
        public int calculpg()
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("AdventureWorks2016")))
            {
                string sql = "SELECT COUNT(*) " +
                             "FROM " +
                             "Production.Product " +
                             "INNER JOIN Production.ProductModel ON Production.Product.ProductModelID = Production.ProductModel.ProductModelID " +
                             "INNER JOIN Production.ProductModelProductDescriptionCulture ON Production.ProductModel.ProductModelID = Production.ProductModelProductDescriptionCulture.ProductModelID " +
                             "INNER JOIN Production.ProductDescription ON Production.ProductModelProductDescriptionCulture.ProductDescriptionID = Production.ProductDescription.ProductDescriptionID " +
                             $"WHERE ProductModelProductDescriptionCulture.CultureID = '{ lenguageComboBox.Text }' ";


                DataAcces db = new DataAcces();

                int totalNumeroDeProductes = connection.Query <int>(sql).FirstOrDefault();

                int numtotalPg = totalNumeroDeProductes / int.Parse(numFilasComboBox.Text) + 1;

                return(numtotalPg);
            }
        }
コード例 #9
0
        private void lenguageComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataAcces db = new DataAcces();

            List <ProductModel> products = new List <ProductModel>();

            if (aviabelCheckBox.Checked == true)
            {
                listBoxProducts.Items.Clear();

                products = db.GetAviabel(lenguageComboBox.Text);

                Lectura(products);
            }
            else if (aviabelCheckBox.Checked == false)
            {
                listBoxProducts.Items.Clear();

                products = db.GetShow(lenguageComboBox.Text);

                Lectura(products);
            }
        }