示例#1
0
        public async Task <PartialViewResult> GetRolebasedTrainingUserview()
        {
            LearningChecklist learning = new LearningChecklist();

            try
            {
                InitializeServiceClient();
                UserTrainingDetail req  = new UserTrainingDetail();
                UserManager        user = (UserManager)Session["CurrentUser"];
                req.UserId = user.DBUserId;

                HttpResponseMessage RoleBasedTrainingsResponse = await client.PostAsJsonAsync("Training/GetRoleBasedTrainingsUserView", req);

                List <UserTrainingDetail> RoleBasedTrainings = await RoleBasedTrainingsResponse.Content.ReadAsAsync <List <UserTrainingDetail> >();

                learning.RoleBasedTrainings = RoleBasedTrainings;
                client.Dispose();
            }
            catch (Exception ex)
            {
                //LogHelper.AddLog("LearningChecklistController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
            }
            return(PartialView("RolebasedTrainingUserview", learning.RoleBasedTrainings));
        }
示例#2
0
        public bool TrainingCompletionApproval(UserTrainingDetail req)
        {
            bool result = false;

            try
            {
                UserTrainingDetail skillTraining = new UserTrainingDetail();
                skillTraining.TrainingId          = req.TrainingId;
                skillTraining.TrainingFlag        = req.TrainingFlag;
                skillTraining.AdminApprovalStatus = req.AdminApprovalStatus;
                skillTraining.UserId = req.UserId;

                skillTraining.UserName     = req.UserName;
                skillTraining.TrainingName = req.TrainingName;
                skillTraining.AdminName    = req.AdminName;
                skillTraining.EmailAddress = req.EmailAddress;

                SqlSvrDAL dal = new SqlSvrDAL(req.ClientInfo);
                result = dal.TrainingCompletionApproval(skillTraining);
            }
            catch (Exception ex)
            {
                //  LogHelper.AddLog("TrainingController,TrainingCompletionApproval", ex.Message, ex.StackTrace, "HCL.Academy.Service", req.ClientInfo.emailId);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
            }
            return(result);
        }
示例#3
0
        public async Task <bool> RoleTrainingApproval(int trainingid, int UserId, string ApprovalStatus, string AdminName, string TrainingName, string UserName, string UserEmail)
        {
            try
            {
                InitializeServiceClient();
                UserTrainingDetail req = new UserTrainingDetail();
                req.TrainingId          = trainingid;
                req.UserId              = UserId;
                req.AdminApprovalStatus = ApprovalStatus;
                req.TrainingFlag        = "RoleTraining";

                req.AdminName    = AdminName;
                req.TrainingName = TrainingName;
                req.UserName     = UserName;
                req.EmailAddress = UserEmail;

                HttpResponseMessage SkillTrainingCompletionResponse = await client.PostAsJsonAsync("Training/TrainingCompletionApproval", req);

                bool result = await SkillTrainingCompletionResponse.Content.ReadAsAsync <bool>();

                return(result);
            }
            catch (Exception ex)
            {
                //LogHelper.AddLog("LearningChecklistController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
                return(false);
            }
        }
示例#4
0
        public async Task <ActionResult> AdminApproval()
        {
            InitializeServiceClient();
            LearningChecklist learning = new LearningChecklist();

            try
            {
                UserManager        user = (UserManager)Session["CurrentUser"];
                UserTrainingDetail req  = new UserTrainingDetail();
                if ((user.GroupPermission > 2) || (user.Admininfo.IsFirstLevelAdmin))
                {
                    req.IsAcademyAdmin = true;
                    req.IsProjectAdmin = false;
                }

                else if ((user.Admininfo.IsSecondLevelAdmin) || (user.Admininfo.IsThirdLevelAdmin))
                {
                    req.IsAcademyAdmin = false;
                    req.IsProjectAdmin = true;
                    req.UserId         = user.DBUserId;
                }



                HttpResponseMessage SkillBasedTrainingsResponse = await client.PostAsJsonAsync("Training/GetSkillBasedTrainingsAdminView", req);

                List <UserTrainingDetail> SkillBasedTrainings = await SkillBasedTrainingsResponse.Content.ReadAsAsync <List <UserTrainingDetail> >();

                learning.SkillBasedTrainings = SkillBasedTrainings;

                HttpResponseMessage RoleBasedTrainingsResponse = await client.PostAsJsonAsync("Training/GetRoleBasedTrainingsAdminView", req);

                List <UserTrainingDetail> RoleBasedTrainings = await RoleBasedTrainingsResponse.Content.ReadAsAsync <List <UserTrainingDetail> >();

                learning.RoleBasedTrainings = RoleBasedTrainings;

                client.Dispose();
            }
            catch (Exception ex)
            {
                //UserManager user = (UserManager)Session["CurrentUser"];
                //LogHelper.AddLog("LearningChecklistController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
            }
            return(View(learning));
        }
示例#5
0
        public List <UserTrainingDetail> GetSkillBasedTrainingsAdminView(UserTrainingDetail req)
        {
            List <UserTrainingDetail> trainings = new List <UserTrainingDetail>();

            try
            {
                SqlSvrDAL dal = new SqlSvrDAL(req.ClientInfo);
                trainings = dal.GetSkillBasedTrainingsAdminView(req);
            }
            catch (Exception ex)
            {
                //LogHelper.AddLog("TrainingController,GetSkillBasedTrainingsAdminView", ex.Message, ex.StackTrace, "HCL.Academy.Service", req.ClientInfo.emailId);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
            }
            return(trainings);
        }
