Exemplo n.º 1
0
 private string SinhMaTuDong()
 {
     try
     {
         string code = "";
         QueriesTableAdapter queries = new QueriesTableAdapter();
         string numbermax            = queries.GetMaLoaiCauThuMax().ToString();
         if (numbermax != "")
         {
             int temp = int.Parse(numbermax) + 1;
             code = "000" + temp;
             code = "LCT" + code.Substring(code.Length - 3);
         }
         else
         {
             code = "LCT001";
         }
         return(code);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     return(null);
 }
        private string SinhMaTuDong()
        {
            try
            {
                string code = "";
                QueriesTableAdapter queries = new QueriesTableAdapter();
                string numbermax = queries.GetMaLoaiCauThuMax().ToString();
                if (numbermax != "")
                {

                    int temp = int.Parse(numbermax) + 1;
                    code = "000" + temp;
                    code = "LCT" + code.Substring(code.Length - 3);
                }
                else
                {
                    code = "LCT001";
                }
                return code;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return null;
        }