コード例 #1
0
 /// <summary>
 /// Before a C#-way query "runs" all data from databeseare are refreshed.
 /// </summary>
 private void AllDataRefresh()
 {
     if (!SQLWay.AllProductCategoryDataDownload() ||
         !SQLWay.AllProductDataDownload() ||
         !SQLWay.AllCustomerDataDownload() ||
         !SQLWay.AllCustomerOrderDataDownload() ||
         !SQLWay.AllOrderedProductDownload())
     {
     }
 }
コード例 #2
0
        /// <summary>
        /// According to the choosen comboboxItem and the CSharpWay checkbox checkedStatus, visualise Listview, set and execute the query.
        /// </summary>
        private void ListviewSetUploadAndVisualise()
        {
            listViewBasic.Items.Clear();
            listViewBasic.Columns.Clear();

            foreach (ListviewColumnName aName in SelectedColumnNames)
            {
                listViewBasic.Columns.Add(aName.ColumnName);
            }

            List <ListViewItem> aSelectedQueryListViewItemList = new List <ListViewItem>();

            if (checkBoxCSharpWay.Checked)
            {
                AllDataRefresh();
            }

            switch (SelectedEnum)
            {
            case DataQueries.AllOrderData:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.AllOrderDataList(checkBox1.Checked);
                }
                else
                {
                    Operations.SQLWay.AllOrderDataDownload(checkBox1.Checked, out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.CountOfProductAccordingToProductCategory:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.CountOfProductAccordingToProductCategoryList;
                }
                else
                {
                    SQLWay.CountOfProductAccordingToProductCategoryDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.YearlyPersonAllOrderAmount:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.YearlyPersonAllOrderAmountList;
                }
                else
                {
                    SQLWay.YearlyPersonAllOrderAmountDowload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.AllOrderAmountAccordingToModeAndStatus:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.AllOrderAmountAccordingToModeAndStatusList;
                }
                else
                {
                    SQLWay.AllOrderAmountAccordingToModeAndStatusDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.AllOrdderAmountAccordingToDay:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.AllOrderAmountAccordingToDayList;
                }
                else
                {
                    SQLWay.AllOrerAmountAccordingToDayDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.CountOfTheProductsAccordingToGender:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.CountOfTheProductsAccordingToGenderList;
                }
                else
                {
                    SQLWay.CountOfTheProductsAccordingToGenderDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.ProductsWarrantyExpired:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.ProductsWarrantyExpriredList;
                }
                else
                {
                    SQLWay.ProductsWarrantyExpriredDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.ProductsOrderMoreThanGivenNumber:

                int convertedNumberFromTextBoxQueryParameter = 0;

                if (!Int32.TryParse(textBoxInputParameter.Text, out convertedNumberFromTextBoxQueryParameter))
                {
                    MessageBox.Show(MessageTexts.TextBoxInputErrorText);
                }
                else
                {
                    if (checkBoxCSharpWay.Checked)
                    {
                        aSelectedQueryListViewItemList = CSharpWay.ProductsOrderedMoreThanGivenNumberList(convertedNumberFromTextBoxQueryParameter);
                    }
                    else
                    {
                        SQLWay.ProductsOrderedMoreThanGivenNumberDowmnload(convertedNumberFromTextBoxQueryParameter, out aSelectedQueryListViewItemList);
                    }
                }
                break;

            case DataQueries.ProductsAreNotOrdered:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.ProductsAreNotOrderedList;
                }
                else
                {
                    SQLWay.ProductsAreNotOrderedDownload(out aSelectedQueryListViewItemList);
                }

                break;

            case DataQueries.AllProductsWithAllData:

                if (checkBoxCSharpWay.Checked)
                {
                    aSelectedQueryListViewItemList = CSharpWay.AllProductsWithAllDataList(checkBox1.Checked);
                }
                else
                {
                    SQLWay.AllProductsWithAllDataDownload(checkBox1.Checked, out aSelectedQueryListViewItemList);
                }

                break;
            }

            listViewBasic.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

            if (SelectedEnum == DataQueries.AllProductsWithAllData)
            {
                listViewBasic.Columns[4].Width = AllProductionWithAllDataColumnWidth;
            }

            ListViewColumnDataUploader(aSelectedQueryListViewItemList);
        }