Пример #1
0
        public static CQueryDef SaveProductsSoldCount(OutputProduct Product)
        {
            var sql = string.Format(@"UPDATE [Products] SET Products_Sold = Products_Sold + {0} WHERE Product_Key = {1}",
                                    Product.Count, Product.Product_Key);

            return(new CQueryDef(sql, CSqlReader.SqlStorage.ExecuteNonQuery));
        }
Пример #2
0
        public static CQueryDef SaveIntoSaleProducts(OutputInvoice Invoice, OutputProduct Product)
        {
            var sql = string.Format(@"INSERT INTO Sale_Products(Product_Key, Count, Price, Sale_Key) VALUES('{0}', '{1}', '{2}', '{3}')",
                                    Product.Product_Key, Product.Count, Product.Price, Invoice.SaleKey);

            return(new CQueryDef(sql, CSqlReader.SqlStorage.ExecuteNonQuery));
        }
        private void BUT_AddProduct_Click(object sender, EventArgs e)
        {
            if (CValidate.Validate(CB_Client.Text != String.Empty &&
                                   CB_ClientKey.Text != String.Empty &&
                                   CB_ProductName.Text != String.Empty &&
                                   CB_ProductKey.Text != String.Empty &&
                                   TB_Price.Text != String.Empty &&
                                   TB_Discount.Text != String.Empty &&
                                   TB_PriceWithDiscount.Text != String.Empty &&
                                   NUD_Count.Value >= 1))
            {
                var clientID   = _queries.ClientsIdByName(CB_Client.Text);
                var productKey = _queries.ProductKeyByName(CB_ProductName.Text);

                OutputProduct outputProduct = new OutputProduct(
                    DTM_SaleProduct.Value,
                    CB_Client.Text,
                    clientID,
                    CB_ProductKey.Text,
                    CB_ProductName.Text,
                    decimal.Parse(TB_PriceWithDiscount.Text),
                    long.Parse(NUD_Count.Value.ToString()),
                    productKey);

                outputProducts.Add(outputProduct);
                LB_Product_List.Items.Add(outputProduct.Name);
                LB_ProductCount.Items.Add(outputProduct.Count);

                CB_ProductName.Text       = String.Empty;
                CB_ProductKey.Text        = String.Empty;
                TB_Price.Text             = String.Empty;
                TB_PriceWithDiscount.Text = String.Empty;
                NUD_Count.Value           = 1;
            }
        }