Пример #1
0
        public static bool AllOrderedProductDownload()
        {
            orderedProductList.Clear();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.AllOrderedProductDownload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        orderedProductList.Add(new OrderedProduct(Convert.ToInt32(reader[0]), Convert.ToInt32(reader[1]),
                                                                  Convert.ToInt32(reader[2]), Convert.ToInt32(reader[3]), Convert.ToInt32(reader[4])));
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.AllOrderedProduct, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #2
0
        public static bool ProductsAreNotOrderedDownload(out List <ListViewItem> productsAreNotOrderedNameListViewItemList)
        {
            productsAreNotOrderedNameListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.ProductsAreNotOrderedDownload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        ProductsAreNotOrdered aNewNotOrderedProduct = new ProductsAreNotOrdered(reader[0].ToString());

                        productsAreNotOrderedNameListViewItemList.Add(aNewNotOrderedProduct.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.ProductsAreNotOrdered, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #3
0
        public static bool AllProductsWithAllDataDownload(bool checkedActive, out List <ListViewItem> allProductsWithAllDataListViewItemList)
        {
            allProductsWithAllDataListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(String.Format(QueryStrings.AllProductsWithAllDataDownload, checkedActive == true ? 1 : 2), connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        ProductForAllProductWithAllData aNewProductForAllProductWithAllData = new ProductForAllProductWithAllData(reader[0].ToString(), Convert.ToInt32(reader[1]),
                                                                                                                                  Convert.ToInt32(reader[2]), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), Convert.ToInt32(reader[6]));

                        allProductsWithAllDataListViewItemList.Add(aNewProductForAllProductWithAllData.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.AllProductsWithAllData, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #4
0
        public static bool ProductsOrderedMoreThanGivenNumberDowmnload(int referenceNumber, out List <ListViewItem> productsOrderedMoreThanGivenNumberListViewItemList)
        {
            productsOrderedMoreThanGivenNumberListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(string.Format(Operations.QueryStrings.ProductsOrderedMoreThanGivenNumberDowmnload, referenceNumber), connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        ProductCategoryCount aNewProductCategoryCount = new ProductCategoryCount(reader[0].ToString(), Convert.ToInt32(reader[1]));

                        productsOrderedMoreThanGivenNumberListViewItemList.Add(aNewProductCategoryCount.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.ProductsOrderMoreThanGivenNumber, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #5
0
        public static bool ProductsWarrantyExpriredDownload(out List <ListViewItem> productWarrantyExpiredListViewItemList)
        {
            productWarrantyExpiredListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.ProductsWarrantyExpriredDownload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        OrderedProductForWarranty aNewOrderdedProductForWarranty = new OrderedProductForWarranty(reader[0].ToString(), reader[1].ToString(),
                                                                                                                 Convert.ToInt32(reader[2]), Convert.ToInt32(reader[3]), Convert.ToInt32(reader[4]));

                        productWarrantyExpiredListViewItemList.Add(aNewOrderdedProductForWarranty.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.ProductsWarrantyExpired, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #6
0
        public static bool CountOfTheProductsAccordingToGenderDownload(out List <ListViewItem> countOfTheProductsAccordingToGenderListViewItemList)
        {
            countOfTheProductsAccordingToGenderListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.CountOfTheProductsAccordingToGenderDownload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        GenderProductCount aNewGenderProductCount = new GenderProductCount(reader[0].ToString(), Convert.ToInt32(reader[1]));

                        countOfTheProductsAccordingToGenderListViewItemList.Add(aNewGenderProductCount.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.CountOfTheProductsAccordingToGender, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #7
0
        public static bool AllOrerAmountAccordingToDayDownload(out List <ListViewItem> allOrderAmountAccordingToDayListViewItemList)
        {
            allOrderAmountAccordingToDayListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.AllOrerAmountAccordingToDayDownload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        OrderAmountDay aNewOrderAmountDay = new OrderAmountDay(Convert.ToDateTime(reader[0]), Convert.ToInt32(reader[1]));

                        allOrderAmountAccordingToDayListViewItemList.Add(aNewOrderAmountDay.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.AllOrdderAmountAccordingToDay, a.Message));
                }
                return(false);
            }
            return(true);
        }
Пример #8
0
        public static bool YearlyPersonAllOrderAmountDowload(out List <ListViewItem> yearlyPersonAllOrderAmountListViewItemList)
        {
            yearlyPersonAllOrderAmountListViewItemList = new List <ListViewItem>();

            try
            {
                using (SqlConnection connection = new SqlConnection(QueryStrings.ServerConnetion))
                {
                    SqlCommand command = new SqlCommand(Operations.QueryStrings.YearlyPersonAllOrderAmountDowload, connection);

                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        YearlyPersonAllOrderAmount aNewYearlyPersonAllOrderAmount = new YearlyPersonAllOrderAmount(reader[0].ToString(),
                                                                                                                   Convert.ToInt32(reader[1]), Convert.ToInt32(reader[2]));

                        yearlyPersonAllOrderAmountListViewItemList.Add(aNewYearlyPersonAllOrderAmount.ListViewItemForTable);
                    }
                }
            }
            catch (Exception a)
            {
                if (ErrorHappenedevent != null)
                {
                    ErrorHappenedevent.Invoke(ErrorMessageText(DataQueries.YearlyPersonAllOrderAmount, a.Message));
                }
                return(false);
            }
            return(true);
        }