/* * 方法名称:DeletePayroll * 方法功能描述:删除工资项 * * 创建人:杨林 * 创建时间:2009-03-12 * * 修改人: * 修改时间: * 修改内容: * */ /// <summary> /// 删除工资项 /// </summary> /// <param name="id">工资项标识数组</param> /// <returns>返回错误描述,如果为空串则为执行成功</returns> public string DeletePayroll(long[] id) { try { HumanResourceDataContext oHumanContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn); // Query the database for the rows to be deleted. var deletePayroll = from items in oHumanContext.PayrollAdd where id.Contains(items.id) select items; foreach (var item in deletePayroll) { oHumanContext.PayrollAdd.DeleteOnSubmit(item); } oHumanContext.SubmitChanges(); return(""); } catch (System.Data.SqlClient.SqlException) { throw; } finally { } }
/* * 方法名称:InsertPayroll * 方法功能描述:插入工资项 * * 创建人:杨林 * 创建时间:2009-03-12 * * 修改人: * 修改时间: * 修改内容: * */ /// <summary> /// 插入工资项 /// </summary> /// <param name="arg">工资项实体类</param> /// <returns>返回错误描述,如果为空串则为执行成功</returns> public string InsertPayroll(PayrollAdd arg) { try { HumanResourceDataContext oHumanContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn); oHumanContext.ObjectTrackingEnabled = false; var result = from item in oHumanContext.PayrollAdd.AsQueryable <PayrollAdd>() where item.name == arg.name select item.name; if (result.Count() > 0) { return("指定工资项名称己存在!"); } oHumanContext.ObjectTrackingEnabled = true; oHumanContext.PayrollAdd.InsertOnSubmit(arg); oHumanContext.SubmitChanges(); return(""); } catch (System.Data.SqlClient.SqlException) { throw; } finally { } }
/// <summary> /// 添加新员工 /// </summary> /// <param name="entity"></param> public void Insert(PersonnelInfo entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { oContext.PersonnelInfo.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 插入部门信息 /// </summary> /// <param name="entity"></param> public void Insert(Department entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { oContext.Department.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 插入模板 /// </summary> /// <param name="entity"></param> public void Insert(DasherStation.HumanResource.SalaryItemTemplet entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { oContext.SalaryItemTemplet.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 插入生产班组信息 /// </summary> /// <param name="entity"></param> public void InsertYieldGroup(ProduceTeam entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { //entity.inputDate = DateTime.Now; oContext.ProduceTeam.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 插入职位信息 /// </summary> /// <param name="entity"></param> public void InsertPosition(Position entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { //entity.inputDate = DateTime.Now; oContext.Position.InsertOnSubmit(entity); oContext.SubmitChanges(); } }
/// <summary> /// 更新员工 /// </summary> /// <param name="entity"></param> public void Update(PersonnelInfo entity) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn)) { PersonnelInfo ori = (from p in oContext.PersonnelInfo where p.id == entity.id select p).First(); ori.no = entity.no; ori.name = entity.name; ori.address = entity.address; ori.basicSalary = entity.basicSalary; ori.birthday = entity.birthday; ori.competencyCertificate = entity.competencyCertificate; ori.contactMethod = entity.contactMethod; ori.contractNo = entity.contractNo; ori.dId = entity.dId; ori.dimissionDate = entity.dimissionDate; ori.dimissionReason = entity.dimissionReason; ori.function = entity.function; ori.functionAssessDate = entity.functionAssessDate; ori.hortationCastigate = entity.hortationCastigate; ori.IDCard = entity.IDCard; ori.judgeMarry = entity.judgeMarry; ori.kind = entity.kind; ori.mark = entity.mark; ori.nationality = entity.nationality; ori.nativePlace = entity.nativePlace; ori.pId = entity.pId; ori.politicalVisage = entity.politicalVisage; ori.ptId = entity.ptId; ori.remark = entity.remark; ori.resume = entity.resume; ori.salaryMethod = entity.salaryMethod; ori.sex = entity.sex; ori.specialty = entity.specialty; ori.startWorkDate = entity.startWorkDate; ori.tiptopDegree = entity.tiptopDegree; ori.workDate = entity.workDate; try { oContext.SubmitChanges(); } catch (System.Data.Linq.ChangeConflictException) { throw; } } }
/// <summary> /// 删除职位信息 /// </summary> /// <param name="id"></param> public void DeletePosition(int[] id) { HumanResourceDataContext oHumanContext = new HumanResourceDataContext(this.strConn); var deleting = from item in oHumanContext.Position where id.Contains((int)item.id) select item; foreach (var item in deleting) { oHumanContext.Position.DeleteOnSubmit(item); } oHumanContext.SubmitChanges(); }
/// <summary> /// 审核工资 /// </summary> /// <param name="gatherID"></param> public void Assess(long gatherID, bool bPass, string strHumanName) { using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn)) { PayOffGather2 result; bool bExist = false; result = (from item in oContext.PayOffGather2 where item.pogid == gatherID select item).FirstOrDefault(); if (result == null) { result = new PayOffGather2(); result.pogid = gatherID; } else { bExist = true; } if (bPass) { result.inputman = strHumanName; result.assessor = strHumanName; result.assessordate = DateTime.Now; result.checkupdate = null; result.checkupman = null; } else { result.assessor = null; result.assessordate = null; result.checkupdate = null; result.checkupman = null; } if (bExist == false) { oContext.PayOffGather2.InsertOnSubmit(result); } oContext.SubmitChanges(); } }