using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
///
/// 工资多表联查数据访问类
///
public class ViewWageService
{
///
/// 查询所有
///
/// sql语句
/// 可变参数数组
/// 返回集合
List excuteSql(string sql, params SqlParameter[] param)
{
return ServiceBase.excuteSql(new ViewWage(), "ViewWage", sql, CommandType.Text, param);
}
///
/// 获取单个对象
///
/// sql语句
/// 可变参数数组
/// 返回空或者单个对象
ViewWage excuteType(string sql, params SqlParameter[] param)
{
//查询结果放入对象集合
List vwList = excuteSql(sql, param);
//判断集合是否为空
if (vwList == null || vwList.Count == 0)
//返回null
return null;
//返回单个对象
return vwList[0];
}
///
/// 根据编号查询对象信息
///
/// 对象编号
/// 返回空或者对象信息
public List GetByIdStr(string idStr,int company,int company2)
{
//调用获取单个对象的方法
return excuteSql("select REPLACE (w.YearMonth,'-','') as YearMonth,SUBSTRING(w.StartDate,9,10) + '-' + SUBSTRING(w.EndDate,9,10) as Date,u.Number as UserNumber,u.CnName as UserName,w.Basic,w.Floats,w.PostAllowance,w.GarmentWashSubsidies,w.CommunicationSubsidies,w.TrafficSubsidies,w.InformationSecurityFee,w.OperationBonus,w.SpecialAllowance,w.OtherSubsidies,w.Should,w.WithholdingInsurance,w.SickLeave,w.SomethingFalse,w.LateTo,w.LeaveEarly,w.NotPunch,w.Absenteeism,w.OtherDeductions,w.TotalDeductions,w.TotalRealHair,u.Company,w.Mealsupplement,w.Tax,w.AfterTax,w.Gongjijin,w.GroupCost from Wage w join Users u on w.UserId = u.Id where w.Id in (" + idStr + ") and u.Company <> " + company + " and u.Company <> " + company2 + "");
}
}
}