public TOperRes UploadEmp(TEmpInfo empInfo) { var ret = new TOperRes { bok = true }; //拷贝一份 var einf = new DormManage.Data.DAL.TEmpInfo { Employee_ID = empInfo.Employee_ID, Chinese_Name = empInfo.Chinese_Name, English_Name = empInfo.English_Name, IDCardNumber = empInfo.IDCardNumber, Segment = empInfo.Segment, Hire_Date = empInfo.Hire_Date, EmployeeTypeName = empInfo.EmployeeTypeName, SrcImport = 1 /*0-GBSHR import, 1--multek import, 2--ChangSha import*/ }; var sErr = string.Empty; ret.bok = mStaffingDal.UploadEmpInfo(einf, out sErr); ret.msg = sErr; return(ret); }
public bool UploadEmpInfo(TEmpInfo empInfo, out string sErr) { sErr = string.Empty; if (null == empInfo || string.IsNullOrEmpty(empInfo.Chinese_Name) || string.IsNullOrEmpty(empInfo.Employee_ID) || string.IsNullOrEmpty(empInfo.IDCardNumber) ) { sErr = "工号、中文名、身份证证号不能为空!"; return(false); } try { var db = DBO.GetInstance(); DbCommand dbCommandWrapper = null; string sSql = @"INSERT INTO [TB_LongEmployee] ([Employee_ID],[English_Name],[Chinese_Name],[Segment],[Hire_Date],[EmployeeTypeName],[IDCardNumber],[SrcImport]) VALUES (@Employee_ID,@English_Name,@Chinese_Name,@Segment,@Hire_Date,@EmployeeTypeName,@IDCardNumber,@SrcImport) "; dbCommandWrapper = db.GetSqlStringCommand(sSql); db.AddInParameter(dbCommandWrapper, "@Employee_ID", DbType.String, empInfo.Employee_ID); db.AddInParameter(dbCommandWrapper, "@English_Name", DbType.String, empInfo.English_Name); db.AddInParameter(dbCommandWrapper, "@Chinese_Name", DbType.String, empInfo.Chinese_Name); db.AddInParameter(dbCommandWrapper, "@Segment", DbType.String, empInfo.Segment); db.AddInParameter(dbCommandWrapper, "@Hire_Date", DbType.Date, empInfo.Hire_Date); db.AddInParameter(dbCommandWrapper, "@EmployeeTypeName", DbType.String, empInfo.EmployeeTypeName); db.AddInParameter(dbCommandWrapper, "@IDCardNumber", DbType.String, empInfo.IDCardNumber); db.AddInParameter(dbCommandWrapper, "@SrcImport", DbType.Int32, empInfo.SrcImport); return(db.ExecuteNonQuery(dbCommandWrapper) > 0); } catch (Exception ex) { sErr = ex.Message; return(false); } }