Example #1
0
        string Tang_Ma_Tu_Dong()
        {
            string ma = SP.GetMa("SELECT TOP 1 MA_SAN_PHAM FROM KHO_SAN_PHAM ORDER BY MA_SAN_PHAM DESC");

            if (ma == "")
            {
                return("SP001");
            }
            else
            {
                string s = ma.Substring(2, ma.Length - 2);
                int    i = int.Parse(s);
                i++;
                if (i < 10)
                {
                    return("SP00" + Convert.ToString(i));
                }
                else
                if (i < 100)
                {
                    return("SP0" + Convert.ToString(i));
                }
                else
                {
                    return("SP" + Convert.ToString(i));
                }
            }
        }