📄 personapply.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections ;
namespace Hr.component
{
public class PersonApply:DatabaseOperation
{
public PersonApply()
{
//空的构造函数
}
public static DataSet GetPersonApplyInfo()
{
String strsql;
strsql="SELECT * FROM PersonApply";
try
{
return ExecuteReturnDS(strsql);
}
catch
{
throw new Exception("读取信息发生错误!");
}
}
public DataRow GetPersonInfo(int personId)
{
DataSet myDs;
strSQL = "SELECT name,sex,email,phone,address,addrNum from PersonApply Where personID=" + personId.ToString();
try
{
myDs = ExecuteReturnDS(strSQL);
return myDs.Tables[0].Rows[0];
}
catch
{
throw new Exception("读取信息发生错误!");
}
}
public DataRow GetMyResume(int personId)
{
DataSet myDs;
strSQL = "SELECT education,strong,experience,introduction from PersonApply Where personID=" + personId.ToString();
try
{
myDs = ExecuteReturnDS(strSQL);
return myDs.Tables[0].Rows[0];
}
catch
{
throw new Exception("读取信息发生错误!");
}
}
public DataRow GetMyCareer(int personId)
{
DataSet myDs;
strSQL = "SELECT type,workPosition,workCity,wage,other,publicTime,lookTimes from PersonApply Where personID=" + personId.ToString();
try
{
myDs = ExecuteReturnDS(strSQL);
return myDs.Tables[0].Rows[0];
}
catch
{
throw new Exception("读取信息发生错误!");
}
}
public void UpdatePersonInfo(ArrayList tempary)
{
SqlConnection myConn=new SqlConnection(strConn);
SqlCommand myCm=new SqlCommand("updatePBaseInfo",myConn);
myCm.CommandType =CommandType.StoredProcedure ;
myCm.Parameters.Add(new SqlParameter("@personID",SqlDbType.Int));
myCm.Parameters["@personID"].Value =tempary[0];
myCm.Parameters.Add(new SqlParameter("@name",SqlDbType.VarChar,10));
myCm.Parameters["@name"].Value =tempary[1];
myCm.Parameters.Add(new SqlParameter("@sex",SqlDbType.VarChar,5));
myCm.Parameters["@sex"].Value =tempary[2];
myCm.Parameters.Add(new SqlParameter("@email",SqlDbType.VarChar,50));
myCm.Parameters["@email"].Value =tempary[3];
myCm.Parameters.Add(new SqlParameter("@phone",SqlDbType.VarChar,20));
myCm.Parameters["@phone"].Value =tempary[4];
myCm.Parameters.Add(new SqlParameter("@address",SqlDbType.VarChar,50));
myCm.Parameters["@address"].Value =tempary[5];
myCm.Parameters.Add(new SqlParameter("@addrNum",SqlDbType.VarChar,10));
myCm.Parameters["@addrNum"].Value =tempary[6];
try
{
myConn.Open() ;
myCm.ExecuteNonQuery() ;
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
finally
{
myCm.Dispose() ;
myConn.Close() ;
}
}
public void UpdateMyResume(ArrayList tempary)
{
SqlConnection myConn=new SqlConnection(strConn);
SqlCommand myCm=new SqlCommand("updatePResume",myConn);
myCm.CommandType =CommandType.StoredProcedure ;
myCm.Parameters.Add(new SqlParameter("@personID",SqlDbType.Int));
myCm.Parameters["@personID"].Value =tempary[0];
myCm.Parameters.Add(new SqlParameter("@education",SqlDbType.VarChar,20));
myCm.Parameters["@education"].Value =tempary[1];
myCm.Parameters.Add(new SqlParameter("@strong",SqlDbType.Text));
myCm.Parameters["@strong"].Value =tempary[2];
myCm.Parameters.Add(new SqlParameter("@experience",SqlDbType.Text));
myCm.Parameters["@experience"].Value =tempary[3];
myCm.Parameters.Add(new SqlParameter("@introduction",SqlDbType.Text));
myCm.Parameters["@introduction"].Value =tempary[4];
try
{
myConn.Open() ;
myCm.ExecuteNonQuery() ;
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
finally
{
myCm.Dispose() ;
myConn.Close() ;
}
}
public void UpdateMyCareer(ArrayList tempary)
{
SqlConnection myConn=new SqlConnection(strConn);
SqlCommand myCm=new SqlCommand("updatePCareer",myConn);
myCm.CommandType =CommandType.StoredProcedure ;
myCm.Parameters.Add(new SqlParameter("@personID",SqlDbType.Int));
myCm.Parameters["@personID"].Value =tempary[0];
myCm.Parameters.Add(new SqlParameter("@type",SqlDbType.VarChar,50));
myCm.Parameters["@type"].Value =tempary[1];
myCm.Parameters.Add(new SqlParameter("@workPosition",SqlDbType.VarChar,50));
myCm.Parameters["@workPosition"].Value =tempary[2];
myCm.Parameters.Add(new SqlParameter("@workCity",SqlDbType.VarChar,50));
myCm.Parameters["@workCity"].Value =tempary[3];
myCm.Parameters.Add(new SqlParameter("@wage",SqlDbType.VarChar,50));
myCm.Parameters["@wage"].Value =tempary[4];
myCm.Parameters.Add(new SqlParameter("@other",SqlDbType.Text));
myCm.Parameters["@other"].Value =tempary[5];
myCm.Parameters.Add(new SqlParameter("@publicTime",SqlDbType.DateTime)); //
myCm.Parameters["@publicTime"].Value =tempary[6];
try
{
myConn.Open() ;
myCm.ExecuteNonQuery() ;
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
finally
{
myCm.Dispose() ;
myConn.Close() ;
}
}
public DataView GetNewInfo10()
{
String strsql;
DataSet myDs;
strsql="select top 10 PersonApplyID,name,workPosition,education from PersonApply order by PersonApplyID desc";
myDs=ExecuteReturnDS(strsql);
return myDs.Tables[0].DefaultView ;
}
public DataRow GetInfoDetail(string personID)
{
string strsql;
DataSet myDs;
try
{
strsql="select * from PersonApply where PersonApply.personID="+personID;
myDs=ExecuteReturnDS(strsql);
return myDs.Tables[0].Rows[0];
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
}
public static void Hits(string personId)
{
strSQL = "Update PersonApply set lookTimes=lookTimes+1 Where PersonID= " + personId;
try
{
ExecuteNonQuery(strSQL);
}
catch
{
throw new Exception("更新发生错误!");
}
}
public static DataSet SearchPersonInfo(string Msg)
{
string str;
str="select * from PersonApply where name like '%" + Msg + "%' or workPosition like '%" + Msg + "%' or workCity like '%" + Msg + "%' or education like '%" + Msg + "%' ";
DataSet myDs;
myDs=ExecuteReturnDS(str);
return myDs;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -