📄 wageclass.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace HRP.BaseClass
{
class WageClass
{
SqlClass sqlclass = new SqlClass();
//新建月份工资
public void WageAdd(string MonthWage)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("select * from tb_Personnel",con);
SqlDataReader sdr=scd.ExecuteReader();
while (sdr.Read())
{
sqlclass.sqlcmd("insert into tb_Wage (MonthWage,EmployeeID,EmployeeName,BasisWage)values('" + MonthWage + "','" + Convert.ToString(sdr.GetValue(0)) + "','" + Convert.ToString(sdr.GetString(1)) + "'," + Convert.ToDouble(sdr.GetValue(25)) + ")");
sqlclass.sqlcmd("insert into tb_Attendance (MonthWage,EmployeeID,EmployeeName)values('" + MonthWage + "','" + Convert.ToString(sdr.GetValue(0)) + "','" + Convert.ToString(sdr.GetString(1)) + "')");
}
sdr.Dispose();
con.Close();
}
//查找该月份工资是否已经建立
public bool MonthWageRename(string strMonthWage)
{
bool blName;
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("select count(*) from tb_Wage where MonthWage='" + strMonthWage + "'", con);
int intCount = Convert.ToInt32(scd.ExecuteScalar());
if (intCount > 0)
{
blName = false;
}
else
{
blName = true;
}
return blName;
}
//添加奖励信息
public void HortationAdd(string strtype, string strMonthWage, string strEmployeeID, string strEmployeeName, string strHortationItem, double dbHortationNumber, string strRemark, DateTime strHortationDate)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("insert into " + strtype + " (MonthWage,EmployeeID,EmployeeName,HortationItem,HortationNumber,Remark,HortationDate)values(@MonthWage,@EmployeeID,@EmployeeName,@HortationItem,@HortationNumber,@Remark,@HortationDate)", con);
scd.Parameters.Add("@MonthWage", SqlDbType.VarChar, 15).Value = strMonthWage;
scd.Parameters.Add("@EmployeeID", SqlDbType.VarChar, 5).Value = strEmployeeID;
scd.Parameters.Add("@EmployeeName", SqlDbType.VarChar, 20).Value = strEmployeeName;
scd.Parameters.Add("@HortationItem", SqlDbType.VarChar, 20).Value = strHortationItem;
scd.Parameters.Add("@HortationNumber", SqlDbType.Money, 8).Value = dbHortationNumber;
scd.Parameters.Add("@Remark", SqlDbType.Text, 16).Value = strRemark;
scd.Parameters.Add("@HortationDate", SqlDbType.DateTime, 8).Value = strHortationDate;
scd.ExecuteNonQuery();
con.Close();
}
//修改奖励信息
public void HortationEdit(string strtype, string strid, string strMonthWage, string strEmployeeID, string strEmployeeName, string strHortationItem, double dbHortationNumber, string strRemark, DateTime strHortationDate)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlCommand scd = new SqlCommand("update " + strtype + " set MonthWage=@MonthWage,HortationItem=@HortationItem,HortationNumber=@HortationNumber,Remark=@Remark,HortationDate=@HortationDate where ID=@ID", con);
scd.Parameters.Add("@ID", SqlDbType.Int,4).Value = strid;
scd.Parameters.Add("@MonthWage", SqlDbType.VarChar, 15).Value = strMonthWage;
scd.Parameters.Add("@HortationItem", SqlDbType.VarChar, 20).Value = strHortationItem;
scd.Parameters.Add("@HortationNumber", SqlDbType.Money, 8).Value = dbHortationNumber;
scd.Parameters.Add("@Remark", SqlDbType.Text, 16).Value = strRemark;
scd.Parameters.Add("@HortationDate", SqlDbType.DateTime, 8).Value = strHortationDate;
scd.ExecuteNonQuery();
con.Close();
}
//查询奖励信息
public DataSet HortationSearch(string strtype, string strData, string strKeyWord)
{
SqlConnection con = sqlclass.SqlConBind();
con.Open();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("select * from " + strtype + " 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, strtype);
return ds;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -