using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
using System.Drawing;
|
using System.Data.SqlClient;
|
using System.IO;
|
|
namespace DAL
|
{
|
public class ClsK3_Employee_View:DBUtility.ClsGy_Base_View
|
{
|
|
//
|
public Model.ClsK3_Employee_Model omodel = new Model.ClsK3_Employee_Model();
|
public List<Model.ClsK3_Employee_Model> oEmpList;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
public ClsK3_Employee_View()
|
{
|
base.MvarReportTitle = "职员设置";
|
base.MvarItemKey = "h_v_K3_Employee";
|
base.SQLName = "Select HItemID,HNumber 职员代码,HName 职员,HEmpNo 工号 from h_v_K3_Employee where HStopflag=0 ";
|
base.SQLOrder = " order by HNumber";
|
base.SQLList = "Select * from " + MvarItemKey + " ";
|
//下拉SQL
|
base.SQLNameForDown = " Select top 30 HItemID,HNumber 职员代码,HName 职员 from h_v_K3_Employee ";
|
base.SQLOrderForDown = " Order by HNumber ";
|
base.SQLWhereForDown = " where HStopflag=0 ";
|
}
|
//
|
public void Dispose()
|
{
|
GC.SuppressFinalize(this);
|
}
|
//
|
|
//返回项目信息
|
public override bool GetInfoByID(Int64 sItemID)
|
{
|
DataSet DS ;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HItemID='" + sItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
//根据代码返回项目信息
|
public override bool GetInfoByNumber(string sNumber)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HNumber='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//根据考勤号返回项目信息
|
public bool GetInfoByEmpNo(string sNumber)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HEmpNo='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//返回职员根据班组oEmpList
|
public bool GetInfoByGroup(long sGroupID)
|
{
|
oEmpList = new List<Model.ClsK3_Employee_Model>();
|
oEmpList.Clear();
|
try
|
{
|
DataSet DS;
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopFlag=0 and HGroupID='" + sGroupID + "' order by HNumber", "Gy_Employee");
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
|
{
|
omodel = new Model.ClsK3_Employee_Model();
|
omodel.HItemID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[i]["HItemID"]);
|
omodel.HNumber = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HNumber"]);
|
omodel.HName = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HName"]);
|
omodel.HEmpRate = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[i]["HEmpRate"]);
|
omodel.HPostID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[i]["HPostID"]);
|
omodel.HEmpType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HEmpType"].ToString());
|
oEmpList.Add(omodel);
|
}
|
DS.Dispose();
|
DS = null;
|
return true;
|
}
|
}
|
catch (Exception e)
|
{
|
return false;
|
}
|
}
|
|
|
|
//返回职员根据部门oEmpList
|
public bool GetInfoByDept(long sDeptID, Int64 sYear, Int64 sPeriod)
|
{
|
oEmpList = new List<Model.ClsK3_Employee_Model>();
|
oEmpList.Clear();
|
try
|
{
|
DataSet DS;
|
DS = oCn.RunProcReturn("exec h_p_Pay_GetEmpInfoByDept " + sDeptID.ToString() + "," + sYear.ToString() + "," + sPeriod.ToString(), "h_v_K3_Employee");
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
|
{
|
omodel = new Model.ClsK3_Employee_Model();
|
omodel.HItemID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[i]["HItemID"]);
|
omodel.HNumber = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HNumber"]);
|
omodel.HName = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HName"]);
|
omodel.HEmpNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HEmpNo"]);
|
omodel.HEmpRate = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[i]["HEmpRate"]);
|
//omodel.HPostID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[i]["HPostID"]);
|
//omodel.HEmpType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HEmpType"].ToString());
|
oEmpList.Add(omodel);
|
}
|
DS.Dispose();
|
DS = null;
|
return true;
|
}
|
}
|
catch (Exception e)
|
{
|
return false;
|
}
|
}
|
|
//返回项目信息
|
public override bool GetInfo(DataSet DS)
|
{
|
try
|
{
|
omodel = new Model.ClsK3_Employee_Model();
|
omodel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]);
|
omodel.HNumber =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HNumber"]) ;
|
omodel.HName = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HName"]);
|
//omodel.HShortNumber =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HShortNumber"] );
|
//omodel.HLevel =DBUtility.ClsPub.isInt(DS.Tables[0].Rows[0]["HLevel"]);
|
//omodel.HEmpRate = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HEmpRate"]);
|
//omodel.HBasePay = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HBasePay"]);
|
//omodel.HExamRate = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HExamRate"]);
|
//omodel.HInsurance = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HInsurance"]);
|
//omodel.HMedicare = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HMedicare"]);
|
//omodel.HOtherDeduct3 = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HOtherDeduct3"]);
|
//omodel.HDrydock = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HDrydock"]);
|
omodel.HParentID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HParentID"]);
|
//omodel.HEndflag = (bool)DS.Tables[0].Rows[0]["HEndflag"];
|
//omodel.HNoBrushFlag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HNoBrushFlag"]);
|
omodel.HStopflag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HStopflag"]);
|
//omodel.HShiftFlag =DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HShiftFlag"]);
|
omodel.HRemark = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]);
|
//omodel.HHelpCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HHelpCode"] );
|
//omodel.HOverType = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HOverType"]); //(bool)DS.Tables[0].Rows[0]["HOverType"];
|
//omodel.HStopwagesFlag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HStopwagesFlag"]); // (bool)DS.Tables[0].Rows[0]["HStopwagesFlag"];
|
|
//omodel.HBirthDay = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HBirthDay"]);
|
//omodel.HGradDate = Convert.ToDateTime(DS.Tables[0].Rows[0]["HGradDate"].ToString().Trim());
|
//omodel.HInsuranceDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HInsuranceDate"]);
|
//omodel.HContractBDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HContractBDate"]);
|
//omodel.HContractEDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HContractEDate"]);
|
//omodel.HJobCardEDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HJobCardEDate"]);
|
//omodel.HCheckCardEDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HCheckCardEDate"]);
|
//omodel.HStayCardEDate = Convert.ToDateTime(DS.Tables[0].Rows[0]["HStayCardEDate"].ToString().Trim());
|
//omodel.HHealthCardEDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HHealthCardEDate"]);
|
|
//omodel.HDutyID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HDutyID"].ToString());
|
//omodel.HDormID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HDormID"].ToString());
|
//omodel.HAge = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HAge"].ToString());
|
//omodel.HContractYear = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HContractYear"].ToString());
|
//omodel.HInsuranceStatus = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HInsuranceStatus"].ToString());
|
//omodel.HSignStatus = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HSignStatus"].ToString());
|
|
//omodel.HEmpType =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HEmpType"] );
|
//omodel.HPayType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HPayType"] );
|
//omodel.HWorkType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HWorkType"] );
|
//omodel.HDimissionReason =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HDimissionReason"] );
|
//omodel.HSalaryLev = DS.Tables[0].Rows[0]["HSalaryLev"].ToString().Trim();
|
//omodel.HMarr =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HMarr"] );
|
//omodel.HBlighty = DS.Tables[0].Rows[0]["HBlighty"].ToString().Trim();
|
//omodel.HNation = DS.Tables[0].Rows[0]["HNation"].ToString().Trim();
|
//omodel.HBlightyType = DS.Tables[0].Rows[0]["HBlightyType"].ToString().Trim();
|
//omodel.HGovStatus = DS.Tables[0].Rows[0]["HGovStatus"].ToString().Trim();
|
//omodel.HBloodType = DS.Tables[0].Rows[0]["HBloodType"].ToString().Trim();
|
//omodel.HStature = DS.Tables[0].Rows[0]["HStature"].ToString().Trim();
|
//omodel.HAvoird = DS.Tables[0].Rows[0]["HAvoird"].ToString().Trim();
|
//omodel.HKnowLev = DS.Tables[0].Rows[0]["HKnowLev"].ToString().Trim();
|
//omodel.HProTitleID = DS.Tables[0].Rows[0]["HProTitleID"].ToString().Trim();
|
//omodel.HGradSchool = DS.Tables[0].Rows[0]["HGraDSchool"].ToString().Trim();
|
//omodel.HEngLev = DS.Tables[0].Rows[0]["HEngLev"].ToString().Trim();
|
//omodel.HCompLev = DS.Tables[0].Rows[0]["HCompLev"].ToString().Trim();
|
//omodel.HSpec = DS.Tables[0].Rows[0]["HSpec"].ToString().Trim();
|
//omodel.HNowAdd =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HNowAdd"] );
|
//omodel.HHomeAdd =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HHomeAdd"] );
|
//omodel.HOldCompany = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HOldCompany"]);
|
//omodel.HInsuranceNo =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HInsuranceNo"] );
|
//omodel.HJobCardNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HJobCardNo"] );
|
//omodel.HArchivesNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HArchivesNo"] );
|
|
//omodel.HInComDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HInComDate"]);
|
//omodel.HRelDate = Convert.ToDateTime(DS.Tables[0].Rows[0]["HRelDate"].ToString().Trim());
|
//omodel.HDimissionDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HDimissionDate"]);
|
//omodel.HLinkPhone =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HLinkPhone"] );
|
omodel.HSex = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSex"]);
|
//omodel.HIDCard =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HIDCard"] );
|
//omodel.HBirthDay = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HBirthDay"]);
|
//omodel.HPostID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HPostID"].ToString());
|
//omodel.HMobilePhone =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HMobilePhone"] );
|
//omodel.HFax = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HFax"] );
|
//omodel.HPostalCode =DBUtility.ClsPub.isStrNull( DS.Tables[0].Rows[0]["HPostalCode"] );
|
//omodel.HEmail = DS.Tables[0].Rows[0]["HEmail"].ToString().Trim();HPostID
|
//omodel.HBank = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBank"] );
|
//omodel.HBankAccount = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBankAccount"] );
|
omodel.HGroupID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HGroupID"].ToString());
|
omodel.HGroupName = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HGroupName"]);
|
omodel.HDeptID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HDeptID"].ToString());
|
//omodel.HCTPrjID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HCTPrjID"].ToString());
|
//omodel.HWorkTypeID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HWorkTypeID"].ToString());
|
//omodel.HHighestPay = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HHighestPay"]);
|
//omodel.HOverPayRate = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HOverPayRate"]);
|
//omodel.HLeftMoneyRate = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HLeftMoneyRate"]);
|
//omodel.HInsuranceSubsidy = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HInsuranceSubsidy"]);
|
//omodel.HExamLevPostMoney = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HExamLevPostMoney"].ToString());
|
//omodel.HEmpNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HEmpNo"]);
|
|
|
List<Image> oList = Get_Image(" select * from Gy_EmpPic where HEmpID=" + omodel.HItemID.ToString(), "HPic");
|
if (oList != null)
|
{
|
foreach (Image i in oList)
|
{
|
omodel.HPic = i;
|
}
|
}
|
else
|
{
|
omodel.HPic = null;
|
}
|
|
DS.Dispose();
|
DS = null;
|
return true;
|
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
//读取 fieldName 该字段中符合条件的所有图片(sql SQL查询语句、fieldName 存储图片字段名)
|
public List<Image> Get_Image(string sql, string fieldName)
|
{
|
List<Image> InformatoinCollection = new List<Image>();
|
try
|
{
|
Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper();
|
string s = "";
|
SqlDataReader dr = oCn.RunReader(sql, "gy_czygl", ref s);
|
|
if (!dr.HasRows)
|
{
|
return null;
|
}
|
|
while (dr.Read())
|
{
|
MemoryStream ms1 = new MemoryStream((byte[])dr[fieldName]);
|
Image image = Image.FromStream(ms1, true);
|
InformatoinCollection.Add(image);
|
}
|
dr.Close();
|
}
|
catch
|
{
|
InformatoinCollection = null;
|
}
|
return InformatoinCollection;
|
}
|
}
|
}
|