Ejemplo n.º 1
0
        /// <summary>
        /// 修改签卡记录信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="entityList"></param>
        public void EmployeeSigninRecordUpdate(T_HR_EMPLOYEESIGNINRECORD entTemp, List <T_HR_EMPLOYEESIGNINDETAIL> entityList)
        {
            try
            {
                if (entTemp == null)
                {
                    return;
                }

                EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL();
                bllDetail.RemoveSignInDetailsBySignInId(entTemp.SIGNINID);
                bllDetail.AddEmployeeSignInDetails(entityList);

                if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString())
                {
                    dal.UpdateFromContext(entTemp);
                    dal.SaveContextChanges();
                    SaveMyRecord(entTemp);
                }
                else if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.Approving).ToString())//待办任务提交审核时使用
                {
                    EmployeeSigninRecordAudit(entTemp.SIGNINID, entTemp.CHECKSTATE);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 签卡记录审核
        /// </summary>
        /// <param name="strSignInID"></param>
        /// <param name="strCheckState"></param>
        public string EmployeeSigninRecordAudit(string strSignInID, string strCheckState)
        {
            string strMsg      = string.Empty;
            string singinstate = "0";

            try
            {
                if (string.IsNullOrEmpty(strSignInID) || string.IsNullOrEmpty(strCheckState))
                {
                    return("{NOTFOUND}");
                }

                bool          flag      = false;
                StringBuilder strFilter = new StringBuilder();
                List <string> objArgs   = new List <string>();

                strFilter.Append(" SIGNINID == @0");

                objArgs.Add(strSignInID);

                EmployeeSigninRecordDAL dalSigninRecord = new EmployeeSigninRecordDAL();
                flag = dalSigninRecord.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

                if (!flag)
                {
                    return("{NOTFOUND}");
                }

                T_HR_EMPLOYEESIGNINRECORD entAudit = dalSigninRecord.GetSigninRecordByMultSearch(strFilter.ToString(), objArgs.ToArray());

                //已审核通过的记录禁止再次提交审核
                if (entAudit.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString())
                {
                    return("{REPEATAUDITERROR}");
                }

                //审核状态变为审核中或者审核通过时,生成对应的员工考勤记录(应用的员工范围,视应用对象而定)
                if (strCheckState == Convert.ToInt32(CheckStates.Approved).ToString())
                {
                    singinstate = "2";
                }
                else if (strCheckState == Convert.ToInt32(CheckStates.Approving).ToString())
                {
                    singinstate = "3";
                }
                else if (strCheckState == Convert.ToInt32(CheckStates.UnApproved).ToString())
                {
                    singinstate = "1";
                }

                if (Convert.ToInt32(singinstate) == 0)
                {
                    return("{NOTFOUND}");
                }

                EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL();
                IQueryable <T_HR_EMPLOYEESIGNINDETAIL> entDetails = bllDetail.GetEmployeeSignInDetailBySigninID(strSignInID);
                foreach (T_HR_EMPLOYEESIGNINDETAIL item in entDetails)
                {
                    AbnormRecordBLL           bllAbnormRecord = new AbnormRecordBLL();
                    T_HR_EMPLOYEEABNORMRECORD entAbnormRecord = item.T_HR_EMPLOYEEABNORMRECORD;
                    entAbnormRecord.SINGINSTATE = singinstate;//(Convert.ToInt32(Common.IsChecked.Yes) + 1).ToString();
                    bllAbnormRecord.ModifyAbnormRecord(entAbnormRecord);
                    try
                    {
                        var q = (from ent in dal.GetObjects <T_HR_EMPLOYEEABNORMRECORD>()
                                 where ent.ABNORMRECORDID == entAbnormRecord.ABNORMRECORDID
                                 select ent).FirstOrDefault();
                        Tracer.Debug("异常签卡终审修改异常考勤记录状态为已签卡,异常日期:" + q.ABNORMALDATE
                                     + "异常考勤状态,2为正常状态:" + q.SINGINSTATE);
                    }
                    catch (Exception ex)
                    {
                        Tracer.Debug("异常签卡终审修改异常考勤记录异常:" + ex.ToString());
                    }
                }

                entAudit.CHECKSTATE = strCheckState;
                dalSigninRecord.Update(entAudit);

                SaveMyRecord(entAudit);
                strMsg = "{SAVESUCCESSED}";

                if (entAudit.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString() && entAudit.CHECKSTATE != strCheckState)
                {
                    Tracer.Debug(" 异常签卡审核异常 entAudit.CHECKSTATE != strCheckState,entAudit.CHECKSTATE:" + entAudit.CHECKSTATE
                                 + " 流程传过来的审核状态为:" + strCheckState
                                 + " 表示流程更新业务表单失败:执行ClearNoSignInRecord"
                                 + " entAudit.EMPLOYEENAME:" + entAudit.EMPLOYEENAME
                                 + " entAudit.SIGNINID:" + entAudit.SIGNINID
                                 + " entAudit.SIGNINTIME:" + entAudit.SIGNINTIME);

                    List <T_HR_EMPLOYEEABNORMRECORD> entABnormRecords = entDetails.Select(c => c.T_HR_EMPLOYEEABNORMRECORD).ToList();
                    ClearNoSignInRecord("T_HR_EMPLOYEESIGNINRECORD", entAudit.EMPLOYEEID, entABnormRecords);
                }
            }
            catch (Exception ex)
            {
                strMsg = ex.Message;
            }

            return(strMsg);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 修改签卡记录信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="entityList"></param>
        public string EmployeeSigninRecordUpdate(T_HR_EMPLOYEESIGNINRECORD entTemp, List <T_HR_EMPLOYEESIGNINDETAIL> entityList)
        {
            try
            {
                if (entTemp == null)
                {
                    return(string.Empty);
                }
                if (!string.IsNullOrEmpty(isHuNanHangXingSalary) && isHuNanHangXingSalary != "true")
                {
                    foreach (var entDetail in entityList)
                    {
                        if (entDetail.REASONCATEGORY == "3") //因公外出
                        {
                            #region                          //外出开始时间必须是最近两天(跳过周六周日)
                            DateTime dtNow       = DateTime.Now;
                            DateTime dtsartCheck = entDetail.ABNORMALDATE.Value;
                            int      step        = 0;
                            while (step < 3)
                            {
                                dtsartCheck = dtsartCheck.AddDays(1);
                                if (IsVacationDay(dtsartCheck, entDetail.OWNERCOMPANYID))
                                {
                                    continue;                                                      //假期
                                }
                                else
                                {
                                    step = step + 1;
                                }
                            }
                            dtsartCheck = new DateTime(dtsartCheck.Year, dtsartCheck.Month, dtsartCheck.Day).AddDays(1).AddSeconds(-1);
                            if (dtNow > dtsartCheck)//外出时间只能是今天或者明天23:59:59之前
                            {
                                string msg = entDetail.ABNORMALDATE.Value.ToString("yyyy-MM-dd") + "签卡因公外出异常:超出三个工作日系统中将不能提交“因公外出”的签卡申请。";
                                return(msg);
                            }
                            #endregion
                        }
                    }
                }

                EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL();
                bllDetail.RemoveSignInDetailsBySignInId(entTemp.SIGNINID);
                bllDetail.AddEmployeeSignInDetails(entityList);

                if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString())
                {
                    if (entTemp.EntityKey == null)
                    {
                        T_HR_EMPLOYEESIGNINRECORD updateSign = GetEmployeeSigninRecordByID(entTemp.SIGNINID);
                        Utility.CloneEntity(updateSign, entTemp);
                        entTemp.UPDATEDATE = DateTime.Now;
                    }
                    dal.UpdateFromContext(entTemp);
                    dal.SaveContextChanges();
                    SaveMyRecord(entTemp);
                }
                else if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.Approving).ToString())//待办任务提交审核时使用
                {
                    EmployeeSigninRecordAudit(entTemp.SIGNINID, entTemp.CHECKSTATE);
                }
            }
            catch (Exception ex)
            {
                Tracer.Debug(ex.ToString());
                throw ex;
            }
            return(string.Empty);
        }