|
Posted on
2008-01-23 15:51
飛雪飄寒
阅读( 838)
评论()
编辑
收藏
举报
现在Internet正在不断地发展着,在互联网应用刚开始的时候,我们浏览的网页只是静态的,不可交互的。而现在随着技术的日益发展,将提供给网页浏览者一个可编程的Web 站点。这些站点将在组织、应用、服务、驱动上更加紧密的结合在一起,这些站点将通过一些应用软件直接连接到另一个Web 站点,这些可编程的Web 站点相比传统的web站点来说,将变得更加能重复使用,也更加智能化!
.net平台给我们提供了一种运行环境,即公用语言运行环境(CLR,Common Language Runtime)。对 CLR来说,它提供了一种内置机制来创建一个可编程的站点,对于Web 程序开发者和VB 程序员来说,这将是一致、熟悉的。这种模型是可以重复使用,也可以再扩展。 它包含了开放的Internet标准(HTTP, XML, SOAP, SDL)。以便它能被网页浏览者访问。ASP.NET 使用.asmx 文件来对Web Services的支持。.asmx 文件和.aspx文件一样都属于文本文件。它包含在.aspx文件之中,成为ASP.NET应用程序的一部分。
web service提供了在不同体系机构下构建的网站之间相互提供应用接口服务、数据的一种方案。它采用通用的SOAP、HTTP以及XML,就可以把原本互不相干的站点服务形成一整套分布的、自动化和智能化的网络应用,大大减轻了程序员的开发工作量,充分地利用了已经拥有的网络资源和开发资源。
最近我参与的一个项目中刚好使用了Web Service技术,由于自己也是刚接触不久,里面难免会有很多问题,现把代码发布出来,希望哪位高人可以指点一下,提出宝贵改进意见!
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
![](/Images/OutliningIndicators/None.gif)
namespace GZPI
![](/Images/OutliningIndicators/ExpandedBlockStart.gif) ![](/Images/OutliningIndicators/ContractedBlock.gif) {
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// GZPIService 的摘要说明。
/// </summary>
public class GZPIService : System.Web.Services.WebService
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
public GZPIService()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
//CODEGEN: 该调用是 ASP.NET Web 服务设计器所必需的
InitializeComponent();
}
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 组件设计器生成的代码#region 组件设计器生成的代码
//Web 服务设计器所必需的
private IContainer components = null;
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
}
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
if(disposing && components != null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
//---------------------------------------------------------------注册--------------------------------------------
[WebMethod(Description="添加注册信息,UserType用户类型(1个人,2企业,3人才中介),UserName用户名,Password密码,Name(1个人表示真实姓名,2企业表示单位法人代表,3人才中介代表人才中介法人代表),IdentityID(1个人表示身份证号,2企业表示单位法人码,3人才中介代表人才中介法人码),ChargeID(当为2企业时选择的人才中介法人码),CorpName单位名称,CorpKind机构类别,CorpKindCode机构类别代码,Address单位地址,ZipCode单位邮政编码,Telephone单位电话,LinkManName单位联系人姓名,LinkMaTelephone(当为1个人时表示联系电话,为2单位和3人才中介时表示联系人电话),LinkManEmail(当为1个人时表示电子邮箱,为2单位和3人才中介时表示联系人电子邮箱))")]
public bool SaveInfo(string UserType,string UserName,string Password,string Name,string IdentityID,string ChargeID,string CorpName,string CorpKind,string CorpKindCode,string Address,string ZipCode,string Telephone ,string LinkManName,string LinkMaTelephone,string LinkManEmail)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
if(UserType=="1")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.SavePersonInfo (UserName,Password,Name,IdentityID,LinkMaTelephone,LinkManEmail);
}
if(UserType=="2")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.SaveCorporationInfo (IdentityID,UserName,Password,CorpName,Name,CorpKind,CorpKindCode,Address,ZipCode,Telephone,LinkManName,LinkMaTelephone,LinkManEmail,ChargeID);
}
if(UserType=="3")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.SaveAgenciesInfo(IdentityID,UserName,Password,CorpName,Name,CorpKind,CorpKindCode,Address,ZipCode,Telephone,LinkManName,LinkMaTelephone,LinkManEmail);
}
return flag;
}
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 个人注册#region 个人注册
//该用户名是否存在[WebMethod(Description="判断个人用户名是否存在")]
private bool IsPersonUserNameExist(string name)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
string username=name.ToLower();
if(username!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string querysql="select UserName from Registry_Person where UserName= '"+ username +"' ";
DataTable dtnum=new DataTable ();
dtnum=da.ExecuteDataTable (querysql);
if(dtnum!=null&&dtnum.Rows .Count >0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 该身份证是否存在用户
/// </summary>[WebMethod(Description="判断该身份证是否存在用户")]
/// <param name="id"></param>
/// <returns></returns>
private bool IsPersonIdentityIDExist(string id)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
if(id!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string sql="select IdentityID from Registry_Person where IdentityID= '"+ id +"'";
DataTable dt=new DataTable ();
dt=da.ExecuteDataTable (sql);
if(dt!=null&&dt.Rows.Count>0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
//[WebMethod(Description="添加个人注册信息")]
private bool SavePersonInfo( string UserName,string Password,string Name,string IdentityID,string Telephone,string Email)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
if(IsPersonUserNameExist(UserName))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception ( "此用户名已经存在!");
}
if(!GZPI.Class.Common.CheckIDCard(IdentityID))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception ("身份证号码格式不正确!");
}
if(IsPersonIdentityIDExist(IdentityID))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception ( "此身份证号已经存在用户了!");
}
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//个人注册信息添加到个人注册表
string sqlreg = string.Format("insert into Registry_Person(ID,UserType,UserName,[Password],Name,IdentityID,Email,Telephone,ApplyTime,ApplyIP,ApplyStatus,Approver,ApproveTime,Memo,ApplyStatusCode) values (newid(),'学生','{0}','{1}','{2}','{3}','{4}','{5}',getdate(),null,'直接通过',null,null,null,'1')",UserName,GZPI.Class.Encode.EncodePassWord(Password) ,Name,IdentityID,Email,Telephone);
//个人注册信息添加用户表
string sqltu = string.Format("insert into TBL_USER(User_ID,User_Name,User_Name_cn,[Password],Auth_Type,EMail,Phone,Is_System,[Description],Status_Name,Status_Flag,Create_Date,Last_Updated,Department,[Schema],APP_DATA) values (newid(),'{0}','{1}','{2}',0,'{3}','{4}',0,null,'正常',0,getdate(),getdate(),null,'Person','{5}')",UserName,Name,GZPI.Class.Encode.EncodePassWord(Password),Email,Telephone,IdentityID);
da.ExecuteNonQuery (sqlreg);
da.ExecuteNonQuery(sqltu);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception (ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 企业注册#region 企业注册
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 判断用户名是否存在[WebMethod(Description="判断该企业用户名是否存在")]
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
private bool IsCorporationUserNameExist(string name)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
string username=name.ToLower();
if(username!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string querysql="select UserName from Registry_Corporation where UserName= '"+ username +"' ";
DataTable dtnum=new DataTable ();
dtnum=da.ExecuteDataTable (querysql);
if(dtnum!=null&&dtnum.Rows .Count >0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
![](/Images/OutliningIndicators/InBlock.gif)
//[WebMethod(Description="判断该企业法人码是否在法人库中")]
private bool IsCorporationCorpIDExist(string id)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
if(id!=null||id!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string querysql="select CorpID from CorporationInfo where CorpID= '"+ id +"' ";
DataTable dtnum=new DataTable ();
dtnum=da.ExecuteDataTable (querysql);
if(dtnum!=null&&dtnum.Rows .Count >0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
//[WebMethod(Description="添加企业注册信息")]
private bool SaveCorporationInfo(string CorpCode,string UserName,string Password,string CorpName,string Name,string CorpKind,string CorpKindCode,string Address,string ZipCode,string Telephone,string LinkManName,string LinkMaTelephone,string LinkManEmail,string ChargeID)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
string username="";
if(UserName==""||UserName==null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception("用户名不能为空");
}
if(CorpCode==""||CorpCode==null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception("单位法人码不能为空");
}
if(ChargeID==""||ChargeID==null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请选择人才中介机构");
}
if(!this.IsCorporationCorpIDExist (ChargeID))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "贵单位选择的人才中介机构法人码在法人库中不存在,请与广州人事局联系!");
}
if(!this.IsCorporationCorpIDExist(CorpCode))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception("贵单位的法人码在法人库中不存在,请与广州人事局联系!");
}
if(UserName!=null&&CorpCode!=null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
username=UserName+"@"+CorpCode;
}
if(this.IsCorporationUserNameExist(username))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "此用户名已经存在!");
}
![](/Images/OutliningIndicators/InBlock.gif)
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
//将企业注册信息添加到Registry_Corporation中
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
string MyInsert="insert into Registry_Corporation(id,UserType,CorpCode,ChargeID,UserName,RealName,Password,CorpName,Name,CorpType,CorpTypeCode,CorpKind,CorpKindCode,FoundDate,RegisterFund,Address,ZipCode,Telephone,LinkManName,LinkManJob,LinkMaTelephone,LinkManEmail,ApplyTime,ApplyIP,ChargeApplyStatus,ChargeApplyStatusCode)";
MyInsert += " values(newid(),'1','" + CorpCode + "','" + ChargeID+ "','"+username+"',null,'"+GZPI.Class .Encode .EncodePassWord (Password)+"','" + CorpName+ "','"+Name+"',null,null,'"+CorpKind+"','"+CorpKindCode+"'," ;
MyInsert += "null,null,'"+Address+"','"+ZipCode+"','"+Telephone+"','"+LinkManName+"',null,'"+LinkMaTelephone+"','"+LinkManEmail+"','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',null,'未审核','0')" ;
da.ExecuteNonQuery (MyInsert);
flag=true;
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 人才中介机构注册#region 人才中介机构注册
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 判断用户名是否存在[WebMethod(Description="判断该人才中介机构用户名是否存在")]
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
private bool IsAgenciesUserNameExist(string name)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
string username=name.ToLower();
if(username!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string querysql="select UserName from Registry_Corporation where UserName= '"+ username +"' ";
DataTable dtnum=new DataTable ();
dtnum=da.ExecuteDataTable (querysql);
if(dtnum!=null&&dtnum.Rows .Count >0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
![](/Images/OutliningIndicators/InBlock.gif)
//[WebMethod(Description="判断该人才中介机构法人码是否在法人库中")]
private bool IsAgenciesCorpIDExist(string id)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da=new ZsoftDataAccess.DataAccess ();
if(id!=null||id!="")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
string querysql="select CorpID from CorporationInfo where CorpID= '"+ id +"' ";
DataTable dtnum=new DataTable ();
dtnum=da.ExecuteDataTable (querysql);
if(dtnum!=null&&dtnum.Rows .Count >0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
return true;
}
}
return false;
}
//[WebMethod(Description="添加人才中介机构注册信息")]
private bool SaveAgenciesInfo(string CorpCode,string UserName,string Password,string CorpName,string Name,string CorpKind,string CorpKindCode,string Address,string ZipCode,string Telephone,string LinkManName,string LinkMaTelephone,string LinkManEmail)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
string username="";
if(UserName==""||UserName==null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "用户名不能为空");
}
if(CorpCode==""||CorpCode==null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "单位法人码不能为空");
}
if(!this.IsAgenciesCorpIDExist(CorpCode))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception("贵单位的法人码在法人库中不存在,请与广州人事局联系!");
}
if(UserName!=null&&CorpCode!=null)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
username=UserName+"@"+CorpCode;
}
if(this.IsAgenciesUserNameExist(username))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "此用户名已经存在!");
}
![](/Images/OutliningIndicators/InBlock.gif)
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
//添加人才中介的注册到Registry_Corporation中
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
string MyInsert="insert into Registry_Corporation(id,UserType,CorpCode,UserName,RealName,Password,CorpName,Name,CorpType,CorpTypeCode,CorpKind,CorpKindCode,FoundDate,RegisterFund,Address,ZipCode,Telephone,LinkManName,LinkManJob,LinkMaTelephone,LinkManEmail,ApplyTime,ApplyIP,ChargeApplyStatus,ChargeApplyStatusCode)";
MyInsert += " values(newid(),'2','" + CorpCode+ "','" + username + "',null,'"+GZPI.Class .Encode .EncodePassWord (Password)+"','" + CorpName+ "','"+Name+"',null,null,'"+CorpKind+"','"+CorpKindCode+"'," ;
MyInsert += "null,null,'"+Address+"','"+ZipCode+"','"+Telephone+"','"+LinkManName+"',null,'"+LinkMaTelephone+"','"+LinkManEmail+"','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',null,'同意','1')" ;
da.ExecuteNonQuery (MyInsert);
string usql = string.Format("insert into TBL_USER Values(newid(),'{0}','{1}','{2}',0,'{3}','{4}',0,'{1}','正常',0,getdate(),getdate(),'{1}',null,null,null,'Agencies','{5}',null)",username,CorpName,GZPI.Class.Encode.EncodePassWord(Password),LinkManEmail,LinkMaTelephone,CorpCode);
da.ExecuteNonQuery(usql);
string tsql = string.Format("insert into Business_ChargePart(ID,Name,Remark,Code,ChargeCorpID) values(newid(),'{0}','{1}','{2}','{3}')",CorpName,"人才机构",CorpCode,CorpCode);
da.ExecuteNonQuery (tsql);
flag=true;
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
//------------------------------------------------------------------------------------------------------------------
![](/Images/OutliningIndicators/InBlock.gif)
//-------------------------------------------------------修改基本信息-----------------------------------------------
[WebMethod(Description="修改基本信息,UserType用户类型(1个人,2企业,3人才中介),IdentityID(1个人时表示身份证号,2企业法人码,3人才中介法人码),Address单位地址,ZipCode单位邮政编码,Telephone单位电话,LinkManName单位联系人,LinkMaTelephone(当为1个人时表示联系电话,为2单位和3人才中介时表示联系人电话),LinkManEmail(当为1个人时表示电子邮箱,为2单位和3人才中介时表示联系人电子邮箱))")]
public bool UpdateInfo(string UserType,string IdentityID,string Address,string ZipCode,string Telephone ,string LinkManName,string LinkManPhone,string LinkManEmail)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
if(UserType=="1")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.UpdatePersonInfo (IdentityID,LinkManEmail,LinkManPhone);
}
if(UserType=="2")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.UpdateCorporationInfo (IdentityID,Address,ZipCode,Telephone,LinkManName,LinkManPhone,LinkManEmail);
}
if(UserType=="3")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.UpdateAgenciesInfo (IdentityID,Address,ZipCode,Telephone,LinkManName,LinkManPhone,LinkManEmail);
}
return flag;
}
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改个人基本信息#region 修改个人基本信息
//[WebMethod(Description="更改个人基本信息")]
private bool UpdatePersonInfo(string IdentityID,string Email,string Telephone)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//更新个人注册信息
string updatesqlreg="update Registry_Person set Email='"+Email +"',Telephone='"+Telephone +"' where IdentityID='"+IdentityID+"' ";
//更新个人用户信息
string updatesqltu="update TBL_USER set Email='"+Email +"',phone='"+Telephone +"',Last_Updated=getdate() where APP_DATA='"+IdentityID+"'";
da.ExecuteNonQuery (updatesqlreg);
da.ExecuteNonQuery(updatesqltu);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception ( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改企业基本信息#region 修改企业基本信息
//[WebMethod(Description="修改企业基本信息")]
private bool UpdateCorporationInfo(string CorpID,string Address,string ZipCode,string Telephone,string LinkManName,string LinkManPhone,string LinkManEmail)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//update CorporationInfo
string SqlInfo="update CorporationInfo set Address='"+Address+"',ZipCode='"+ZipCode+"',Telephone='"+Telephone+" 'where CorpID='"+CorpID+"' ";
//update Corp_LinkMan
string SqlLinkman="update Corp_LinkMan set LinkManName='"+LinkManName+"',LinkManPhone='"+LinkManPhone+"',LinkManEmail='"+LinkManEmail+"' where CorpID='"+CorpID+"'";
da.ExecuteNonQuery (SqlInfo);
da.ExecuteNonQuery (SqlLinkman);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改人才中介基本信息#region 修改人才中介基本信息
//[WebMethod(Description="修改人才中介机构基本信息")]
private bool UpdateAgenciesInfo(string CorpID,string Address,string ZipCode,string Telephone,string LinkManName,string LinkManPhone,string LinkManEmail)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//update CorporationInfo
string SqlInfo="update CorporationInfo set Address='"+Address+"',ZipCode='"+ZipCode+"',Telephone='"+Telephone+" 'where CorpID='"+CorpID+"' ";
//update Corp_LinkMan
string SqlLinkman="update Corp_LinkMan set LinkManName='"+LinkManName+"',LinkManPhone='"+LinkManPhone+"',LinkManEmail='"+LinkManEmail+"' where CorpID='"+CorpID+"'";
da.ExecuteNonQuery (SqlInfo);
da.ExecuteNonQuery (SqlLinkman);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
![](/Images/OutliningIndicators/InBlock.gif)
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
//---------------------------------------------------------------------------------------------------------------------
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
//--------------------------------------------------------修改密码-----------------------------------------------------
[WebMethod(Description="修改密码,UserType用户类型(1个人,2企业,3人才中介),UserName用户名,Password修改后未加密的新密码")]
public bool ChangePassword (string UserType,string UserName,string Password)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
if(UserType=="1")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag=this.ChangePersonPassword(UserName,Password);
}
if(UserType=="2")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag = this.ChangeCorporationPassword(UserName,Password);
}
if(UserType=="3")
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
flag =this.ChangeAgenciesPassword(UserName,Password);
}
return flag;
}
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改个人帐号密码#region 修改个人帐号密码
//[WebMethod(Description="更改个人密码")]
private bool ChangePersonPassword(string UserName,string Password)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//更新个人注册表密码
string updatesqlreg="update Registry_Person set [password]='"+GZPI.Class.Encode.EncodePassWord(Password )+"' where UserName='"+UserName+"'";
//更新个人用户表密码
string updatesqltu="update TBL_USER set [password]='"+GZPI.Class.Encode.EncodePassWord(Password ) +"' where User_Name='"+UserName+"'";
da.ExecuteNonQuery (updatesqlreg);
da.ExecuteNonQuery(updatesqltu);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改企业帐号密码#region 修改企业帐号密码
//[WebMethod(Description="更改企业用户密码")]
private bool ChangeCorporationPassword(string UserName,string Password)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//更新个人注册表密码
string updatesqlreg="update Registry_Corporation set [password]='"+GZPI.Class.Encode.EncodePassWord(Password )+"' where UserName='"+UserName+"'";
//更新个人用户表密码
string updatesqltu="update TBL_USER set [password]='"+GZPI.Class.Encode.EncodePassWord(Password ) +"' where User_Name='"+UserName+"'";
da.ExecuteNonQuery (updatesqlreg);
da.ExecuteNonQuery(updatesqltu);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ContractedSubBlock.gif) 修改人才中介帐号密码#region 修改人才中介帐号密码
//[WebMethod(Description="更改人才中介机构密码")]
private bool ChangeAgenciesPassword(string UserName,string Password)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
bool flag=false;
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
ZsoftDataAccess.DataAccess da =new ZsoftDataAccess.DataAccess();
//更新个人注册表密码
string updatesqlreg="update Registry_Corporation set [password]='"+GZPI.Class.Encode.EncodePassWord(Password )+"' where UserName='"+UserName+"'";
//更新个人用户表密码
string updatesqltu="update TBL_USER set [password]='"+GZPI.Class.Encode.EncodePassWord(Password ) +"' where User_Name='"+UserName+"'";
da.ExecuteNonQuery (updatesqlreg);
da.ExecuteNonQuery(updatesqltu);
flag=true;
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( ex.Message);
}
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
throw new Exception( "请检查数据的合法性!");
}
return flag;
}
#endregion
![](/Images/OutliningIndicators/InBlock.gif)
//----------------------------------------------------------------------------------------------------------------------
}
}
|