Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entTemp"></param>
        /// <param name="entAttendanceSolutionDeducts"></param>
        /// <param name="entAttendFreeLeaves"></param>
        /// <returns></returns>
        public string AddAndCreateRelation(T_HR_ATTENDANCESOLUTION entTemp, List <T_HR_ATTENDANCESOLUTIONDEDUCT> entAttendanceSolutionDeducts, List <T_HR_ATTENDFREELEAVE> entAttendFreeLeaves)
        {
            string strMsg = string.Empty;

            try
            {
                strMsg = AddAttSol(entTemp);

                if (strMsg != "{SAVESUCCESSED}")
                {
                    if (string.IsNullOrEmpty(strMsg))
                    {
                        strMsg = "{ADDERROR}";
                    }

                    return(strMsg);
                }

                foreach (T_HR_ATTENDANCESOLUTIONDEDUCT item in entAttendanceSolutionDeducts)
                {
                    AttendanceSolutionDeductBLL bllAttendanceSolutionDeduct = new AttendanceSolutionDeductBLL();
                    bllAttendanceSolutionDeduct.AddAttSolDeduct(item);
                }

                foreach (T_HR_ATTENDFREELEAVE item in entAttendFreeLeaves)
                {
                    AttendFreeLeaveBLL bllAttendFreeLeave = new AttendFreeLeaveBLL();
                    bllAttendFreeLeave.AddAttendFreeLeave(item);
                }

                strMsg = "{SAVESUCCESSED}";
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
            }

            return(strMsg);
        }
Exemple #2
0
        /// <summary>
        /// 修改考勤方案信息,并更改其关联设置的关系
        /// </summary>
        /// <param name="entTemp"></param>
        /// <param name="entAttendanceSolutionDeducts"></param>
        /// <param name="entAttendFreeLeaves"></param>
        /// <returns></returns>
        public string ModifyAndChangeRelation(T_HR_ATTENDANCESOLUTION entTemp, List <T_HR_ATTENDANCESOLUTIONDEDUCT> entAttendanceSolutionDeducts, List <T_HR_ATTENDFREELEAVE> entAttendFreeLeaves)
        {
            string strMsg = string.Empty;

            try
            {
                strMsg = ModifyAttSol(entTemp);

                if (strMsg != "{SAVESUCCESSED}")
                {
                    return("{EDITERROR}");
                }

                AttendanceSolutionDeductBLL bllAttendanceSolutionDeduct = new AttendanceSolutionDeductBLL();
                bllAttendanceSolutionDeduct.DeleteAttSolDeductByAttSolID(entTemp.ATTENDANCESOLUTIONID);

                foreach (T_HR_ATTENDANCESOLUTIONDEDUCT itemDeduct in entAttendanceSolutionDeducts)
                {
                    if (itemDeduct.EntityKey != null)
                    {
                        itemDeduct.EntityKey = null;  //清除EntityKey不为null的情况
                    }

                    if (itemDeduct.T_HR_ATTENDANCESOLUTION == null)
                    {
                        itemDeduct.T_HR_ATTENDANCESOLUTION = entTemp;
                    }

                    strMsg = bllAttendanceSolutionDeduct.AddAttSolDeduct(itemDeduct);
                }

                AttendFreeLeaveBLL bllAttendFreeLeave = new AttendFreeLeaveBLL();
                bllAttendFreeLeave.ModifyAttendFreeLeaveByAttSolID(entTemp.ATTENDANCESOLUTIONID);
                foreach (T_HR_ATTENDFREELEAVE itemFL in entAttendFreeLeaves)
                {
                    if (itemFL.EntityKey != null)
                    {
                        itemFL.EntityKey = null;  //清除EntityKey不为null的情况
                    }

                    if (itemFL.T_HR_ATTENDANCESOLUTION == null)
                    {
                        itemFL.T_HR_ATTENDANCESOLUTION = entTemp;
                    }

                    strMsg = bllAttendFreeLeave.AddAttendFreeLeave(itemFL);
                }

                strMsg = "{SAVESUCCESSED}";
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
                if (ex.InnerException == null)
                {
                    Utility.SaveLog(strMsg);
                }
                else
                {
                    Utility.SaveLog(ex.InnerException.Message);
                }
            }

            return(strMsg);
        }
Exemple #3
0
        /// <summary>
        /// 根据主键索引,删除考勤异常扣款信息(注:暂定为物理删除)
        /// </summary>
        /// <param name="strVacationId">主键索引</param>
        /// <returns></returns>
        public string DeleteDeductMaster(string strAttendanceDeductMasterId)
        {
            string strMsg = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(strAttendanceDeductMasterId))
                {
                    return("{REQUIREDFIELDS}");
                }

                bool          flag            = false;
                StringBuilder strAttDedFilter = new StringBuilder();
                List <string> objAttDedArgs   = new List <string>();

                strAttDedFilter.Append(" DEDUCTMASTERID == @0");

                objAttDedArgs.Add(strAttendanceDeductMasterId);

                AttendanceDeductMasterDAL dalAttendanceDeductMaster = new AttendanceDeductMasterDAL();
                flag = dalAttendanceDeductMaster.IsExistsRd(strAttDedFilter.ToString(), objAttDedArgs.ToArray());

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

                StringBuilder strAttDetailFilter = new StringBuilder();
                List <string> objAttDetailArgs   = new List <string>();

                strAttDetailFilter.Append(" T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID == @0");

                objAttDetailArgs.Add(strAttendanceDeductMasterId);

                AttendanceDeductDetailBLL bllAttendanceDeductDetail = new AttendanceDeductDetailBLL();
                bllAttendanceDeductDetail.DeleteDeductDetailByMasterID(strAttendanceDeductMasterId);

                StringBuilder strAttSolDedFilter = new StringBuilder();
                List <string> objAttSolDedArgs   = new List <string>();

                strAttSolDedFilter.Append(" T_HR_ATTENDANCESOLUTION.CHECKSTATE != @0");
                strAttSolDedFilter.Append(" && T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID == @1");

                objAttSolDedArgs.Add(Convert.ToInt32(CheckStates.UnSubmit).ToString());
                objAttSolDedArgs.Add(strAttendanceDeductMasterId);

                AttendanceSolutionDeductBLL bllAttendanceSolutionDeduct = new AttendanceSolutionDeductBLL();
                flag = bllAttendanceSolutionDeduct.IsExistsRd(strAttSolDedFilter.ToString(), objAttSolDedArgs.ToArray());

                if (flag)
                {
                    return("已存在进入审核状态的考勤方案与当前的考勤异常扣款设置有关联,不能直接删除");
                }

                T_HR_ATTENDANCEDEDUCTMASTER entDel = dalAttendanceDeductMaster.GetAttendanceDeductMasterRdByMultSearch(strAttDedFilter.ToString(), objAttDedArgs.ToArray());
                dalAttendanceDeductMaster.Delete(entDel);

                strMsg = "{DELETESUCCESSED}";
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
            }

            return(strMsg);
        }