示例#1
0
        public JsonResult GetMemoResources(string usercode)
        {
            try
            {
                var user = _unitOfWork.Users.GetUsersByCode(usercode);
                if (user == null)
                {
                    return(Json(new ReturnData <string>
                    {
                        Success = false,
                        Message = "You are not allowed to create a memo. Kindly contact admin"
                    }));
                }

                if (!_studentServices.CheckIfGenesis().Data)
                {
                    return(Json(new ReturnData <string>
                    {
                        Success = false,
                        Message = "Sorry, memos not supported at the moment."
                    }));
                }

                var departments  = _unitOfWork.Department.GetStaffDepartments();
                var staffDetails = _staffServices.GetEmployees(usercode)?.Data;
                var participants = _unitOfWork.HrpEmployee.GetWhere(e => e.Terminated == false);

                return(Json(new ReturnData <dynamic>
                {
                    Success = true,
                    Data = new
                    {
                        staffDetails,
                        departments,
                        participants
                    }
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ReturnData <string>
                {
                    Success = false,
                    Message = "An error occurred"
                }));
            }
        }
示例#2
0
 public JsonResult GetStaffInfo(string userCode)
 {
     return(Json(_staffServices.GetEmployees(userCode)));
 }