public List <View_HR_Train_PlanCollectUser> GetUserInfoAll(Guid planCourseID, int courseID)
        {
            ITrainBasicInfo service = ServerModuleFactory.GetServerModule <ITrainBasicInfo>();

            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;
            List <string> lstUser          = service.GetCourse_User(courseID);

            List <View_HR_Train_PlanCollectUser> lstResult = new List <View_HR_Train_PlanCollectUser>();

            foreach (string workID in lstUser)
            {
                var varData = from a in ctx.View_HR_PersonnelArchive
                              where a.员工编号 == workID
                              select a;

                if (varData.Count() == 1)
                {
                    View_HR_Train_PlanCollectUser temp = new View_HR_Train_PlanCollectUser();

                    temp.部门   = varData.Single().部门;
                    temp.岗位   = varData.Single().岗位;
                    temp.工号   = workID;
                    temp.汇总ID = planCourseID;
                    temp.员工姓名 = varData.Single().员工姓名;

                    lstResult.Add(temp);
                }
            }

            return(lstResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改请假信息
        /// </summary>
        /// <param name="leave">请假申请数据集</param>
        /// <param name="roleType">角色类型(部门主管审批,部门负责人审批
        /// 分管领导审批,总经理审批,人力资源部复审)</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true,失败返回False</returns>
        public bool UpdateLeave(HR_LeaveBill leave, string roleType, out string error)
        {
            error = "";
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();

            try
            {
                var result = from a in dataContxt.HR_LeaveBill
                             where a.ID == leave.ID
                             select a;

                if (result.Count() != 1)
                {
                    error = "信息有误,请查证后再操作!";
                    return(false);
                }

                HR_LeaveBill bill = result.Single();
                bill.BillStatus = leave.BillStatus;

                switch (roleType)
                {
                case "部门主管审批":
                    bill.DeptDirector = leave.DeptDirector;
                    bill.DeptDirectorSignatureDate = leave.DeptDirectorSignatureDate;
                    break;

                case "部门负责人审批":
                    bill.DeptPrincipal = leave.DeptPrincipal;
                    bill.DeptPrincipalSignatureDate = leave.DeptPrincipalSignatureDate;
                    bill.Authorize           = leave.Authorize;
                    bill.UnexcusedReason     = leave.UnexcusedReason;
                    bill.Leader              = leave.Leader;
                    bill.LeaderSignatureDate = leave.LeaderSignatureDate;
                    break;

                case "分管领导审批":
                    bill.Leader = leave.Leader;
                    bill.LeaderSignatureDate = leave.LeaderSignatureDate;
                    bill.Authorize           = leave.Authorize;
                    bill.UnexcusedReason     = leave.UnexcusedReason;
                    break;

                case "总经理审批":
                    bill.GeneralManager   = leave.GeneralManager;
                    bill.GM_SignatureDate = leave.GM_SignatureDate;
                    bill.Authorize        = leave.Authorize;
                    bill.UnexcusedReason  = leave.UnexcusedReason;
                    break;

                case "人力资源部复审":
                    bill.HR_Signature     = leave.HR_Signature;
                    bill.HR_SignatureDate = leave.HR_SignatureDate;
                    bill.LeaveTypeID      = leave.LeaveTypeID;
                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();

                if (GlobalObject.GeneralFunction.StringConvertToEnum <LeaveBillStatus>(bill.BillStatus) == LeaveBillStatus.已完成)
                {
                    ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>();
                    service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.请假);
                }

                dataContxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                dataContxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 领导审核修改出差单据
        /// </summary>
        /// <param name="onBusiness">出差单据数据集</param>
        /// <param name="roleType">角色类型</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool UpdateOnBusinessBill(HR_OnBusinessBill onBusiness, string roleType, out string error)
        {
            error = "";
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();

            try
            {
                var result = from a in dataContxt.HR_OnBusinessBill
                             where a.ID == onBusiness.ID
                             select a;

                if (result.Count() != 1)
                {
                    error = "信息有误,请查证后再操作!";
                    return(false);
                }

                HR_OnBusinessBill bill = result.Single();
                bill.BillStatus = onBusiness.BillStatus;

                switch (roleType)
                {
                case "部门主管审批":
                    bill.DeptPrincipal    += "," + BasicInfo.LoginID;
                    bill.DeptSignatureDate = onBusiness.DeptSignatureDate;
                    bill.WithinBudget      = onBusiness.WithinBudget;

                    bill.LeaderSignature     = onBusiness.LeaderSignature;
                    bill.LeaderSignatureDate = onBusiness.LeaderSignatureDate;
                    bill.Authorize           = onBusiness.Authorize;

                    break;

                case "分管领导审批":
                    bill.LeaderSignature     = onBusiness.LeaderSignature;
                    bill.LeaderSignatureDate = onBusiness.LeaderSignatureDate;
                    bill.Authorize           = onBusiness.Authorize;
                    break;

                case "总经理审批":
                    bill.GeneralManager   = onBusiness.GeneralManager;
                    bill.GM_SignatureDate = onBusiness.GM_SignatureDate;
                    bill.Authorize        = onBusiness.Authorize;
                    break;

                case "随行人员部门确认":
                    break;

                case "销差人确认":
                    bill.RealBeginTime = onBusiness.RealBeginTime;
                    bill.RealEndTime   = onBusiness.RealEndTime;
                    bill.Confirmor     = onBusiness.Confirmor;
                    bill.ConfirmorDate = onBusiness.ConfirmorDate;
                    break;

                case "出差结果说明":
                    bill.Result = onBusiness.Result;
                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();

                if (GlobalObject.GeneralFunction.StringConvertToEnum <OnBusinessBillStatus>(bill.BillStatus) == OnBusinessBillStatus.已完成 ||
                    GlobalObject.GeneralFunction.StringConvertToEnum <OnBusinessBillStatus>(bill.BillStatus) == OnBusinessBillStatus.等待出差结果说明)
                {
                    ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>();
                    service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.出差);
                }

                dataContxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                dataContxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 操作补单情况下的考勤流水与异常信息
        /// </summary>
        /// <param name="dataContxt">数据上下文</param>
        /// <param name="billNo">关联单号</param>
        /// <param name="exceptionType">异常类型</param>
        /// <returns>成功返回True失败返回False</returns>
        public void OperationTimeException_Replenishments(DepotManagementDataContext dataContxt, string billNo, CE_HR_AttendanceExceptionType exceptionType)
        {
            IAttendanceAnalysis service = ServerModuleFactory.GetServerModule <IAttendanceAnalysis>();

            try
            {
                switch (exceptionType)
                {
                case CE_HR_AttendanceExceptionType.请假:

                    var varDataLeave = from a in dataContxt.HR_LeaveBill
                                       where a.ID == Convert.ToInt32(billNo)
                                       select a;

                    if (varDataLeave.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    service.Analysis_Main(dataContxt, varDataLeave.Single().BeginTime, varDataLeave.Single().EndTime, varDataLeave.Single().Applicant);
                    break;

                case CE_HR_AttendanceExceptionType.加班:
                    var varOverTime = from a in dataContxt.HR_OvertimeBill
                                      where a.ID == Convert.ToInt32(billNo)
                                      select a;

                    if (varOverTime.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    var varOverPersonnel = from a in dataContxt.HR_OvertimePersonnel
                                           where a.BillID == varOverTime.Single().ID
                                           select a;

                    foreach (var item in varOverPersonnel)
                    {
                        service.Analysis_Main(dataContxt, varOverTime.Single().BeginTime, Convert.ToDateTime(varOverTime.Single().EndTime), item.WorkID);
                    }

                    break;

                case CE_HR_AttendanceExceptionType.出差:
                    var varOnBusiness = from a in dataContxt.HR_OnBusinessBill
                                        where a.ID == Convert.ToInt32(billNo)
                                        select a;

                    if (varOnBusiness.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    var varPersonnel = from a in dataContxt.HR_OnBusinessPersonnel
                                       where a.BillID == varOnBusiness.Single().ID
                                       select a;

                    foreach (var item in varPersonnel)
                    {
                        service.Analysis_Main(dataContxt, varOnBusiness.Single().RealBeginTime, varOnBusiness.Single().RealEndTime, item.WorkID);
                    }

                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 领导审核修改加班单据
        /// </summary>
        /// <param name="overTime">出差单据数据集</param>
        /// <param name="roleType">角色类型</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool UpdateOverTimeBill(HR_OvertimeBill overTime, string roleType, out string error)
        {
            error = "";
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();

            try
            {
                var result = from a in dataContxt.HR_OvertimeBill
                             where a.ID == overTime.ID
                             select a;

                if (result.Count() != 1)
                {
                    error = "信息有误,请查证后再操作!";
                    return(false);
                }

                HR_OvertimeBill bill = result.Single();
                List <string>   list = new List <string>();
                DataTable       dt   = GlobalObject.DatabaseServer.QueryInfo("select * from HR_OvertimePersonnel where billID=" + bill.ID);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    list.Add(dt.Rows[i]["WorkID"].ToString());
                }

                bill.BillStatus = overTime.BillStatus;

                switch (roleType)
                {
                case "部门主管审批":
                    bill.DeptDirector = overTime.DeptDirector;
                    bill.DeptDirectorSignatureDate = overTime.DeptDirectorSignatureDate;
                    break;

                case "分管领导审批":
                    bill.Leader = overTime.Leader;
                    bill.LeaderSignatureDate = overTime.LeaderSignatureDate;
                    bill.Authorize           = overTime.Authorize;
                    bill.VerifyHours         = overTime.VerifyHours;
                    bill.RealHours           = overTime.RealHours;
                    break;

                case "部门负责人审批":
                    bill.DeptPrincipal = overTime.DeptPrincipal;
                    bill.DeptPrincipalSignatureDate = overTime.DeptPrincipalSignatureDate;
                    bill.Authorize   = overTime.Authorize;
                    bill.VerifyHours = overTime.VerifyHours;
                    bill.RealHours   = overTime.RealHours;
                    break;

                case "人力资源":
                    bill.HR_Signature     = overTime.HR_Signature;
                    bill.HR_SignatureDate = overTime.HR_SignatureDate;
                    break;

                case "确认加班完成情况":
                    bill.Verifier           = overTime.Verifier;
                    bill.VerifyFinish       = overTime.VerifyFinish;
                    bill.VerifyHours        = overTime.VerifyHours;
                    bill.VerifySignaturDate = overTime.VerifySignaturDate;
                    bill.RealHours          = Convert.ToDouble(overTime.VerifyHours);
                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();

                if (GlobalObject.GeneralFunction.StringConvertToEnum <OverTimeBillStatus>(bill.BillStatus) == OverTimeBillStatus.已完成)
                {
                    ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>();
                    service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.加班);
                }

                dataContxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                dataContxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }