客户管理系统的数验证(OperateAndValidate.cs)
2008-11-22 17:17
375 查看
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using CrystalDecisions.CrystalReports.Engine;
namespace CRM.BaseClass
{
class OperateAndValidate
{
BaseOperate boperate = new BaseOperate();
public void cboxBind(string P_str_sqlstr, string P_str_table, string P_str_tbMember, ComboBox cbox)
{
DataSet myds = boperate.getds(P_str_sqlstr, P_str_table);
cbox.DataSource = myds.Tables[P_str_table];
cbox.DisplayMember = P_str_tbMember;
}
public bool validateNum(string P_str_num)
{
return Regex.IsMatch(P_str_num, " ^[0-9]*$");
}
public bool validatePhone(string P_str_phone)
{
return Regex.IsMatch(P_str_phone, @"/d{3,4}-/d{7,8}");
}
public bool validateFax(string P_str_fax)
{
return Regex.IsMatch(P_str_fax, @"86-/d{2,3}-/d{7,8}");
}
public bool validatePostCode(string P_str_postcode)
{
return Regex.IsMatch(P_str_postcode, @"/d{6}");
}
public bool validateEmail(string P_str_email)
{
return Regex.IsMatch(P_str_email, @"/w+([-+.']/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*");
}
public bool validateNAddress(string P_str_naddress)
{
return Regex.IsMatch(P_str_naddress, @"http(s)?://([/w-]+/.)+[/w-]+(/[/w- ./?%&=]*)?");
}
public void autoNum(string P_str_sqlstr, string P_str_table, string P_str_tbColumn, string P_str_codeIndex, string P_str_codeNum, TextBox txt)
{
string P_str_Code = "";
int P_int_Code = 0;
DataSet myds = boperate.getds(P_str_sqlstr, P_str_table);
if (myds.Tables[0].Rows.Count == 0)
{
txt.Text = P_str_codeIndex + P_str_codeNum;
}
else
{
P_str_Code = Convert.ToString(myds.Tables[0].Rows[myds.Tables[0].Rows.Count - 1][P_str_tbColumn]);
P_int_Code = Convert.ToInt32(P_str_Code.Substring(2, 7)) + 1;
P_str_Code = P_str_codeIndex + P_int_Code.ToString();
txt.Text = P_str_Code;
}
}
public ReportDocument CrystalReports(string P_str_creportName, string P_str_sql)
{
ReportDocument reportDocument = new ReportDocument();
string P_str_creportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("//")).LastIndexOf("//"));
P_str_creportPath += @"/SumManage/CReportFile/" + P_str_creportName;
reportDocument.Load(P_str_creportPath);
reportDocument.DataDefinition.RecordSelectionFormula = P_str_sql;
return reportDocument;
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using CrystalDecisions.CrystalReports.Engine;
namespace CRM.BaseClass
{
class OperateAndValidate
{
BaseOperate boperate = new BaseOperate();
public void cboxBind(string P_str_sqlstr, string P_str_table, string P_str_tbMember, ComboBox cbox)
{
DataSet myds = boperate.getds(P_str_sqlstr, P_str_table);
cbox.DataSource = myds.Tables[P_str_table];
cbox.DisplayMember = P_str_tbMember;
}
public bool validateNum(string P_str_num)
{
return Regex.IsMatch(P_str_num, " ^[0-9]*$");
}
public bool validatePhone(string P_str_phone)
{
return Regex.IsMatch(P_str_phone, @"/d{3,4}-/d{7,8}");
}
public bool validateFax(string P_str_fax)
{
return Regex.IsMatch(P_str_fax, @"86-/d{2,3}-/d{7,8}");
}
public bool validatePostCode(string P_str_postcode)
{
return Regex.IsMatch(P_str_postcode, @"/d{6}");
}
public bool validateEmail(string P_str_email)
{
return Regex.IsMatch(P_str_email, @"/w+([-+.']/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*");
}
public bool validateNAddress(string P_str_naddress)
{
return Regex.IsMatch(P_str_naddress, @"http(s)?://([/w-]+/.)+[/w-]+(/[/w- ./?%&=]*)?");
}
public void autoNum(string P_str_sqlstr, string P_str_table, string P_str_tbColumn, string P_str_codeIndex, string P_str_codeNum, TextBox txt)
{
string P_str_Code = "";
int P_int_Code = 0;
DataSet myds = boperate.getds(P_str_sqlstr, P_str_table);
if (myds.Tables[0].Rows.Count == 0)
{
txt.Text = P_str_codeIndex + P_str_codeNum;
}
else
{
P_str_Code = Convert.ToString(myds.Tables[0].Rows[myds.Tables[0].Rows.Count - 1][P_str_tbColumn]);
P_int_Code = Convert.ToInt32(P_str_Code.Substring(2, 7)) + 1;
P_str_Code = P_str_codeIndex + P_int_Code.ToString();
txt.Text = P_str_Code;
}
}
public ReportDocument CrystalReports(string P_str_creportName, string P_str_sql)
{
ReportDocument reportDocument = new ReportDocument();
string P_str_creportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("//")).LastIndexOf("//"));
P_str_creportPath += @"/SumManage/CReportFile/" + P_str_creportName;
reportDocument.Load(P_str_creportPath);
reportDocument.DataDefinition.RecordSelectionFormula = P_str_sql;
return reportDocument;
}
}
}
相关文章推荐
- OperateAndValidate.cs 操作验证
- jquery.validate 表单验证管理
- Java SSM 商户管理系统 客户管理 库存管理 销售报表 项目源码
- java图书管理系统登录界面和验证
- 人事档案管理系统总结(二)---用文档和客户交流
- CCM,企业客户沟通管理系统
- CRM系统:全方位管理客户,不错失一单
- 客户管理系统之模块设计(九)
- 做客户管理系统遇到的各种蛋筒问题
- 【银行管理系统】先实现一个普通窗口为普通客户服务,快速Vip类比
- 提高客户管理系统应用价值的五种方法
- 客户管理系统案例总结
- 人性化的验证(Validate)系统
- JSP小项目实战---客户信息管理系统
- Hibernate_day01讲义_使用Hibernate完成对CRM系统中客户管理的DAO中的CRUD的操作
- 续易crm源码客户资源管理系统crm源码(源代码c#)
- 实验三:学生工作管理系统asp和asp.cs代码
- 工作流管理在自来水营销管理系统(客户服务中心)中的应用(原创)
- 穆利堂[推荐]WxCSM客户服务整体解决方案-河南郑州房地产客户服务管理系统软件-穆穆-movno1