示例#6
0
        public async Task <bool> RoleTrainingCompletionRequest(int trainingid, int Projectid, string UserName, string progress)
        // public async Task<PartialViewResult> RoleTrainingCompletionRequest(int trainingid)
        {
            LearningChecklist learning = new LearningChecklist();

            try
            {
                InitializeServiceClient();
                UserTrainingDetail req  = new UserTrainingDetail();
                UserManager        user = (UserManager)Session["CurrentUser"];
                req.TrainingId = trainingid;
                //  req.TrainingName = traingname;
                req.UserId       = user.DBUserId;
                req.TrainingFlag = "RoleTraining";
                req.UserName     = UserName;
                req.ProjectId    = Projectid;
                req.EmailAddress = user.EmailID;
                req.Progress     = progress;
                HttpResponseMessage SkillTrainingCompletionResponse = await client.PostAsJsonAsync("Training/TrainingCompletionRequest", req);

                bool result = await SkillTrainingCompletionResponse.Content.ReadAsAsync <bool>();

                //if (result == false)
                //{
                //    TempData["Message"] = "Unable to send Training for approval. ";
                //    TempData.Keep();
                //}
                //else if (result == true)
                //{
                //    TempData["Message"] = "Training sent for approval.";
                //    TempData.Keep();
                //}
                return(result);
            }
            catch (Exception ex)
            {
                //LogHelper.AddLog("LearningChecklistController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
                return(false);
            }
        }
示例#7
0
        public async Task <ActionResult> Home()
        {
            await InitializeServiceClient();

            if (Session["UserSiteMenu"] == null)
            {
                HttpResponseMessage userRoleResponse = await client.PostAsJsonAsync("User/GetUserRole", req);

                List <int> userRoles = await userRoleResponse.Content.ReadAsAsync <List <int> >();

                System.Web.HttpContext.Current.Session["UserRole"] = userRoles;
                HttpResponseMessage menuResponse = await client.PostAsJsonAsync("Menu/GetMenu?roleid=" + userRoles[0], req);

                List <SiteMenu> siteMenu = await menuResponse.Content.ReadAsAsync <List <SiteMenu> >();

                Session["UserSiteMenu"] = siteMenu;
            }
            if (Session["LogoBase64Image"] == null)
            {
                Session["LogoBase64Image"] = ConfigurationManager.AppSettings["ClientLogo"].ToString();
            }
            HomeViewModel      vm = new HomeViewModel();
            UserTrainingDetail roletrainingreq = new UserTrainingDetail();

            roletrainingreq.ClientInfo = req.ClientInfo;
            UserManager user = (UserManager)Session["CurrentUser"];

            roletrainingreq.UserId = user.DBUserId;
            List <UserTrainingDetail> ListOfTrainings = new List <UserTrainingDetail>();

            try
            {
                HttpResponseMessage trainingResponse = await client.PostAsJsonAsync("Training/GetTrainingItems", req);

                ListOfTrainings = await trainingResponse.Content.ReadAsAsync <List <UserTrainingDetail> >();

                List <UserTrainingDetail> skilltrainings = ListOfTrainings.Where(x => x.TrainingType.ToString().ToLower() == TrainingType.SkillTraining.ToString().ToLower()).ToList();
                vm.skillTrainings = skilltrainings;

                HttpResponseMessage roletrainingResponse = await client.PostAsJsonAsync("Training/GetRoleBasedTrainingsUserView", roletrainingreq);

                vm.roleTrainings = await roletrainingResponse.Content.ReadAsAsync <List <UserTrainingDetail> >();

                HttpResponseMessage response = await client.PostAsJsonAsync("Checklist/GetUserChecklist", req);

                vm.checklist = await response.Content.ReadAsAsync <List <UserCheckList> >();

                HttpResponseMessage skillResponse = await client.PostAsJsonAsync("Skill/GetUserSkillsOfCurrentUser", req);

                vm.skills = await skillResponse.Content.ReadAsAsync <List <UserSkill> >();

                HttpResponseMessage userResponse = await client.PostAsJsonAsync("Assessment/GetCurrentUserAssessments?updateAttempts=false", req);

                vm.assessments = await userResponse.Content.ReadAsAsync <List <AcademyJoinersCompletion> >();

                List <AcademyEvent> list           = new List <AcademyEvent>();
                HttpResponseMessage responseevents = await client.PostAsJsonAsync("Events/GetEvents", req);

                list = await responseevents.Content.ReadAsAsync <List <AcademyEvent> >();

                vm.events = list;
                string newsSource = ConfigurationManager.AppSettings["NewsSource"].ToString();
                if (newsSource.Equals("Feed"))
                {
                    List <RSSFeed>      postRSList  = new List <RSSFeed>();
                    HttpResponseMessage rssResponse = await client.PostAsJsonAsync("RSS/GetRSSFeeds", req);

                    postRSList = await rssResponse.Content.ReadAsAsync <List <RSSFeed> >();

                    vm.rssFeed = postRSList;
                }
                else
                {
                    List <News>         news         = new List <News>();
                    HttpResponseMessage newsResponse = await client.PostAsJsonAsync("News/GetNewsFromDB", req);

                    news = await newsResponse.Content.ReadAsAsync <List <News> >();

                    vm.news = news;
                }
            }
            catch (Exception ex)
            {
                //LogHelper.AddLog("HomeController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID);
                TelemetryClient telemetry = new TelemetryClient();
                telemetry.TrackException(ex);
            }
            return(View(vm));
        }