コード例 #1
0
        public void AutoCodeGenerate()
        {
            decimal AlreadyExistData = _CustomerRepository.AlreadyExistCode();
            int     code             = 1;

            if (AlreadyExistData >= 1)
            {
                var GetLastCode = _CustomerRepository.LastExistCode();
                if (GetLastCode != null)
                {
                    code = Convert.ToInt32(GetLastCode.Code);
                    code++;
                }
                txtCode.Text = code.ToString("000");
            }
            else
            {
                txtCode.Text = "001";
            }
        }