コード例 #1
0
ファイル: frmCreate_User.xaml.cs プロジェクト: dangtq72/Shop
 bool CheckValidate_F()
 {
     try
     {
         if (txtFullName.Text == "")
         {
             NoteBox.Show("Tên đầy đủ không được để trống không được để trống", "Lỗi", NoteBoxLevel.Error);
             txtFullName.Focus();
             return(false);
         }
         else if (txtUserName.Text == "")
         {
             NoteBox.Show("Tên đăng nhập không được để trống không được để trống", "Lỗi", NoteBoxLevel.Error);
             txtUserName.Focus();
             return(false);
         }
         else if (txtUserName.Text.Contains(" "))
         {
             NoteBox.Show("Tên đăng nhập không được chứa dấu cách", "Lỗi", NoteBoxLevel.Error);
             txtUserName.Focus();
             return(false);
         }
         else if (c_type == Convert.ToInt16(Form_Type.Insert) && !CheckUserNotSame(txtUserName.Text.Trim()))
         {
             NoteBox.Show("Tên đăng nhập đã tồn tại trong CSDL", "Lỗi", NoteBoxLevel.Error);
             txtUserName.Focus();
             return(false);
         }
         else if (txtPass.Text == "")
         {
             NoteBox.Show("Mật khẩu không được để trống không được để trống");
             txtPass.Focus();
             return(false);
         }
         else if (CheckValidate.checkAllSpace(txtPass.Text))
         {
             NoteBox.Show("Mật khẩu không được chứa toàn dấu cách", "Lỗi", NoteBoxLevel.Error);
             txtPass.Focus();
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
         return(false);
     }
 }
コード例 #2
0
        private bool GroupUser_CheckValidate()
        {
            try
            {
                string name = txtName.Text;
                if (name == "")
                {
                    NoteBox.Show("Tên nhóm người dùng không được để trống", "Lỗi", NoteBoxLevel.Error);
                    txtName.Focus();
                    return(false);
                }
                else if (CheckValidate.checkAllSpace(name))
                {
                    NoteBox.Show("Tên nhóm người dùng không được chứa toàn dấu cách", "Lỗi", NoteBoxLevel.Error);
                    txtName.Clear();
                    txtName.Focus();
                    return(false);
                }

                else if (!CheckNameNotSame(txtName.Text.Trim().ToUpper()))
                {
                    NoteBox.Show("Tên nhóm người dùng đã tồn tại trong cơ sở dữ liệu", "Lỗi", NoteBoxLevel.Error);
                    txtName.Focus();
                    return(false);
                }

                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(false);
            }
        }