Esempio n. 1
0
        private void refresh()
        {
            comboBoxWareHouseEditPrice.Items.Clear();
            comboBoxAddProd.Items.Clear();
            comboBoxViewWareHouseItem.Items.Clear();
            comboBoxIdSupplier.Items.Clear();
            comboBoxIdAffiliate.Items.Clear();
            comboBoxSelectType.Items.Clear();
            comboBoxIdAffiliateTable.Items.Clear();
            comboBoxAffiliateAddProd.Items.Clear();
            string com = "SELECT * FROM ProductSize";

            MyConnection.comboBoxLoading(comboBoxWareHouseEditPrice, com, "Продукт с размером"); //Price
            MyConnection.comboBoxLoading(comboBoxAddProd, com, "Продукт с размером");            //NumProd
            MyConnection.comboBoxLoading(comboBoxViewWareHouseItem, com, "Продукт с размером");  //TableProd
            com = "SELECT [NameCompany] FROM Supplier";
            MyConnection.comboBoxLoading(comboBoxIdSupplier, com, "NameCompany");                //Supplier
            com = "SELECT [NameAffiliate] FROM Affiliate";
            MyConnection.comboBoxLoading(comboBoxIdAffiliate, com, "NameAffiliate");             //Affiliate
            com = "SELECT [Type] FROM ProductType";
            MyConnection.comboBoxLoading(comboBoxSelectType, com, "Type");                       //TypeProd
            com = "SELECT [NameAffiliate] FROM Affiliate";
            MyConnection.comboBoxLoading(comboBoxIdAffiliateTable, com, "NameAffiliate");
            com = "SELECT [NameAffiliate] FROM Affiliate";
            MyConnection.comboBoxLoading(comboBoxAffiliateAddProd, com, "NameAffiliate"); //Affiliate
            com = $"SELECT [Id_Position], Affiliate.[NameAffiliate], [ProductName], [Type], [NameCompany], [PriceOfUnit], [NumberOfProduct] FROM WarehouseInfo join Affiliate on WarehouseInfo.[Id_Affiliate] = Affiliate.[Id_AffiliateKA]";
            MyConnection.loadingDataGridView(dataGridViewxViewWareHouseItem, com, "WarehouseInfo");
        }
Esempio n. 2
0
 private void User_Load(object sender, EventArgs e)
 {
     com = $"SELECT TOP 1 CONCAT([Surname], ' ', [Name]) FROM Buyer WHERE [Id_User] = {Class.idUser}";
     using (SqlConnection sqlConnection = new MyConnection().GetConnection())
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand(com, sqlConnection);
         labelName.Text = Convert.ToString(sqlCommand.ExecuteScalar());
         sqlConnection.Close();
     }
     com = $"select count(*) from Buyer where [Id_User] = {Class.idUser} AND [Id_PurchaseNumber] IS NOT NULL";
     using (SqlConnection sqlConnection = new MyConnection().GetConnection())
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand(com, sqlConnection);
         textBoxNumOrder.Text = Convert.ToString(sqlCommand.ExecuteScalar());
         sqlConnection.Close();
     }
     com = "SELECT [Type] FROM ProductType";
     MyConnection.comboBoxLoading(comboBoxChooseType, com, "Type");
     com = "select [ProductName] from TableProdImg";
     MyConnection.comboBoxLoading(comboBoxChooseProd, com, "ProductName");
     com = "SELECT [NameAffiliate] FROM Affiliate";
     MyConnection.comboBoxLoading(comboBoxAffiliate, com, "NameAffiliate");
 }
