Esempio n. 1
0
        /// <summary>
        /// 根据主键索引,删除加班报酬信息(注:暂定为物理删除)
        /// </summary>
        /// <param name="strVacationId">主键索引</param>
        /// <returns></returns>
        public string DeleteOvertimeReward(string strOvertimeRewardId)
        {
            string strMsg = string.Empty;

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

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

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

                objArgs.Add(strOvertimeRewardId);

                OvertimeRewardDAL dalOvertimeReward = new OvertimeRewardDAL();

                flag = dalOvertimeReward.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

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

                T_HR_OVERTIMEREWARD entDel = dalOvertimeReward.GetOvertimeRewardRdByMultSearch(strFilter.ToString(), objArgs.ToArray());
                if (entDel != null)
                {
                    //查找考勤方案定义是否有使用
                    AttendanceSolutionDAL dalAttendanceSolution = new AttendanceSolutionDAL();
                    StringBuilder         strFilterOver         = new StringBuilder();
                    List <string>         objArgss = new List <string>();
                    strFilterOver.Append(" T_HR_OVERTIMEREWARD.OVERTIMEREWARDID == @0");
                    objArgss.Add(entDel.OVERTIMEREWARDID);
                    bool flagfalse = false;
                    flagfalse = dalAttendanceSolution.IsExistsRd(strFilterOver.ToString(), objArgss.ToArray());
                    //如果flagfalse为true,那么说明此加班设置有用到,不容许删除
                    if (flagfalse)
                    {
                        strMsg = "falseOver";
                    }
                    else
                    {
                        dalOvertimeReward.Delete(entDel);
                        strMsg = "{DELETESUCCESSED}";
                    }
                }
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
            }

            return(strMsg);
        }
Esempio n. 2
0
        /// <summary>
        /// 修改加班报酬信息
        /// </summary>
        /// <param name="entTemp"></param>
        /// <returns></returns>
        public string ModifyOvertimeReward(T_HR_OVERTIMEREWARD entTemp)
        {
            string strMsg = string.Empty;

            try
            {
                if (entTemp == null)
                {
                    return("{REQUIREDFIELDS}");
                }
                //取小数点后1位
                string va = Convert.ToDouble(entTemp.VACATIONPAYRATE).ToString("F1");
                string we = Convert.ToDouble(entTemp.WEEKENDPAYRATE).ToString("F1");

                entTemp.VACATIONPAYRATE = Convert.ToDecimal(va);
                entTemp.WEEKENDPAYRATE  = Convert.ToDecimal(we);
                bool          flag      = false;
                StringBuilder strFilter = new StringBuilder();
                List <string> objArgs   = new List <string>();

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

                objArgs.Add(entTemp.OVERTIMEREWARDID);

                OvertimeRewardDAL dalOvertimeReward = new OvertimeRewardDAL();
                flag = dalOvertimeReward.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

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

                T_HR_OVERTIMEREWARD entUpdate = dalOvertimeReward.GetOvertimeRewardRdByMultSearch(strFilter.ToString(), objArgs.ToArray());

                Utility.CloneEntity(entTemp, entUpdate);

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

            return(strMsg);
        }
Esempio n. 3
0
        /// <summary>
        /// 新增加班报酬信息
        /// </summary>
        /// <param name="entTemp"></param>
        /// <returns></returns>
        public string AddOvertimeReward(T_HR_OVERTIMEREWARD entTemp)
        {
            string strMsg = string.Empty;

            try
            {
                if (entTemp == null)
                {
                    return("{REQUIREDFIELDS}");
                }
                //取小数点后1位
                string va = Convert.ToDouble(entTemp.VACATIONPAYRATE).ToString("F1");
                string we = Convert.ToDouble(entTemp.WEEKENDPAYRATE).ToString("F1");

                entTemp.VACATIONPAYRATE = Convert.ToDecimal(va);
                entTemp.WEEKENDPAYRATE  = Convert.ToDecimal(we);

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

                strFilter.Append(" OVERTIMEREWARDNAME == @0");
                objArgs.Add(entTemp.OVERTIMEREWARDNAME);

                OvertimeRewardDAL dalOvertimeReward = new OvertimeRewardDAL();
                flag = dalOvertimeReward.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

                if (flag)
                {
                    return("{ALREADYEXISTSRECORD}");
                }

                dalOvertimeReward.Add(entTemp);

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

            return(strMsg);
        }