Example #1
0
        string TaoMaDGMoi()
        {
            DocGiaDAO book = new DocGiaDAO();
            string    old  = book.getMaxMaDG();

            old = old.TrimStart('D');
            old = old.TrimStart('G');
            int newCode = int.Parse(old);

            newCode += 1;
            string code = "DG";

            if (newCode < 10)
            {
                code = code + "00" + newCode;
            }
            else if (newCode < 100)
            {
                code = code + "0" + newCode;
            }
            else
            {
                code = code + newCode;
            }
            return(code);
        }