Exemplo n.º 1
0
        public JsonResult AddOvertime(OvertimeDto dto)
        {
            decimal OvertimePoints = 0;

            //decimal.TryParse(XmlStaticHelper.GetXmlNodeByXpath("LeavePoints", "LeavePointsconfig", "LeavePoints", "0"), out OvertimePoints);
            decimal.TryParse(_configureContract.GetConfigureValue("LeavePoints", "LeavePointsconfig", "LeavePoints", "0"), out OvertimePoints);
            OperationResult oper       = new OperationResult(OperationResultType.Error, "申请失败");
            OperationResult oper_point = _memberContract.CheckLeavePointsInfo(Convert.ToDecimal(dto.OvertimeDays), dto.AdminId);

            dto.GetPoints = Convert.ToDecimal(oper_point.Data);

            oper = _overtimeContract.Insert(dto);
            return(Json(oper));
        }
Exemplo n.º 2
0
        public JsonResult Update(OvertimeDto dto)
        {
            dto.AdminId = AuthorityHelper.OperatorId ?? 0;
            OperationResult oper = CalculationHour(dto.StartTime, dto.EndTime, dto.AdminId);

            if (oper.ResultType == OperationResultType.Success)
            {
                string strDay = oper.Data.ToString();
                dto.OvertimeDays = double.Parse(strDay) - dto.RestHours;
                OperationResult oper_point = _memberContract.CheckLeavePointsInfo(Convert.ToDecimal(dto.OvertimeDays), -1, "overtime");
                dto.GetPoints = Convert.ToDecimal(oper_point.Data);
                oper          = _overtimeContract.Update(dto);
            }
            return(Json(oper));
        }
        public ActionResult Verify(int verifyType, params int[] Ids)
        {
            var res          = new OperationResult(OperationResultType.Error);
            int countSuccess = 0;
            int countFail    = 0;

            foreach (var item in Ids)
            {
                Overtime info = _overtimeContract.Overtimes.Where(x => x.Id == item).FirstOrDefault();
                if (info != null && info.VerifyType == 0)
                {
                    OvertimeDto dto = new OvertimeDto();
                    dto.Id             = item;
                    dto.OvertimeReason = info.OvertimeReason;
                    dto.StartTime      = info.StartTime;
                    dto.EndTime        = info.EndTime;
                    dto.OvertimeDays   = info.OvertimeDays;
                    dto.VerifyType     = verifyType;
                    dto.AdminId        = info.AdminId;
                    dto.VerifyAdminId  = AuthorityHelper.OperatorId;
                    res = _overtimeContract.Verify(dto);
                    if (res.ResultType == OperationResultType.Success)
                    {
                        countSuccess++;
                        string content = string.Empty;
                        string title   = "加班通知";
                        if (dto.VerifyType == (int)VerifyFlag.NoPass)
                        {
                            content = "审核不通过";
                        }
                        else
                        {
                            content = "审核通过";
                        }

                        EntityContract._notificationContract.SendNotice(dto.AdminId, title, content, sendNotificationAction);
                    }
                    else
                    {
                        countFail++;
                    }
                }
            }
            var strResult = string.Format("操作完成:成功{0}个,失败{1}个", countSuccess, countFail);
            var oper      = new OperationResult(OperationResultType.Success, strResult);

            return(Json(oper));
        }
        public JsonResult Update(OvertimeDto dto)
        {
            dto.VerifyAdminId = AuthorityHelper.OperatorId;
            var    res     = _overtimeContract.Verify(dto);
            string content = string.Empty;
            string title   = "加班通知";

            if (dto.VerifyType == (int)VerifyFlag.NoPass)
            {
                content = "审核不通过";
            }
            else
            {
                content = "审核通过";
            }
            EntityContract._notificationContract.SendNotice(dto.AdminId, title, content, sendNotificationAction);
            return(Json(res, JsonRequestBehavior.AllowGet));
        }