Esempio n. 3
0
 private void comboBoxChooseProd_SelectedIndexChanged(object sender, EventArgs e)
 {
     prodName = comboBoxChooseProd.Text;
     com      = "SELECT DISTINCT [Size] FROM Product " +
                "join Warehouse on Product.[Id_ProductKA] = Warehouse.[Id_Product]" +
                "join ProductType on Product.[Id_ProductType] = ProductType.[Id_ProductTypeKA] " +
                "join TableProdImg on ProductType.[Id_ProductTypeKA] = TableProdImg.[Id_Type] " +
                $"WHERE TableProdImg.[Id_Type] = {comboBoxChooseType.SelectedIndex + 1} AND " +
                $"TableProdImg.[ProductName] = '{comboBoxChooseProd.Text}' AND " +
                $"Product.[ProductName] = '{comboBoxChooseProd.Text}' AND " +
                $"Warehouse.[Id_Affiliate] = {affiliateId}";
     comboBoxSizeBuy.SelectedIndex = -1;
     comboBoxSizeBuy.Items.Clear();
     textBoxPriceProd.Clear();
     richTextBox.Clear();
     MyConnection.comboBoxLoading(comboBoxSizeBuy, com, "Size");
     com = "SELECT TOP 1 [PriceOfUnit] FROM Product " +
           "join ProductType on Product.[Id_ProductType] = ProductType.[Id_ProductTypeKA] " +
           "join TableProdImg on ProductType.[Id_ProductTypeKA] = TableProdImg.[Id_Type] " +
           $"WHERE TableProdImg.[Id_Type] = {comboBoxChooseType.SelectedIndex + 1} AND " +
           $"TableProdImg.[ProductName] = '{comboBoxChooseProd.Text}' AND " +
           $"Product.[ProductName] = '{comboBoxChooseProd.Text}'";
     MyConnection.textBoxLoading(textBoxPriceProd, com);
     com = "SELECT TOP 1 [Descriprion] FROM Product " +
           "join ProductType on Product.[Id_ProductType] = ProductType.[Id_ProductTypeKA] " +
           "join TableProdImg on ProductType.[Id_ProductTypeKA] = TableProdImg.[Id_Type] " +
           $"WHERE TableProdImg.[Id_Type] = {comboBoxChooseType.SelectedIndex + 1} AND " +
           $"TableProdImg.[ProductName] = '{comboBoxChooseProd.Text}' AND " +
           $"Product.[ProductName] = '{comboBoxChooseProd.Text}'";
     MyConnection.richTextBoxLoading(richTextBox, com);
 }
Esempio n. 4
0
 private void refresh()
 {
     com = "SELECT CONCAT(Buyer.[Surname], ' ', Buyer.[Name]) AS 'Ф.И.' FROM Buyer WHERE Buyer.[Id_Buyer] != 1";
     MyConnection.comboBoxLoading(comboBoxOrdersUserChoose, com, "Ф.И.");
     MyConnection.comboBoxLoading(comboBoxDeliveryChoose, com, "Ф.И.");
     com = "SELECT COUNT(*) FROM Purchase";
     MyConnection.textBoxLoading(textBoxOrders, com);
     com = "SELECT * FROM PurchaseView";
     MyConnection.loadingDataGridView(dataGridViewOrdersProducts, com, "PurchaseView");
     com = "SELECT [Номер доставки], [Ф.И.], [Адрес доставки], [Дата доставки], [Статус доставки] FROM DeliveryToBuyerView";
     MyConnection.loadingDataGridView(dataGridViewOrdersDelivery, com, "DeliveryToBuyerView");
 }
Esempio n. 5
0
 private void comboBoxChooseType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (groupBoxBasket.Enabled == false)
     {
         comboBoxChooseType.SelectedIndex = -1;
         comboBoxChooseProd.SelectedIndex = -1;
         MessageBox.Show("Выберите филиал покупки!", "Ошибка.", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (comboBoxChooseType.Text.Length > 0)
         {
             int idType = comboBoxChooseType.SelectedIndex + 1;
             com = $"SELECT [ProductName] FROM TableProdImg WHERE [Id_Type] = {idType}";
             comboBoxChooseProd.Items.Clear();
             comboBoxSizeBuy.SelectedIndex = -1;
             comboBoxSizeBuy.Items.Clear();
             textBoxPriceProd.Clear();
             richTextBox.Clear();
             MyConnection.comboBoxLoading(comboBoxChooseProd, com, "ProductName");
         }
     }
 }
Esempio n. 6
0
 private void MessAdmin_Load(object sender, EventArgs e)
 {
     MessageBox.Show("Вы, как и покупатель, видите \nтолько последнее сообщение. Старайтесь уместить свои мысли в одно сообщение.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     com = "SELECT DISTINCT Buyer.[Id_User], CONCAT(Buyer.[Surname], ' ', Buyer.[Name]) 'Чел' FROM Buyer WHERE [Id_Buyer] != 1";
     MyConnection.comboBoxLoading(comboBoxBuyer, com, "Чел");
 }