Ejemplo n.º 1
0
        public ActionResult GetUserSetting()
        {
            UserSetting.UserSetting us = _usService.GetUserSettingList().Where(p => p.UserId == Common.CommonHelper.CurrentUser).FirstOrDefault();
            int teamId = 0;

            if (us != null)
            {
                teamId = us.TeamId;
                Team.Team team = _teamService.GetTeamList().Where(t => t.Id == teamId).FirstOrDefault();
                if (team != null)
                {
                    us.TeamName = team.TeamName;
                    return(Json(new { success = true, TeamName = team.TeamName, TeamId = team.Id }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { success = true, TeamName = "", TeamId = 0 }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public int GetUserTeamId()
        {
            var us = _usService.GetUserSettingList().Where(p => p.UserId == CommonHelper.CurrentUser).FirstOrDefault();

            if (us != null && us.TeamId != 0)
            {
                return(us.TeamId);
            }
            return(-1);
        }
Ejemplo n.º 3
0
        public ActionResult CommApprove(String tsIdList, string comment)
        {
            var us = _usService.GetUserSettingList().Where(p => p.UserId == CommonHelper.CurrentUser).FirstOrDefault();

            if (!(us != null && us.TeamId != 0))
            {
                return(Json(new { success = false, message = "请先在个人设置中设置科室!" }, JsonRequestBehavior.AllowGet));
            }
            if (!string.IsNullOrEmpty(tsIdList))
            {
                var operateTime = DateTime.Now;
                var idList      = tsIdList.Split(',');
                foreach (var id in idList)
                {
                    var ts = _appService.GetTimesheetsByID(int.Parse(id));
                    ts.Status       = ApproveStatus.Approved;
                    ts.Approver     = Common.CommonHelper.CurrentUser;
                    ts.ApprovedTime = operateTime;
                    AddOrEdit(ts);
                    _alService.AddApproveLog(new ApproveLog.ApproveLog()
                    {
                        WorkflowInstanceID = ts.WorkflowInstanceID,
                        OperateTime        = operateTime,
                        Comment            = comment,
                        OperateType        = "审批通过",
                        CurrentOperator    = Common.CommonHelper.CurrentUser,
                        NextOperator       = "",
                        Creator            = Common.CommonHelper.CurrentUser
                    });
                }
                return(Json(new { success = true, message = "审批通过工时数据成功!" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false, message = "需要审批通过的工时数据为空!" }, JsonRequestBehavior.AllowGet));
            }
        }