Beispiel #1
0
        static void Main(string[] args)
        {
            var           products         = new Products();
            StringBuilder output           = new StringBuilder();
            int           numberOfCommands = int.Parse(Console.ReadLine());

            for (int i = 0; i < numberOfCommands; i++)
            {
                var      commandAndParams = Console.ReadLine().Split(new[] { ' ' }, 2).ToArray();
                string[] commandParams    = commandAndParams[1].Split(';').ToArray();
                switch (commandAndParams[0])
                {
                case "AddOrder":
                    products.AddProduct(commandParams[0], decimal.Parse(commandParams[1]), commandParams[2]);
                    break;

                case "DeleteOrders":
                    products.DeleteConsumer(commandParams[0]);

                    break;

                case "FindOrdersByPriceRange":
                    products.FilterFromMinToMax(decimal.Parse(commandParams[0]), decimal.Parse(commandParams[1]));

                    break;

                case "FindOrdersByConsumer":
                    products.FilterByConsumer(commandParams[0]);
                    break;
                }
            }
            Console.WriteLine(output.ToString());
        }
 /// <summary>
 /// This method invokes method for adding product.
 /// </summary>
 public void SaveExecute()
 {
     try
     {
         products.AddProduct(Product);
         addProductView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #3
0
        public async Task <IActionResult> PostProducts([FromBody] ProductsModel product)
        {
            if (product == null || product.Equals(""))
            {
                return(BadRequest("PRODUCTO NO VALIDO"));
            }
            else
            {
                await ServiceProduct.AddProduct(product);

                return(Ok("PRODUCTO REGISTRADO EXITOSAMENTE"));
            }
        }
Beispiel #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (grv.RowCount <= 0)
            {
                XtraMessageBox.Show("Please add some product first!");
                return;
            }

            Server2Client sc  = new Server2Client();
            Products      prd = new Products();


            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                Product p = new Product();
                p.CategoryID   = Convert.ToInt32(grv.GetRowCellValue(i, colCAT));
                p.ProductName  = grv.GetRowCellValue(i, colPNM).ToString();
                p.BuyingValue  = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                p.SellingValue = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                p.Quantity     = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                p.BarCode      = grv.GetRowCellValue(i, colBCD).ToString();

                sc = prd.AddProduct(p);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }
            }

            XtraMessageBox.Show("Product(s) added successfully!");

            grd.DataSource = null;
            grd.Refresh();
            lueCAT.EditValue = null;
            txtPNM.EditValue = null;
            txtBVL.EditValue = 0;
            txtSVL.EditValue = 0;
            txtQTY.EditValue = 1;
            txtBCD.EditValue = null;
            lueCAT.Focus();
        }
 private void ButtonAdd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var name       = TextBoxName.Text;
         var code       = TextBoxCode.Text;
         var ean        = TextBoxEan.Text;
         var price      = double.Parse(TextBoxPrice.Text);
         var unit       = (Product.Unit)Enum.Parse(typeof(Product.Unit), ComboBoxUnit.Text);
         var quantity   = double.Parse(TextBoxQuantity.Text);
         var newProduct = new Product(name, code, ean, price, quantity, unit);
         Products.AddProduct(newProduct);
         Close();
         MessageBox.Show("Produkt został dodany pomyślnie.", "Sukces!");
         Added = true;
     }
     catch (Exception exception)
     {
         MessageBox.Show("Sprawdź poprawność wprowadzonych danych.\nSzczegóły: " + exception.Message, "Błąd!");
     }
 }
Beispiel #6
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Server2Client sc   = new Server2Client();
            Purchases     purc = new Purchases();
            Purchase      prc  = new Purchase();
            Products      prd  = new Products();

            prc.InvoiceNo    = txtINV.Text;
            prc.PurchaseDate = dtpPDT.DateTime;
            prc.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
            prc.Amount       = Convert.ToDouble(txtAMT.EditValue);
            prc.Payment      = Convert.ToDouble(txtPAM.EditValue);
            prc.Balance      = Convert.ToDouble(txtBAL.EditValue);

            sc = purc.addPurchase(prc);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            SupplierAccounts sac = new SupplierAccounts();
            SupplierAccount  sa  = new SupplierAccount();
            Supplier         sup = new Supplier();

            sa.SupplierID  = Convert.ToInt32(lueSUP.EditValue);
            sa.TransDate   = dtpPDT.DateTime;
            sa.Description = "Invoice No " + txtINV.Text;
            sa.Debit       = Convert.ToDouble(txtAMT.EditValue);
            sa.Credit      = Convert.ToDouble(txtPAM.EditValue);
            sa.Balance     = SupplierBalance + Convert.ToDouble(txtBAL.Text);
            sc             = sac.addTrans(sa);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            Guid g;

            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                int    cid = Convert.ToInt32(grv.GetRowCellValue(i, colCID));
                string pnm = grv.GetRowCellValue(i, colPNM).ToString();
                double bvl = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                double svl = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                int    qty = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                double amt = Convert.ToDouble(grv.GetRowCellValue(i, colAMT));
                string bcd = grv.GetRowCellValue(i, colBCD).ToString();

                PurchaseDetail pdt = new PurchaseDetail();
                pdt.InvoiceNo    = txtINV.Text;
                g                = Guid.NewGuid();
                pdt.ProductCode  = g.ToString();
                pdt.BuyingValue  = bvl;
                pdt.SellingValue = svl;
                pdt.Quantity     = qty;
                pdt.Amount       = amt;
                sc               = purc.addPurchaseDetails(pdt);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }

                Product p = new Product();
                p.CategoryID   = cid;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.ProductCode  = g.ToString();
                p.ProductName  = pnm;
                p.BuyingValue  = bvl;
                p.SellingValue = svl;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.Quantity     = qty;
                p.BarCode      = bcd;

                sc = prd.AddProduct(p);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }
            }

            XtraMessageBox.Show("Product(s) purchased successfully!");
            InitInvoice();
            dtpPDT.DateTime = DateTime.Now.Date;
            dt = new DataTable();
            InitDataTable();
            InitSuppliers();
            InitCategories();
            grd.DataSource = null;
        }
Beispiel #7
0
    public bool InsertProduct(Product p, string imageName)
    {
        Products productManager = new Products();

        return(productManager.AddProduct(p, imageName));
    }
Beispiel #8
0
        public static void Start()
        {
Again:
            Console.WriteLine("1- Mehsullar uzerinde emeliyyat aparmaq");
            Console.WriteLine("2-Satislar uzerinde emeliyyat aparmaq");
            Console.WriteLine("3-Sistemden cixmaq");
            Console.WriteLine("Reqem daxil et");
            string a = Console.ReadLine();

            if (a == "1")
            {
                Console.WriteLine("Mehsullar uzerinde emeliyyat aparmaq");
                Console.WriteLine("1-Yeni mehsul elave et");
                Console.WriteLine("2-Mehsul uzerinde duzelis et");
                Console.WriteLine("3-Mehsulu sil");
                Console.WriteLine("4-Butun mehsullari goster");
                Console.WriteLine("5-Categoriyasina gore mehsullari goster");
                Console.WriteLine("6-Qiymet araligina gore mehsullari goster");
                Console.WriteLine("7-Mehsullar arasinda ada gore axtaris et");
                string a1 = Console.ReadLine();
                switch (a1)

                {
                case "1":
                    Products product1 = new Products();
                    //Products product2 = new Products();
                    product1.AddProduct(product1);
                    //product2.AddProduct(product2);

                    Console.WriteLine($"{product1.Name},{product1.Price },{ product1.Number}");
                    goto Again;
                    break;


                case "2":
                    Console.WriteLine("2-Mehsul uzerinde duzelis et");
                    break;

                case "3":
                    Console.WriteLine("3-Mehsulu sil");
                    break;

                case "4":
                    Products product = new Products();
                    product.ShowProduct(product);

                    Console.WriteLine("==========");


                    break;

                case "5":
                    Console.WriteLine("5-Categoriyasina gore mehsullari goster");
                    break;

                case "6":
                    Console.WriteLine("6-Qiymet araligina gore mehsullari goster");
                    break;

                case "7":
                    Console.WriteLine("7-Mehsullar arasinda ada gore axtaris et");
                    break;

                default:
                    Console.WriteLine("Duzgun reqem daxil edin{1,2,3,4,5,6,7}");
                    break;
                }
                goto Again;
            }
            else if (a == "2")
            {
                Console.WriteLine("Satislar uzerinde emeliyyat aparmaq");
            }
            else if (a == "3")
            {
                Console.WriteLine("Sistemden cixmaq");
            }
            else
            {
                Console.WriteLine("Duzgun reqem daxil edin edin");
            }
        }