Пример #1
0
        public static void deleteInvoice(string invNo)
        {
            string        filePath = @"../../myInvoice.txt";
            List <string> listInv  = new List <string>();

            listInv = File.ReadAllLines(filePath).ToList();


            if (Invoice.chkinvNo(invNo))
            {
                Invoice rs = inqInvoice(invNo);
                //get lib index of the candidate book for modifying
                int inv_index = MyInvoice.find_InvIndex(invNo);
                rs.invStatus = 2;
                MyInvoice.myinv[inv_index].invStatus = 2;

                listInv[inv_index] = $"{rs.invNo}#{rs.invType}#{rs.invTotalAmount}#{rs.issueDate}#{rs.invStatus}";
                File.WriteAllLines(filePath, listInv);

                Console.WriteLine("Da xoa thong tin Hoa Don");
            }
            else
            {
                Console.WriteLine("Khong co thong tin Hoa Don tuong ung");
            }
        }
Пример #2
0
        // chi cho sua ten nguoi phat hanh hoa don
        public static void updateInvoice(string invNo)
        {
            string        filePath = @"../../myInvoice.txt";
            List <string> listInv  = new List <string>();

            listInv = File.ReadAllLines(filePath).ToList();
            if (Invoice.chkinvNo(invNo))
            {
                Invoice rs = inqInvoice(invNo);
                //get lib index of the candidate book for modifying
                int inv_index = MyInvoice.find_InvIndex(invNo);
                Console.Write("Nhap Ten Nguoi Lap Hoa Don moi: ");
                string Issuer = Console.ReadLine();
                while (Issuer.Length > 20)
                {
                    Console.Write("\nVui long nhap ten duoi 20 ky tu");
                    Issuer = Console.ReadLine();
                }
                rs.Issuer          = Issuer;
                listInv[inv_index] = $"{rs.invNo}#{rs.invType}#{rs.invTotalAmount}#{rs.issueDate}#{rs.invStatus}#{rs.Issuer}";
                File.WriteAllLines(filePath, listInv);

                Console.WriteLine(" Sua thong tin Hoa Don hoan tat");
            }
            else
            {
                Console.WriteLine("Khong co thong tin Hoa Don tuong ung");
            }
        }