📄 givejobinfo.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using My.Hr.DbBase;
using System.Collections ;
namespace My
{
/// <summary>
/// Book description for book。
/// </summary>
public class GiveJobInfo:Base
{
public GiveJobInfo()
{
}
//get all data of books
public static DataSet GetGiveJobInfo()
{
String strsql;
strsql="SELECT * FROM giveJobInfo";
try
{
return ExecuteSql4Ds(strsql);
}
catch
{
throw new Exception("Get all the Information failed!");
}
}
//from companyID get GiveJobInfo
public DataRow GetMyBaseInfo(int companyId)
{
DataSet myDs;
strSQL = "SELECT companyName,vocation,email,phone,address,addrNum from GiveJobInfo Where companyID=" + companyId.ToString();
try
{
myDs = ExecuteSql4Ds(strSQL);
return myDs.Tables[0].Rows[0];
}
catch
{
throw new Exception("Get information failed!");
}
}
public DataRow GetMyCareer(int companyId)
{
DataSet myDs;
strSQL = "SELECT workPosition,giveNum,workCity,discribe,request,publicTime,lookTimes from GiveJobInfo Where companyID=" + companyId.ToString();
try
{
myDs = ExecuteSql4Ds(strSQL);
return myDs.Tables[0].Rows[0];
}
catch
{
throw new Exception("Get information failed!");
}
}
/////////////update info/////////////////////////////////////
public void UpdateMyBaseInfo(ArrayList tempary)
{
SqlConnection myCn=new SqlConnection(strConn);
SqlCommand myCm=new SqlCommand("updateCBaseInfo",myCn);
myCm.CommandType =CommandType.StoredProcedure ;
myCm.Parameters.Add(new SqlParameter("@companyID",SqlDbType.Int));
myCm.Parameters["@companyID"].Value =tempary[0];
myCm.Parameters.Add(new SqlParameter("@companyName",SqlDbType.VarChar,50));
myCm.Parameters["@companyName"].Value =tempary[1];
myCm.Parameters.Add(new SqlParameter("@vocation",SqlDbType.VarChar,50));
myCm.Parameters["@vocation"].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,50));
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,50));
myCm.Parameters["@addrNum"].Value =tempary[6];
try
{
myCn.Open() ;
myCm.ExecuteNonQuery() ;
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
finally
{
myCm.Dispose() ;
myCn.Close() ;
}
}
public void UpdateMyCareer(ArrayList tempary)
{
SqlConnection myCn=new SqlConnection(strConn);
SqlCommand myCm=new SqlCommand("updateCCareer",myCn);
myCm.CommandType =CommandType.StoredProcedure ;
myCm.Parameters.Add(new SqlParameter("@companyID",SqlDbType.Int));
myCm.Parameters["@companyID"].Value =tempary[0];
myCm.Parameters.Add(new SqlParameter("@workPosition",SqlDbType.VarChar,50));
myCm.Parameters["@workPosition"].Value =tempary[1];
myCm.Parameters.Add(new SqlParameter("@giveNum",SqlDbType.VarChar,50));
myCm.Parameters["@giveNum"].Value =tempary[2];
myCm.Parameters.Add(new SqlParameter("@workCity",SqlDbType.VarChar,50));
myCm.Parameters["@workCity"].Value =tempary[3];
myCm.Parameters.Add(new SqlParameter("@discribe",SqlDbType.Text));
myCm.Parameters["@discribe"].Value =tempary[4];
myCm.Parameters.Add(new SqlParameter("@request",SqlDbType.Text));
myCm.Parameters["@request"].Value =tempary[5];
myCm.Parameters.Add(new SqlParameter("@publicTime",SqlDbType.DateTime)); //
myCm.Parameters["@publicTime"].Value =tempary[6];
myCm.Parameters.Add(new SqlParameter("@lookTimes",SqlDbType.Int));
myCm.Parameters["@lookTimes"].Value =tempary[7];
try
{
myCn.Open() ;
myCm.ExecuteNonQuery() ;
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
finally
{
myCm.Dispose() ;
myCn.Close() ;
}
}
//////////////////////////////////////////////////////////////////////////////////////
//get top ten best salers
public DataView GiveJobInfoTop10()
{
String strsql;
DataSet myDs;
strsql="select top 10 giveJobInfoID,companyName,vocation,workPosition from giveJobInfo order by lookTimes DESC";
myDs=ExecuteSql4Ds(strsql);
return myDs.Tables[0].DefaultView ;
}
public DataView GetNewInfo10()
{
String strsql;
DataSet myDs;
strsql="select top 10 giveJobInfoID,companyName,vocation,workPosition from giveJobInfo order by giveJobInfoID desc";
myDs=ExecuteSql4Ds(strsql);
return myDs.Tables[0].DefaultView ;
}
public DataRow GetInfoDetail(string companyID)
{
string strsql;
DataSet myDs;
try
{
strsql="select * from giveJobInfo where giveJobInfo.companyID="+companyID;
myDs=ExecuteSql4Ds(strsql);
return myDs.Tables[0].Rows[0];
}
catch(System.Data.SqlClient.SqlException er)
{
throw new Exception(er.Message);
}
}
/// <summary>
/// Add book hits
/// </summary>
/// <param name="bookId">book ID</param>
/// <returns></returns>
public static void Hits(string giveJobInfoID)
{
strSQL = "Update giveJobInfo set lookTimes=lookTimes+1 Where giveJobInfoID= " + giveJobInfoID;
try
{
ExecuteSql4Ds(strSQL);
}
catch
{
throw new Exception("Hits FAILED!!");
}
}
/// <summary>
/// Search Book By name,author,translator,publisher
/// </summary>
/// <param name="Msg"></param>
/// <returns></returns>
public static DataSet SearchCompanyInfo(string Msg)
{
string str;
str="select * from giveJobInfo where companyName like '%" + Msg + "%' or workPosition like '%" + Msg + "%' or workCity like '%" + Msg + "%' or request like '%" + Msg + "%' ";
DataSet myDs;
myDs=ExecuteSql4Ds(str);
return myDs;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -