private string CheckValid() { StringBuilder sb = new StringBuilder(); ValidT VT = new ValidT(); if (VT.CheckRocID(tbRID.Text) == false) { sb.Append("身分證號:不合法\\n"); } if (VT.CheckEmail(tbEmail.Text) == false) { sb.Append("電子信箱:不合法\\n"); } return(sb.ToString()); }
//protected void btnChange_Click(object sender, EventArgs e) //{ // string script = ""; // if (btnChange.Text.Equals("變更密碼")) // { // btnChange.Text = "取消變更密碼"; // tbPWD.Enabled = true; // tbPWD.Text = ""; // tbPWD.Focus(); // //tbPWD2.Enabled = true; // script = "<script>document.querySelector('#tbPWD').value='';document.querySelector('#tbPWD2').value='';</script>"; // } // else // { // btnChange.Text = "變更密碼"; // tbPWD.Text = "*************************"; // tbPWD.Enabled = false; // //tbPWD2.Enabled = false; // script = "<script>document.querySelector('#tbPWD').value='*************************';document.querySelector('#tbPWD2').value='';</script>"; // } // Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false); //} private string CheckValid(string IDF, string Email) { StringBuilder sb = new StringBuilder(); ValidT VT = new ValidT(); if (VT.CheckRocID(IDF) == false) { sb.Append("身分證號:不合法\\n"); } if (VT.CheckEmail(Email) == false) { sb.Append("電子信箱:不合法\\n"); } return(sb.ToString()); }
private string CheckValid() { StringBuilder sb = new StringBuilder(); string Account = PureString(tbAccount.Text); string Name = PureString(tbName.Text); string RID = PureString(tbRID.Text); string Phone = PureString(tbPhone.Text); string Email = PureString(tbEmail.Text); string Title = PureString(tbTitle.Text); string R1 = PureString(tbR1.Text); string R2 = PureString(tbR2.Text); bool HasFile = tbFile.HasFile; ValidT VT = new ValidT(); if (Account.Length == 0) { sb.Append("帳號:必填\\n"); } if (Name.Length == 0) { sb.Append("姓名:必填\\n"); } if (RID.Length == 0) { sb.Append("身分證號:必填\\n"); } if (VT.CheckRocID(RID) == false) { sb.Append("身分證號:不合法\\n"); } if (Phone.Length == 0) { sb.Append("電話:必填\\n"); } if (Email.Length == 0) { sb.Append("電子信箱:必填\\n"); } if (VT.CheckEmail(Email) == false) { sb.Append("電子信箱:不合法\\n"); } List <ListItem> list = cbList.Items.Cast <ListItem>() .Where(li => li.Selected) .ToList(); if (list.Count == 0) { sb.Append("所屬角色:必填\\n"); } if (R1.Length == 0) { sb.Append("申請事由:必填\\n"); } return(sb.ToString()); }