Example #1
0
 /// <summary>
 /// 获取全部员工实体列表
 /// </summary>
 /// <returns></returns>
 public List <PersonnelInfo> QueryEmployees()
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var result = from item in oContext.PersonnelInfo
                      orderby item.id descending
                      select item;
         return(result.ToList());
     }
 }
Example #2
0
 /// <summary>
 /// 判断工资是否已审核
 /// </summary>
 /// <param name="gatherID"></param>
 /// <returns></returns>
 public bool IsAssess(long gatherID)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn))
     {
         var result = (from item in oContext.PayOffGather2
                       where item.pogid == gatherID && item.assessor != null
                       select item);
         return(result.Count() > 0);
     }
 }
Example #3
0
 /// <summary>
 /// 查询指定模板名称的模板
 /// </summary>
 /// <param name="strName">模板名称</param>
 /// <returns></returns>
 public SalaryItemTemplet Query(string strName)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var result = (from item in oContext.SalaryItemTemplet
                       where item.name == strName
                       select item).FirstOrDefault();
         return(result);
     }
 }
Example #4
0
 public PersonnelInfo QueryEmployeeByID(long id)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var result = from item in oContext.PersonnelInfo
                      where item.id == id
                      select item;
         return(result.FirstOrDefault());
     }
 }
Example #5
0
 /// <summary>
 /// 查询全部生产班组信息
 /// </summary>
 /// <returns></returns>
 public List <ProduceTeam> QueryYieldGroups()
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var options = new System.Data.Linq.DataLoadOptions();
         options.LoadWith <ProduceTeam>(p => p.Department);
         options.LoadWith <ProduceTeam>(p => p.EquipmentInformation);
         oContext.LoadOptions = options;
         var result = from item in oContext.ProduceTeam
                      select item;
         return(result.ToList());
     }
 }
Example #6
0
 public static decimal?QueryBase(int iHumanID)
 {
     using (SqlHelper oHelper = new SqlHelper())
     {
         using (HumanResourceDataContext oHumanContext = new HumanResourceDataContext(oHelper.SqlConn))
         {
             oHumanContext.ObjectTrackingEnabled = false;
             var result = from item in oHumanContext.PersonnelInfo
                          where item.id == iHumanID
                          select item.basicSalary;
             return(result.FirstOrDefault());
         }
     }
 }
Example #7
0
        /// <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;
                }
            }
        }
Example #8
0
        /// <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();
        }
Example #9
0
        /*
         * 方法名称:QueryTaxBase
         * 方法功能描述:获取扣税基数
         *
         * 创建人:杨林
         * 创建时间:2009-03-12
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */
        /// <summary>
        /// 获取扣税基数
        /// </summary>
        /// <returns></returns>
        public static decimal QueryTaxBase()
        {
            HumanResourceDataContext oHumanContext = new HumanResourceDataContext(new SqlHelper().SqlConn);

            try
            {
                return(decimal.Parse(
                           (from taxBas in oHumanContext.SalaryParameter
                            select taxBas.taxBase).First().ToString()
                           ));
            }
            catch (System.Data.SqlClient.SqlException)
            {
                throw;
            }
        }
Example #10
0
 /// <summary>
 /// 判断指定员工名称是否存在
 /// </summary>
 /// <param name="strName"></param>
 /// <returns></returns>
 public bool IsExistByName(string strName)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var result = (from item in oContext.PersonnelInfo
                       where item.name.Trim() == strName.Trim()
                       select item.id).Count();
         if (result > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #11
0
        public string[] QueryPayrollItemName()
        {
            HumanResourceDataContext oHumanContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn);

            oHumanContext.ObjectTrackingEnabled = false;
            var result = from item in oHumanContext.PayrollAdd
                         select item.name;

            try
            {
                return(result.ToArray <string>());
            }
            catch (System.Data.SqlClient.SqlException)
            {
                return(null);
            }
        }
Example #12
0
 /// <summary>
 /// 判断指定部门编号是否存在
 /// </summary>
 /// <param name="strNo"></param>
 /// <returns></returns>
 public bool IsExistByNo(string strNo)
 {
     using (HumanResourceDataContext oContext = new HumanResourceDataContext(this.strConn))
     {
         var result = (from item in oContext.Department
                       where item.no.Trim() == strNo.Trim()
                       select item.id).Count();
         if (result > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #13
0
        /*
         * 方法名称:QueryAllPersonnel
         * 方法功能描述:获取全部员工实体数组
         *
         * 创建人:杨林
         * 创建时间:2009-03-12
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */
        /// <summary>
        /// 获取全部员工实体数组
        /// </summary>
        /// <returns></returns>
        public static PersonnelInfo[] QueryAllPersonnel()
        {
            HumanResourceDataContext oHumanContext = new HumanResourceDataContext(new SqlHelper().SqlConn);

            oHumanContext.ObjectTrackingEnabled = false;
            var result = from item in oHumanContext.PersonnelInfo
                         select item;

            try
            {
                return(result.ToArray <PersonnelInfo>());
            }
            catch (System.Data.SqlClient.SqlException)
            {
                return(new PersonnelInfo[] { new PersonnelInfo {
                                                 name = "读取数据库出错!"
                                             } });
            }
        }
Example #14
0
 /// <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();
     }
 }