📄 personnelclass.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace HRP.BaseClass
{
class PersonnelClass
{
SqlClass sqlclass = new SqlClass();
/// <summary>
/// 人事信息查询
/// </summary>
/// <param name="strData">要查询的字段</param>
/// <param name="strKeyWord">要查询的关键字</param>
/// <returns>返回数据集</returns>
public DataSet persomelSearch(string strData,string strKeyWord)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("select * from tb_Personnel where " + strData + " like @strKeyWord", con);
SqlParameter para = new SqlParameter("@strKeyWord",SqlDbType.VarChar,20);
para.Value = strKeyWord+"%";
sda.SelectCommand.Parameters.Add(para);
DataSet ds = new DataSet();
sda.Fill(ds, "tb_Personnel");
return ds;
}
/// <summary>
///员工调动添加
/// </summary>
/// <param name="strEmployeeID">员工编号</param>
/// <param name="strEmployeeName">员工姓名</param>
/// <param name="strEmployeeWorkType">工种</param>
/// <param name="strEmployeeDept">部门</param>
/// <param name="strEmployeeDutyType">职务</param>
/// <param name="strEmployeePostTitle">职称</param>
/// <param name="strNewWorkType">新工种</param>
/// <param name="strNewDept">新部门</param>
/// <param name="strNewDutyType">新职务</param>
/// <param name="strNewPostTitle">新职称</param>
/// <param name="dtRemoveTime">调动时间</param>
/// <param name="strBooker">登记人</param>
public void RemoveAdd(string strEmployeeID, string strEmployeeName, string strEmployeeWorkType, string strEmployeeDept, string strEmployeeDutyType, string strEmployeePostTitle, string strNewWorkType, string strNewDept, string strNewDutyType, string strNewPostTitle, DateTime dtRemoveTime, string strBooker)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("insert into tb_Remove (EmployeeID,EmployeeName,EmployeeWorkType,EmployeeDept,EmployeeDutyType,EmployeePostTitle,NewWorkType,NewDept,NewDutyType,NewPostTitle,RemoveTime,Booker)values(@EmployeeID,@EmployeeName,@EmployeeWorkType,@EmployeeDept,@EmployeeDutyType,@EmployeePostTitle,@NewWorkType,@NewDept,@NewDutyType,@NewPostTitle,@RemoveTime,@Booker)",con);
scd.Parameters.Add("@EmployeeID", SqlDbType.VarChar, 5).Value = strEmployeeID;
scd.Parameters.Add("@EmployeeName", SqlDbType.VarChar, 20).Value = strEmployeeName;
scd.Parameters.Add("@EmployeeWorkType", SqlDbType.VarChar, 20).Value = strEmployeeWorkType;
scd.Parameters.Add("@EmployeeDept", SqlDbType.VarChar, 20).Value = strEmployeeDept;
scd.Parameters.Add("@EmployeeDutyType", SqlDbType.VarChar, 20).Value = strEmployeeDutyType;
scd.Parameters.Add("@EmployeePostTitle", SqlDbType.VarChar, 20).Value = strEmployeePostTitle;
scd.Parameters.Add("@NewWorkType", SqlDbType.VarChar, 20).Value = strNewWorkType;
scd.Parameters.Add("@NewDept", SqlDbType.VarChar,20).Value = strNewDept;
scd.Parameters.Add("@NewDutyType", SqlDbType.VarChar,20).Value = strNewDutyType;
scd.Parameters.Add("@NewPostTitle", SqlDbType.VarChar, 20).Value = strNewPostTitle;
scd.Parameters.Add("@RemoveTime", SqlDbType.DateTime, 8).Value = dtRemoveTime;
scd.Parameters.Add("@Booker", SqlDbType.VarChar, 20).Value = strBooker;
scd.ExecuteNonQuery();
scd.CommandText = "update tb_Personnel set EmployeeWorkType=@NewWorkType,EmployeeDept=@NewDept,EmployeeDutyType=@NewDutyType,EmployeePostTitle=@NewPostTitle where EmployeeID=@EmployeeID";
scd.ExecuteNonQuery();
}
/// <summary>
/// 调动查询
/// </summary>
/// <param name="strData">要查询的字段</param>
/// <param name="strKeyWord">要查询的关键字</param>
/// <returns></returns>
public DataSet removeSearch(string strData, string strKeyWord)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("select * from tb_Remove where " + strData + " like @strKeyWord", con);
SqlParameter para = new SqlParameter("@strKeyWord", SqlDbType.VarChar, 20);
para.Value = strKeyWord + "%";
sda.SelectCommand.Parameters.Add(para);
DataSet ds = new DataSet();
sda.Fill(ds, "tb_Remove");
return ds;
}
/// <summary>
/// 添加合同
/// </summary>
/// <param name="strEmployeeID">员工编号</param>
/// <param name="strEmployeeName">员工姓名</param>
/// <param name="strPactID">合同编号</param>
/// <param name="strPactType">合同类型</param>
/// <param name="dtPactStartTime">合同开始时间</param>
/// <param name="dtPactEndTime">合同结束时间</param>
/// <param name="strProbation">使用期</param>
/// <param name="strRemark">备注</param>
public void pactAdd(string strEmployeeID, string strEmployeeName, string strPactID, string strPactType, DateTime dtPactStartTime, DateTime dtPactEndTime, string strProbation, string strRemark)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("insert into tb_Pact (EmployeeID,EmployeeName,PactID,PactType,PactStartTime,PactEndTime,Probation,Remark,State)values(@EmployeeID,@EmployeeName,@PactID,@PactType,@PactStartTime,@PactEndTime,@Probation,@Remark,@State)",con);
scd.Parameters.Add("@EmployeeID",SqlDbType.VarChar,5).Value=strEmployeeID;
scd.Parameters.Add("@EmployeeName",SqlDbType.VarChar,20).Value=strEmployeeName;
scd.Parameters.Add("@PactID",SqlDbType.VarChar,20).Value=strPactID;
scd.Parameters.Add("@PactType",SqlDbType.VarChar,20).Value=strPactType;
scd.Parameters.Add("@PactStartTime", SqlDbType.VarChar,20).Value = dtPactStartTime;
scd.Parameters.Add("@PactEndTime", SqlDbType.VarChar, 20).Value = dtPactEndTime;
scd.Parameters.Add("@Probation",SqlDbType.VarChar,20).Value=strProbation;
scd.Parameters.Add("@Remark",SqlDbType.Text,16).Value=strRemark;
scd.Parameters.Add("@State", SqlDbType.VarChar, 4).Value = "生效";
scd.ExecuteNonQuery();
}
/// <summary>
/// 修改合同
/// </summary>
/// <param name="strEmployeeID">员工编号</param>
/// <param name="strEmployeeName">员工姓名</param>
/// <param name="strPactID">合同编号</param>
/// <param name="strPactType">合同类型</param>
/// <param name="dtPactStartTime">合同开始时间</param>
/// <param name="dtPactEndTime">合同结束时间</param>
/// <param name="strProbation">使用期</param>
/// <param name="strRemark">备注</param>
/// <param name="strState">状态</param>
public void pactEdit(string strEmployeeID, string strEmployeeName, string strPactID, string strPactType, DateTime dtPactStartTime, DateTime dtPactEndTime, string strProbation, string strRemark, string strState)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("update tb_Pact set EmployeeID=@EmployeeID,EmployeeName=@EmployeeName,PactType=@PactType,PactStartTime=@PactStartTime,PactEndTime=@PactEndTime,Probation=@Probation,Remark=@Remark,State=@State where PactID=@PactID", con);
scd.Parameters.Add("@EmployeeID", SqlDbType.VarChar, 5).Value = strEmployeeID;
scd.Parameters.Add("@EmployeeName", SqlDbType.VarChar, 20).Value = strEmployeeName;
scd.Parameters.Add("@PactID", SqlDbType.VarChar, 20).Value = strPactID;
scd.Parameters.Add("@PactType", SqlDbType.VarChar, 20).Value = strPactType;
scd.Parameters.Add("@PactStartTime", SqlDbType.VarChar, 20).Value = dtPactStartTime;
scd.Parameters.Add("@PactEndTime", SqlDbType.VarChar, 20).Value = dtPactEndTime;
scd.Parameters.Add("@Probation", SqlDbType.VarChar, 20).Value = strProbation;
scd.Parameters.Add("@Remark", SqlDbType.Text, 16).Value = strRemark;
scd.Parameters.Add("@State", SqlDbType.Text, 4).Value = strState;
scd.ExecuteNonQuery();
}
/// <summary>
/// 合同查询
/// </summary>
/// <param name="strData">要查询的字段</param>
/// <param name="strKeyWord">要查询的关键字</param>
/// <returns></returns>
public DataSet pactSearch(string strData, string strKeyWord)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("select * from tb_Pact where " + strData + " like @KeyWord", con);
SqlParameter para = new SqlParameter("@KeyWord", SqlDbType.VarChar, 20);
para.Value = strKeyWord + "%";
sda.SelectCommand.Parameters.Add(para);
DataSet ds = new DataSet();
sda.Fill(ds, "tb_Pact");
return ds;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -