/// <summary> /// 更新一条数据 /// </summary> public int Update(Model.Wage_Model model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Stale_Wage set "); strSql.Append("Month=@Month,"); strSql.Append("EmpName=@EmpName,"); strSql.Append("BasicWage=@BasicWage,"); strSql.Append("Jobsubsidies=@Jobsubsidies,"); strSql.Append("Allowance=@Allowance,"); strSql.Append("Overtimepay=@Overtimepay,"); strSql.Append("Bonus=@Bonus,"); strSql.Append("Businesscommission=@Businesscommission,"); strSql.Append("PersonalIncomeTax=@PersonalIncomeTax,"); strSql.Append("SocialSecurity=@SocialSecurity,"); strSql.Append("Other=@Other,"); strSql.Append("Remark=@Remark"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@Month", SqlDbType.DateTime), new SqlParameter("@EmpName", SqlDbType.NVarChar, 50), new SqlParameter("@BasicWage", SqlDbType.Decimal, 9), new SqlParameter("@Jobsubsidies", SqlDbType.Decimal, 9), new SqlParameter("@Allowance", SqlDbType.Decimal, 9), new SqlParameter("@Overtimepay", SqlDbType.Decimal, 9), new SqlParameter("@Bonus", SqlDbType.Decimal, 9), new SqlParameter("@Businesscommission", SqlDbType.Decimal, 9), new SqlParameter("@PersonalIncomeTax", SqlDbType.Decimal, 9), new SqlParameter("@SocialSecurity", SqlDbType.Decimal, 9), new SqlParameter("@Other", SqlDbType.Decimal, 9), new SqlParameter("@Remark", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.ID; parameters[1].Value = model.Month; parameters[2].Value = model.EmpName; parameters[3].Value = model.BasicWage; parameters[4].Value = model.Jobsubsidies; parameters[5].Value = model.Allowance; parameters[6].Value = model.Overtimepay; parameters[7].Value = model.Bonus; parameters[8].Value = model.Businesscommission; parameters[9].Value = model.PersonalIncomeTax; parameters[10].Value = model.SocialSecurity; parameters[11].Value = model.Other; parameters[12].Value = model.Remark; if (DbHelperSQL.ExecuteCommand(strSql.ToString(), parameters) > 0) { return(1); } else { return(0); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.Wage_Model model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Stale_Wage("); strSql.Append("Month,EmpName,BasicWage,Jobsubsidies,Allowance,Overtimepay,Bonus,Businesscommission,PersonalIncomeTax,SocialSecurity,Other,Remark)"); strSql.Append(" values ("); strSql.Append("@Month,@EmpName,@BasicWage,@Jobsubsidies,@Allowance,@Overtimepay,@Bonus,@Businesscommission,@PersonalIncomeTax,@SocialSecurity,@Other,@Remark)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Month", SqlDbType.DateTime), new SqlParameter("@EmpName", SqlDbType.NVarChar, 50), new SqlParameter("@BasicWage", SqlDbType.Decimal, 9), new SqlParameter("@Jobsubsidies", SqlDbType.Decimal, 9), new SqlParameter("@Allowance", SqlDbType.Decimal, 9), new SqlParameter("@Overtimepay", SqlDbType.Decimal, 9), new SqlParameter("@Bonus", SqlDbType.Decimal, 9), new SqlParameter("@Businesscommission", SqlDbType.Decimal, 9), new SqlParameter("@PersonalIncomeTax", SqlDbType.Decimal, 9), new SqlParameter("@SocialSecurity", SqlDbType.Decimal, 9), new SqlParameter("@Other", SqlDbType.Decimal, 9), new SqlParameter("@Remark", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.Month; parameters[1].Value = model.EmpName; parameters[2].Value = model.BasicWage; parameters[3].Value = model.Jobsubsidies; parameters[4].Value = model.Allowance; parameters[5].Value = model.Overtimepay; parameters[6].Value = model.Bonus; parameters[7].Value = model.Businesscommission; parameters[8].Value = model.PersonalIncomeTax; parameters[9].Value = model.SocialSecurity; parameters[10].Value = model.Other; parameters[11].Value = model.Remark; return(DbHelperSQL.ExecuteCommand(strSql.ToString(), parameters)); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Model.Wage_Model model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.Wage_Model model) { return(dal.Add(model)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Wage_Model GetModel(string name) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,Month,EmpName,BasicWage,Jobsubsidies,Allowance,Overtimepay,Bonus,Businesscommission,PersonalIncomeTax,SocialSecurity,Other,Remark from Stale_Wage "); strSql.Append(" where EmpName=@EmpName "); SqlParameter[] parameters = { new SqlParameter("@EmpName", SqlDbType.NVarChar, 50) }; parameters[0].Value = name; Model.Wage_Model model = new Model.Wage_Model(); DataTable dt = DbHelperSQL.GetDateSet(strSql.ToString(), parameters); if (dt.Rows.Count > 0) { if (dt.Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[0]["ID"].ToString()); } if (dt.Rows[0]["Month"].ToString() != "") { model.Month = DateTime.Parse(dt.Rows[0]["Month"].ToString()); } model.EmpName = dt.Rows[0]["EmpName"].ToString(); if (dt.Rows[0]["BasicWage"].ToString() != "") { model.BasicWage = decimal.Parse(dt.Rows[0]["BasicWage"].ToString()); } if (dt.Rows[0]["Jobsubsidies"].ToString() != "") { model.Jobsubsidies = decimal.Parse(dt.Rows[0]["Jobsubsidies"].ToString()); } if (dt.Rows[0]["Allowance"].ToString() != "") { model.Allowance = decimal.Parse(dt.Rows[0]["Allowance"].ToString()); } if (dt.Rows[0]["Overtimepay"].ToString() != "") { model.Overtimepay = decimal.Parse(dt.Rows[0]["Overtimepay"].ToString()); } if (dt.Rows[0]["Bonus"].ToString() != "") { model.Bonus = decimal.Parse(dt.Rows[0]["Bonus"].ToString()); } if (dt.Rows[0]["Businesscommission"].ToString() != "") { model.Businesscommission = decimal.Parse(dt.Rows[0]["Businesscommission"].ToString()); } if (dt.Rows[0]["PersonalIncomeTax"].ToString() != "") { model.PersonalIncomeTax = decimal.Parse(dt.Rows[0]["PersonalIncomeTax"].ToString()); } if (dt.Rows[0]["SocialSecurity"].ToString() != "") { model.SocialSecurity = decimal.Parse(dt.Rows[0]["SocialSecurity"].ToString()); } if (dt.Rows[0]["Other"].ToString() != "") { model.Other = decimal.Parse(dt.Rows[0]["Other"].ToString()); } model.Remark = dt.Rows[0]["Remark"].ToString(); return(model); } else { return(null); } }