Пример #1
0
        public void DeleteMenu()
        {
            int id;

            while (true)
            {
                menu_control.PrintMenu(true);
                Console.Write("---------------------------------------------------------------------------------------------------\n");
                Console.Write("\nNhập ID sản phẩm muốn xóa: ");
                id = Int32.Parse(Console.ReadLine());
                if (menu_control.FindProduct(id) == null)
                {
                    Console.WriteLine("ID sai. Mời nhập lại");
                    continue;
                }
                PrintProductInfo(menu_control.FindProduct(id));
                Console.WriteLine("\nNhấn enter để xóa.....");
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.Enter)
                {
                    Console.WriteLine("Đã xóa thành công...");
                    System.Threading.Thread.Sleep(500);
                    break;
                }
            }
            menu_control.DeleteProductInfo(id);
        }
        public void CreateReceiptDetailInfo(int idProduct, int qtyProduct)
        {
            if (listReceiptDetail.Count == 0)
            {
                ReceiptDetail.ID = 0;
            }
            else
            {
                ReceiptDetail.ID = listReceiptDetail[listReceiptDetail.Count - 1].idRecept;
            }
            int           total             = qtyProduct * menu_manage.FindProduct(idProduct).sellValue;
            ReceiptDetail receiptdetail     = new ReceiptDetail(menu_manage.FindProduct(idProduct), qtyProduct, total);
            ReceiptDetail tempreceiptdetail = new ReceiptDetail((menu_manage.FindProduct(idProduct)), qtyProduct, total);

            IOMethod.Instance.WriteData <ReceiptDetail>(pathDetail, receiptdetail);
            listReceiptDetail.Add(receiptdetail);
            tempListReceiptDetail.Add(tempreceiptdetail);
        }