private void show() { try { string sql = " "; if (txtMainName.Text.Trim() != "") { sql += string.Format(" and mainName like '%{0}%'", txtMainName.Text); } if (txtFrom.Text != "") { if (CommHelp.VerifesToDateTime(txtFrom.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('创建时间 格式错误!');</script>"); return; } sql += string.Format(" and createTime>='{0} 00:00:00'", txtFrom.Text); } if (txtTo.Text != "") { if (CommHelp.VerifesToDateTime(txtTo.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('创建时间 格式错误!');</script>"); return; } sql += string.Format(" and createTime<='{0} 23:59:59'", txtTo.Text); } if (ddlFolders.Text != "0") { sql += string.Format(" and tb_Attachment.folder_Id={0}", ddlFolders.Text); } tb_AttachmentService attSer = new tb_AttachmentService(); List <tb_Attachment> atts = attSer.GetListArray(sql); gvList.DataSource = atts; gvList.DataBind(); } catch (Exception) { } }
/// <summary> /// 判断单据号信息 /// </summary> /// <returns></returns> public bool CheckProNo(string ProNo) { ProNo = ProNo.Trim(); if (string.IsNullOrEmpty(ProNo)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('单据号不能为空!');</script>")); return(false); } if (ProNo.Length > 8) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('单据号长度为8位,请重新填写!');</script>")); return(false); } if (CommHelp.VerifesToNum(ProNo) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('单据号的格式为4位年份+4位数字,请重新填写!');</script>")); return(false); } return(true); }
public bool FormCheck() { if (this.txtUserid.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户账号!');</script>"); this.txtUserid.Focus(); return(false); } if (this.txtUserName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户名称!');</script>"); this.txtUserName.Focus(); return(false); } if (txtPwd.Enabled != false && this.txtPwd.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写用户密码!');</script>"); this.txtPwd.Focus(); return(false); } if (this.txtZhiwu.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写职务!');</script>"); this.txtZhiwu.Focus(); return(false); } if (this.ddlReportTo.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写所属上级!');</script>"); this.ddlReportTo.Focus(); return(false); } if (this.txtTel.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写电话!');</script>"); this.txtTel.Focus(); return(false); } if (this.txtEMail.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写E-Mail!');</script>"); this.txtEMail.Focus(); return(false); } if (!string.IsNullOrEmpty(txtSchoolDate.Text)) { if (CommHelp.VerifesToDateTime_1(txtSchoolDate.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('毕业时间 格式错误!');</script>"); return(false); } } if (!string.IsNullOrEmpty(txtWorkDate.Text)) { if (CommHelp.VerifesToDateTime_1(txtWorkDate.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('参加工作时间 格式错误!');</script>"); return(false); } } if (!string.IsNullOrEmpty(txtCreateTime.Text)) { if (CommHelp.VerifesToDateTime_1(txtCreateTime.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('建档时间 格式错误!');</script>"); return(false); } } if (base.Request["UserId"] != null) { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginId='{0}' and id <>{1}", this.txtUserid.Text, base.Request["UserId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号" + this.txtUserid.Text + "已存在,请重新填写!');</script>"); this.txtUserid.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginName='{0}' and id <>{1}", this.txtUserName.Text, base.Request["UserId"]))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户名" + this.txtUserName.Text + "已存在,请重新填写!');</script>"); this.txtUserName.Focus(); return(false); } } else { if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginId='{0}'", this.txtUserid.Text))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号" + this.txtUserid.Text + "已存在,请重新填写!');</script>"); this.txtUserid.Focus(); return(false); } if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from tb_User where loginName='{0}'", this.txtUserName.Text))) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户名" + this.txtUserName.Text + "已存在,请重新填写!');</script>"); this.txtUserName.Focus(); return(false); } } return(true); }
/// <summary> /// 判断项目编码信息 /// </summary> /// <returns></returns> public bool CheckPoNO(string PONO) { PONO = PONO.Trim(); if (PONO.ToLower().Contains("kc")) { if (PONO.Length > 11) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('KC项目编码长度为12位,请重新填写!');</script>")); return(false); } if (PONO != "") { string head = PONO.Substring(0, 2); if (head.ToLower() == "kc") { if (PONO.Length > 2 && CommHelp.VerifesToNum(PONO.Substring(2)) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('项目编号的格式为KC+4位年份(大于2012年)+5位数字,请重新填写!');</script>")); return(false); } } else { if (CommHelp.VerifesToNum(PONO.Substring(0)) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('项目编号的格式为KC+4位年份(大于2012年)+5位数字,请重新填写!');</script>")); return(false); } } } } else { if (PONO.Length > 10) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('项目编码长度为10位,请重新填写!');</script>")); return(false); } if (PONO != "") { string head = PONO.Substring(0, 1); if (head.ToLower() == "p") { if (PONO.Length > 1 && CommHelp.VerifesToNum(PONO.Substring(1)) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('项目编号的格式为P+4位年份(大于2012年)+5位数字,请重新填写!');</script>")); return(false); } } else { if (CommHelp.VerifesToNum(PONO.Substring(0)) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('项目编号的格式为P+4位年份(大于2012年)+5位数字,请重新填写!');</script>")); return(false); } } } } return(true); }