public IHttpActionResult GetTopicsByUser(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; string searchText = Convert.ToString(requestParams["SearchText"].ToString()); var ds = TrainningBL.GetTopicsByUser(compId, userId, searchText); data = Utility.ConvertDataSetToJSONString(ds); data = Utility.Successful(data); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetMsgNotifications() { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { string Message = string.Empty; DataSet ds = TrainningBL.GetMsgNotifications(identity.CompId, identity.UserID.ToString(), 5); if (ds.Tables[0].Rows.Count > 0) { //data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } else { data = Utility.API_Status("0", "No data found"); } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetTableData(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; var type = Convert.ToString(requestParams["Type"].ToString()); var valueType = Convert.ToString(requestParams["ValueType"]); var valueId = Convert.ToString(requestParams["ValueID"]); var ds = TrainningBL.GetTableDataByType(compId, type, valueType, valueId); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult ChangeTopicProperty(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; int userId = Convert.ToInt32(identity.UserID); int type = Convert.ToInt32(requestParams["Type"].ToString()); int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); bool flag = Convert.ToBoolean(requestParams["Flag"].ToString()); var ds = TrainningBL.ChangeTopicProperty(compId, userId, topicId, type, flag); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetContentsByModule(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); int moduleId = Convert.ToInt32(requestParams["ModuleID"].ToString()); var isGift = false; if (!string.IsNullOrEmpty(Convert.ToString(requestParams["IsGift"]))) { isGift = Convert.ToBoolean(Convert.ToInt32(requestParams["IsGift"].ToString())); } var ds = TrainningBL.GetContentsByModule(compId, userId, topicId, moduleId, isGift); var sourceInfo = Utility.ConvertDataSetToJSONString(ds.Tables[0]); sourceInfo = sourceInfo.Substring(2, sourceInfo.Length - 4); data = Utility.GetModulesJSONFormat("1", "Successful", sourceInfo, Utility.ConvertDataSetToJSONString(ds.Tables[1]), Utility.ConvertDataSetToJSONString(ds.Tables[2])); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public void LoadBadges() { DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Files/Badges/")); FileInfo[] files = di.GetFiles("*"); int srNo = 1; foreach (var file in files) { string badgeName = file.Name; badgeName = badgeName.Replace(".svg", ""); var badgeNameParts = badgeName.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); if (badgeNameParts.Count() > 1) { badgeName = badgeNameParts[1]; } if (badgeNameParts.Count() > 2) { badgeName = badgeNameParts[1] + "-" + badgeNameParts[2]; } if (badgeNameParts.Count() > 3) { badgeName = badgeNameParts[1] + "-" + badgeNameParts[1] + "-" + badgeNameParts[2]; } string badgePath = @"\Files\Badges\" + file.Name; TrainningBL.AddBadge(badgeName, badgeName, 500, badgePath, srNo); srNo++; } }
public IHttpActionResult UpdateNotification(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; string type = Convert.ToString(requestParams["Type"]); string notificationIds = Convert.ToString(requestParams["NotificationIDs"]); string token = Convert.ToString(requestParams["Token"]); var ds = TrainningBL.UpdateNotification(compId, userId, type, notificationIds, token); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetAchievementNGifts(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; List <Achievement> achievementList = new List <Achievement>(); var ds = TrainningBL.GetAchievementGifts(compId, userId, ref achievementList); data = Utility.GetAchievementGiftsJSONFormat("1", "Success", JsonConvert.SerializeObject(achievementList), Utility.ConvertDataSetToJSONString(ds.Tables[2])); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetModulesByTopic(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); var checkIfTopicAssigned = Convert.ToBoolean(Convert.ToInt32(requestParams["CheckIfTopicAssigned"].ToString())); if (checkIfTopicAssigned) { TrainningBL.CheckIfTopicAssigned(compId, userId, topicId); } var ds = TrainningBL.GetModulesByTopic(compId, userId, topicId); var sourceInfo = Utility.ConvertDataSetToJSONString(ds.Tables[0]); sourceInfo = sourceInfo.Substring(2, sourceInfo.Length - 4); data = Utility.GetModulesJSONFormat("1", "Successful", sourceInfo, Utility.ConvertDataSetToJSONString(ds.Tables[1]), Utility.ConvertDataSetToJSONString(ds.Tables[2])); } catch (Exception ex) { data = Utility.Exception(ex); } } else { //Added on 04 Jun 20 to preview add course without login if (Request.Headers.Contains("Authorization") && Request.Headers.GetValues("Authorization").First().ToUpper() == "Bearer".ToUpper()) { int compId = 0; string userId = "0"; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); var checkIfTopicAssigned = Convert.ToBoolean(Convert.ToInt32(requestParams["CheckIfTopicAssigned"].ToString())); if (checkIfTopicAssigned) { TrainningBL.CheckIfTopicAssigned(compId, userId, topicId); } var ds = TrainningBL.GetModulesByTopic(compId, userId, topicId); var sourceInfo = Utility.ConvertDataSetToJSONString(ds.Tables[0]); sourceInfo = sourceInfo.Substring(2, sourceInfo.Length - 4); data = Utility.GetModulesJSONFormat("1", "Successful", sourceInfo, Utility.ConvertDataSetToJSONString(ds.Tables[1]), Utility.ConvertDataSetToJSONString(ds.Tables[2])); }//End else { data = Utility.AuthenticationError(); } } return(new APIResult(Request, data)); }
public IHttpActionResult SubmitAnswers(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); int surveyId = Convert.ToInt32(requestParams["SurveyID"].ToString()); int moduleId = Convert.ToInt32(requestParams["ModuleID"].ToString()); int contentId = Convert.ToInt32(requestParams["ContentID"].ToString()); var ds = TrainningBL.SubmitAnswers(compId, userId, surveyId, requestParams); if (ds.Tables.Count > 0) { if (Convert.ToInt32(ds.Tables[0].Rows[0]["ResponseID"].ToString()) > 0) { List <Question> questionList = new List <Question>(); var dsContent = TrainningBL.GetContentDetails(compId, userId, topicId, moduleId, contentId, ref questionList); var questionJson = JsonConvert.SerializeObject(questionList); var contents = Utility.ConvertDataSetToJSONString(dsContent.Tables[0]); contents = contents.Substring(2, contents.Length - 4); data = Utility.GetJSONData("1", "Successful", contents, questionJson, Utility.ConvertDataSetToJSONString(dsContent.Tables[3]), Utility.ConvertDataSetToJSONString(dsContent.Tables[4])); } else { // Error. Check Logs data = Utility.API_Status("1", "There might be some error. Please try again later"); } } else { // Unknown Error data = Utility.API_Status("1", "Unknown Error"); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult RateContent(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); int moduleId = Convert.ToInt32(requestParams["ModuleID"].ToString()); int contentId = Convert.ToInt32(requestParams["ContentID"].ToString()); string rating = requestParams["Rating"].ToString(); var ds = TrainningBL.RateContent(compId, userId, topicId, moduleId, contentId, rating, userId); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows[0]["StatusCode"].ToString() == "1") { // Successful data = Utility.Successful(""); } else { // Error. Check Logs data = Utility.API_Status("1", "There might be some error. Please try again later"); } } else { // Unknown Error data = Utility.API_Status("1", "Unknown Error"); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetContentDetails(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); int moduleId = Convert.ToInt32(requestParams["ModuleID"].ToString()); int contentId = Convert.ToInt32(requestParams["ContentID"].ToString()); List <Question> questionList = new List <Question>(); var ds = TrainningBL.GetContentDetails(compId, userId, topicId, moduleId, contentId, ref questionList); if (ds.Tables[0].Rows.Count > 0) { var questionJson = JsonConvert.SerializeObject(questionList); var contents = Utility.ConvertDataSetToJSONString(ds.Tables[0]); if (contents != "[]") { contents = contents.Substring(2, contents.Length - 4); } data = Utility.GetJSONData("1", "Successful", contents, questionJson, Utility.ConvertDataSetToJSONString(ds.Tables[3]), Utility.ConvertDataSetToJSONString(ds.Tables[4])); } else { // Unknown Error data = Utility.API_Status("0", "No Records Found."); } } catch (Exception ex) { data = Utility.Exception(ex); } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult RetakeTest(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; string surveyId = requestParams["SurveyID"].ToString(); var ds = TrainningBL.ClearAnswers(compId, userId, surveyId); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows[0]["StatusCode"].ToString() == "1") { // Successful data = Utility.Successful(""); } else { // Error. Check Logs data = Utility.API_Status("1", "There might be some error. Please try again later"); } } else { // Unknown Error data = Utility.API_Status("0", "No Records Found."); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetAchievementNGifts(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; List <Achievement> achievementList = new List <Achievement>(); var ds = TrainningBL.GetAchievementGifts(compId, userId, ref achievementList); data = Utility.GetAchievementGiftsJSONFormat("1", "Success", JsonConvert.SerializeObject(achievementList), Utility.ConvertDataSetToJSONString(ds.Tables[2])); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { //Added on 04 Jun 20 to preview add course without login if (Request.Headers.Contains("Authorization") && Request.Headers.GetValues("Authorization").First().ToUpper() == "Bearer".ToUpper()) { int compId = 0; string userId = "0"; List <Achievement> achievementList = new List <Achievement>(); var ds = TrainningBL.GetAchievementGifts(compId, userId, ref achievementList); data = Utility.GetAchievementGiftsJSONFormat("1", "Success", JsonConvert.SerializeObject(achievementList), Utility.ConvertDataSetToJSONString(ds.Tables[2])); } else { data = Utility.AuthenticationError(); } } return(new APIResult(Request, data)); }
public IHttpActionResult IsUserOnline(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now; int totalTime = 0; int type = Convert.ToInt32(requestParams["Type"].ToString()); if (type == 2) { startDate = Convert.ToDateTime(requestParams["StartDate"].ToString()); endDate = Convert.ToDateTime(requestParams["EndDate"].ToString()); totalTime = Convert.ToInt32(requestParams["TotalTime"].ToString()); } var ds = TrainningBL.IsUserOnline(compId, userId, type, startDate, endDate, totalTime); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (HttpContext.Current.Session["UserId"] != null && HttpContext.Current.Session["CompId"] != null) { DataSet ds = TrainningBL.GetMsgNotifications(Convert.ToInt32(HttpContext.Current.Session["CompId"]), HttpContext.Current.Session["UserId"].ToString(), 4); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { lblNotiCount.Text = ds.Tables[0].Rows[0]["NotificationCount"].ToString(); } else { lblNotiCount.Text = ""; } } } if (HttpContext.Current.Session["UserId"] != null && ( Convert.ToString(Session["RoleName"]) == "superadmin" || Convert.ToString(Session["RoleName"]) == "companyadmin" || Convert.ToString(Session["RoleName"]) == "subadmin" || Convert.ToString(Session["RoleName"]) == "enduser" )) { string CurrDirecotry = Server.MapPath("/").ToString(); string FullPath = CurrDirecotry + System.IO.Path.GetFileName(Request.Url.AbsolutePath); if (HttpContext.Current.Session["IsFirstLogin"] != null && Convert.ToBoolean(HttpContext.Current.Session["IsFirstLogin"]) == true && FullPath != CurrDirecotry + "Settings.aspx" && FullPath != CurrDirecotry + "ChangePassword.aspx") { Response.Redirect("~/t/Settings.aspx", true);// This is 1st time login.. } else if (HttpContext.Current.Session["IsFirstPasswordNotChanged"] != null && Convert.ToBoolean(HttpContext.Current.Session["IsFirstPasswordNotChanged"]) == true && FullPath != CurrDirecotry + "ChangePassword.aspx" && FullPath != CurrDirecotry + "Settings.aspx") { Response.Redirect("~/t/ChangePassword.aspx", true);// This is user has not changed password.. } if (HttpContext.Current.Session["FirstName"] != null && HttpContext.Current.Session["LastName"] != null) { lblUserName.Text = HttpContext.Current.Session["FirstName"].ToString() + " " + HttpContext.Current.Session["LastName"].ToString(); } if (HttpContext.Current.Session["ProfilePicFile"] != null && !string.IsNullOrEmpty(HttpContext.Current.Session["ProfilePicFile"].ToString())) { imgProfilePic.Src = "../Files/ProfilePic/" + HttpContext.Current.Session["ProfilePicFile"].ToString(); } if (HttpContext.Current.Session["CompanyProfilePicFile"] != null && !string.IsNullOrEmpty(HttpContext.Current.Session["CompanyProfilePicFile"].ToString())) { imgCompanyLogo.Src = "../Files/CompLogo/" + HttpContext.Current.Session["CompanyProfilePicFile"].ToString(); } var fName = "Me"; if (Session["FirstName"] != null) { fName = Convert.ToString(Session["FirstName"]); } //aMe_Menu.InnerHtml = "<i class='fas fa-user'></i><span class='tooltiptext'>" + fName + "</span><span>" + fName + "</span>"; //sideNav.Style.Add("background-color", "blue"); if (HttpContext.Current.Session["RoleName"] != null) { if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.superadmin) { dvDashboard.Visible = true; dvUserDashboard.Visible = false; dvGroups.Visible = true; dvUsers.Visible = true; dvTopics.Visible = true; dvAssignTopics.Visible = true; dvMenu_Directory.Visible = true; dvSubMenu_Organizations.Visible = true; dvMenu_Integrations.Visible = true; dvSubMenu_ContentSettings.Visible = true; dvSubMenu_Roles.Visible = true; dvSubMenu_Customize.Visible = true; dvSubMenu_Users.Visible = false; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.companyadmin) { dvDashboard.Visible = true; dvUserDashboard.Visible = false; dvGroups.Visible = true; dvUsers.Visible = true; dvTopics.Visible = true; dvAssignTopics.Visible = true; dvSubMenu_AssignTopics.Visible = true; dvMenu_Directory.Visible = true; dvMenu_Integrations.Visible = true; dvSubMenu_ContentSettings.Visible = true; dvMenu_Account.Visible = true; dvSubMenu_Customize.Visible = true; dvSubMenu_AssignTopics.Visible = true; dvSubMenu_Organizations.Visible = false; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.subadmin) { dvDashboard.Visible = true; dvUserDashboard.Visible = false; dvGroups.Visible = false; dvUsers.Visible = false; dvTopics.Visible = true; dvAssignTopics.Visible = false; dvSubMenu_ContentSettings.Visible = true; dvSubMenu_Customize.Visible = true; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.enduser) { dvDashboard.Visible = false; dvUserDashboard.Visible = true; dvGroups.Visible = false; dvUsers.Visible = false; dvTopics.Visible = false; dvAssignTopics.Visible = false; } } // Change Theme Colors & Fonts.. var theme1 = Convert.ToString(HttpContext.Current.Session["ThemeColor"]); var theme2 = Convert.ToString(HttpContext.Current.Session["ThemeColor2"]); var theme3 = Convert.ToString(HttpContext.Current.Session["ThemeColor3"]); var theme4 = Convert.ToString(HttpContext.Current.Session["ThemeColor4"]); if (!string.IsNullOrEmpty(theme1)) { //dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme2)) { //dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme3)) { // dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme4)) { dvBody.Style.Add("font-family", theme4); } } else { Response.Redirect("~/login.aspx"); } }
public IHttpActionResult ManageQuestion(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { var compId = identity.CompId; var userId = identity.UserID; var questionId = 0; var isMandatory = true; var isMultiline = true; var contentId = 0; var title = ""; var qType = 0; var maxScore = 0.0; var isBox = false; var contentTypeId = Convert.ToInt32(Convert.ToString(requestParams["ContentTypeID"])); var action = Convert.ToInt32(Convert.ToString(requestParams["Action"])); var type = Convert.ToInt32(Convert.ToString(requestParams["Type"])); if (!string.IsNullOrEmpty(Convert.ToString(requestParams["QuestionID"]))) { questionId = Convert.ToInt32(requestParams["QuestionID"]); } if (!string.IsNullOrEmpty(Convert.ToString(requestParams["ContentID"]))) { contentId = Convert.ToInt32(requestParams["ContentID"]); } if (action == 1 || action == 2) { title = Convert.ToString(requestParams["Title"]); qType = Convert.ToInt32(Convert.ToString(requestParams["QType"])); // Numeric if (!string.IsNullOrEmpty(Convert.ToString(requestParams["IsBox"]))) { isBox = Convert.ToBoolean(Convert.ToString(requestParams["IsBox"])); } if (type == 1) { // Survey } else if (type == 2) { // Flashcards } else if (type == 3) { // Final Quiz maxScore = Convert.ToDouble(Convert.ToString(requestParams["MaxScore"])); } } else if (action == 3) { } else if (action == 4) { } // CALL BL var ds = QuizBL.ManageQuestion(compId, userId, questionId, contentId, isMandatory, isMultiline, title, qType, isBox, action); if (Convert.ToInt32(ds.Tables[0].Rows[0]["QuestionID"].ToString()) > 0 && (action == 1 || action == 2)) { questionId = Convert.ToInt32(ds.Tables[0].Rows[0]["QuestionID"].ToString()); for (int i = 0; i < requestParams["AnswerOptions"].Count(); i++) { bool isCorrect = false; double score = 0; var answerid = 0; if (!string.IsNullOrEmpty(Convert.ToString(requestParams["AnswerOptions"][i]["CorrectScore"]))) { score = Convert.ToInt32(requestParams["AnswerOptions"][i]["CorrectScore"]); } if (!string.IsNullOrEmpty(Convert.ToString(requestParams["AnswerOptions"][i]["AnswerID"]))) { answerid = Convert.ToInt32(requestParams["AnswerOptions"][i]["AnswerID"]); } if (!string.IsNullOrEmpty(Convert.ToString(requestParams["AnswerOptions"][i]["IsCorrect"]))) { isCorrect = Convert.ToBoolean(Convert.ToString(requestParams["AnswerOptions"][i]["IsCorrect"])); } var ds1 = QuizBL.ManageAnsOptions(compId, userId, contentId, questionId, answerid, Convert.ToString(requestParams["AnswerOptions"][i]["AnswerText"]), isCorrect, score, answerid > 0 ? 2 : 1); } } List <Question> questionAnswerList = new List <Question>(); var dataSet = TrainningBL.GetContentDetails(compId, userId, 0, 0, Convert.ToInt32(contentId), ref questionAnswerList); var totalScore = questionAnswerList.Sum(p => p.TotalScore); QuizBL.UpdateQuizDetails(compId, 0, 0, contentId, totalScore, 0, 0); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows[0]["ReturnCode"].ToString() == "1") { // Successful data = Utility.Successful(""); } else { // Error. Check Logs data = Utility.API_Status("1", "There might be some error. Please try again later"); } } else { // Unknown Error data = Utility.API_Status("1", "Unknown Error"); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult AddFavAndBookMark(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int TopicID = 0; int IsFav = 0; int IsBookMark = 0; bool ValFlag = true; string Message = string.Empty; int compId = identity.CompId; string userId = identity.UserID; if (requestParams.SelectToken("TopicID") != null && requestParams.SelectToken("TopicID").ToString().Trim() != "") { TopicID = Convert.ToInt32(requestParams.SelectToken("TopicID")); } else { Message = "Please provide TopicID."; ValFlag = false; } if (requestParams.SelectToken("Fav") != null && requestParams.SelectToken("Fav").ToString().Trim() != "" && (requestParams.SelectToken("Fav").ToString().Trim() == "0" || requestParams.SelectToken("Fav").ToString().Trim() == "1")) { IsFav = Convert.ToInt32(requestParams.SelectToken("Fav")); } else { Message = "Please provide valid Favourite flag."; ValFlag = false; } if (requestParams.SelectToken("BookMark") != null && requestParams.SelectToken("BookMark").ToString().Trim() != "" && (requestParams.SelectToken("BookMark").ToString().Trim() == "0" || requestParams.SelectToken("BookMark").ToString().Trim() == "1")) { IsBookMark = Convert.ToInt32(requestParams.SelectToken("BookMark")); } else { Message = "Please provide valid Bookmark flag."; ValFlag = false; } if (ValFlag) { var ds = TrainningBL.AddFavAndBookMark(userId, compId, TopicID, IsFav, IsBookMark); data = Utility.ConvertDataSetToJSONString(ds.Tables[0]); data = Utility.Successful(data); } else { data = Utility.API_Status("2", Message); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult GetBadgesAndPoints() { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { DataSet dsBadges = TrainningBL.GetBadges(identity.CompId, identity.UserID.ToString(), Convert.ToInt32(ConstantMessages.Action.VIEW)); DataSet dsPoints = TrainningBL.GetPoints(identity.CompId, identity.UserID.ToString(), Convert.ToInt32(ConstantMessages.Action.VIEW)); DataTable dtBadges = new DataTable(); DataTable dtPoints = new DataTable(); DataSet ds = new DataSet(); if (dsBadges.Tables[0].Rows.Count > 0) { dtBadges = dsBadges.Tables[0].Copy(); } ds.Tables.Add(dtBadges); ds.Tables[0].TableName = "Badges"; if (dsPoints.Tables[0].Rows.Count > 0) { dtPoints = dsPoints.Tables[0].Copy(); } ds.Tables.Add(dtPoints); ds.Tables[1].TableName = "Points"; ds.Tables.Add(dsBadges.Tables[1].Copy()); ds.Tables[2].TableName = "Rank"; ds.Tables.Add(dsBadges.Tables[2].Copy()); ds.Tables[3].TableName = "NextRank"; data = Utility.ConvertDataSetToJSONString(ds); data = Utility.Successful(data); } else { //Added on 04 Jun 20 to preview add course without login if (Request.Headers.Contains("Authorization") && Request.Headers.GetValues("Authorization").First().ToUpper() == "Bearer".ToUpper()) { DataSet dsBadges = TrainningBL.GetBadges(0, "0", Convert.ToInt32(ConstantMessages.Action.VIEW)); DataSet dsPoints = TrainningBL.GetPoints(0, "0", Convert.ToInt32(ConstantMessages.Action.VIEW)); DataTable dtBadges = new DataTable(); DataTable dtPoints = new DataTable(); DataSet ds = new DataSet(); if (dsBadges.Tables[0].Rows.Count > 0) { dtBadges = dsBadges.Tables[0].Copy(); } ds.Tables.Add(dtBadges); ds.Tables[0].TableName = "Badges"; if (dsPoints.Tables[0].Rows.Count > 0) { dtPoints = dsPoints.Tables[0].Copy(); } ds.Tables.Add(dtPoints); ds.Tables[1].TableName = "Points"; ds.Tables.Add(dsBadges.Tables[1].Copy()); ds.Tables[2].TableName = "Rank"; ds.Tables.Add(dsBadges.Tables[2].Copy()); ds.Tables[3].TableName = "NextRank"; data = Utility.ConvertDataSetToJSONString(ds); data = Utility.Successful(data); }//End else { data = Utility.AuthenticationError(); } } return(new APIResult(Request, data)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (HttpContext.Current.Session["UserId"] != null && HttpContext.Current.Session["CompId"] != null) { // Update Session Time List <ActiveUser> lstActiveUsers = new List <ActiveUser>(); if (Cache["ActiveUsers"] != null) { lstActiveUsers = (List <ActiveUser>)Cache["ActiveUsers"]; } ActiveUsersCache cache = new ActiveUsersCache(); cache.AddOrUpdate(lstActiveUsers, Convert.ToString(Session["UserId"]), Convert.ToString(Session["EmailID"]), Convert.ToString(Session["FirstName"]) + " " + Convert.ToString(Session["LastName"]), Session.SessionID); Cache["ActiveUsers"] = lstActiveUsers; DataSet ds = TrainningBL.GetMsgNotifications(Convert.ToInt32(HttpContext.Current.Session["CompId"]), HttpContext.Current.Session["UserId"].ToString(), 4); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { lblNotiCount.Text = ds.Tables[0].Rows[0]["NotificationCount"].ToString(); } else { lblNotiCount.Text = ""; } } } if (HttpContext.Current.Session["UserId"] != null && ( Convert.ToString(Session["RoleName"]) == "superadmin" || Convert.ToString(Session["RoleName"]) == "companyadmin" || Convert.ToString(Session["RoleName"]) == "subadmin" || Convert.ToString(Session["RoleName"]) == "enduser" )) { string CurrDirecotry = Server.MapPath("/").ToString(); string FullPath = CurrDirecotry + System.IO.Path.GetFileName(Request.Url.AbsolutePath); if (HttpContext.Current.Session["IsFirstLogin"] != null && Convert.ToBoolean(HttpContext.Current.Session["IsFirstLogin"]) == true && FullPath != CurrDirecotry + "Settings.aspx" && FullPath != CurrDirecotry + "ChangePassword.aspx") { Response.Redirect("~/t/Settings.aspx", true);// This is 1st time login.. } else if (HttpContext.Current.Session["IsFirstPasswordNotChanged"] != null && Convert.ToBoolean(HttpContext.Current.Session["IsFirstPasswordNotChanged"]) == true && FullPath != CurrDirecotry + "ChangePassword.aspx" && FullPath != CurrDirecotry + "Settings.aspx") { Response.Redirect("~/t/ChangePassword.aspx", true);// This is user has not changed password.. } if (HttpContext.Current.Session["FirstName"] != null && HttpContext.Current.Session["LastName"] != null) { lblUserName.Text = HttpContext.Current.Session["FirstName"].ToString() + " " + HttpContext.Current.Session["LastName"].ToString(); lblProfileUserName.InnerHtml = HttpContext.Current.Session["FirstName"].ToString() + " " + HttpContext.Current.Session["LastName"].ToString(); } if (HttpContext.Current.Session["ProfilePicFile"] != null && !string.IsNullOrEmpty(HttpContext.Current.Session["ProfilePicFile"].ToString())) { imgProfilePic.Src = "../Files/ProfilePic/" + HttpContext.Current.Session["ProfilePicFile"].ToString(); imgProfileUserPic.Src = "../Files/ProfilePic/" + HttpContext.Current.Session["ProfilePicFile"].ToString(); } if (HttpContext.Current.Session["CompanyProfilePicFile"] != null && !string.IsNullOrEmpty(HttpContext.Current.Session["CompanyProfilePicFile"].ToString())) { imgCompanyLogo.Src = "../Files/CompLogo/" + HttpContext.Current.Session["CompanyProfilePicFile"].ToString(); } var fName = "Me"; if (Session["FirstName"] != null) { fName = Convert.ToString(Session["FirstName"]); } //aMe_Menu.InnerHtml = "<i class='fas fa-user'></i><span class='tooltiptext'>" + fName + "</span><span>" + fName + "</span>"; //sideNav.Style.Add("background-color", "blue"); /* * if (HttpContext.Current.Session["RoleName"] != null) * { * if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.superadmin) * { * dvDashboard.Visible = true; * dvUserDashboard.Visible = false; * dvGroups.Visible = true; * dvUsers.Visible = true; * dvTopics.Visible = true; * dvAssignTopics.Visible = true; * * dvMenu_Directory.Visible = true; * dvSubMenu_Organizations.Visible = true; * dvMenu_Integrations.Visible = true; * dvSubMenu_ContentSettings.Visible = true; * dvSubMenu_Roles.Visible = true; * dvSubMenu_Customize.Visible = true; * * dvSubMenu_Users.Visible = false; * } * else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.companyadmin) * { * dvDashboard.Visible = true; * dvUserDashboard.Visible = false; * dvGroups.Visible = true; * dvUsers.Visible = true; * dvTopics.Visible = true; * dvAssignTopics.Visible = true; * * dvSubMenu_AssignTopics.Visible = true; * * dvMenu_Directory.Visible = true; * dvMenu_Integrations.Visible = true; * dvSubMenu_ContentSettings.Visible = true; * dvMenu_Account.Visible = true; * dvSubMenu_Customize.Visible = true; * dvSubMenu_AssignTopics.Visible = true; * * dvSubMenu_Organizations.Visible = false; * } * else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.subadmin) * { * dvDashboard.Visible = true; * dvUserDashboard.Visible = false; * dvGroups.Visible = false; * dvUsers.Visible = false; * dvTopics.Visible = true; * dvAssignTopics.Visible = false; * dvSubMenu_ContentSettings.Visible = true; * dvSubMenu_Customize.Visible = true; * } * else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.enduser) * { * dvDashboard.Visible = false; * dvUserDashboard.Visible = true; * dvGroups.Visible = false; * dvUsers.Visible = false; * dvTopics.Visible = false; * dvAssignTopics.Visible = false; * } * } */ if (HttpContext.Current.Session["RoleName"] != null) { if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.superadmin) { dvDashboard.Visible = true; dvLearn.Visible = true; dvMyLearning.Visible = true; dvTeamLearning.Visible = true; dvLearnNewSkills.Visible = true; dvDiscoverLearning.Visible = true; dvTopics.Visible = true; dvCoursesInsights.Visible = true; dvCoursesSettings.Visible = true; dvAllCourses.Visible = true; dvSubMenu_Organizations.Visible = true; dvProjects.Visible = true; dvTaskInsights.Visible = true; dvTaskSettings.Visible = true; dvCommunity.Visible = true; dvOnyxU.Visible = true; dvUsersNTeams.Visible = true; dvUsers.Visible = true; dvOrganizations.Visible = true; dvDirectorySettings.Visible = true; dvCommunity.Visible = true; dvConnectWithOtherLearners.Visible = true; dvDiscoverNewOpportunities.Visible = true; dvFunWithQuizzes.Visible = true; dvSettings.Visible = true; dvSettingsParent.Visible = true; dvMyAccount.Visible = true; dvOrganizationSettings.Visible = true; dvLanguages.Visible = true; dvAccountSettings.Visible = true; dvIntegrations.Visible = true; dvSessions.Visible = true; dvActivityLogs.Visible = true; dvBilling.Visible = false; dvEmail.Visible = false; dvHelp.Visible = true; dvSubMenu_HelpCenter.Visible = true; dvSubMenu_Support.Visible = true; dvSubMenu_Chat.Visible = true; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.companyadmin) { dvUserDashboard.Visible = true; dvTopics.Visible = true; dvAllCourses.Visible = true; // dvAddNewCourse.Visible = true; dvLearn.Visible = true; dvMyLearning.Visible = true; dvTeamLearning.Visible = true; dvLearnNewSkills.Visible = true; dvDiscoverLearning.Visible = true; dvAssignCourses.Visible = true; dvInsights.Visible = true; dvReport1.Visible = true; dvReport2.Visible = true; dvCoursesInsights.Visible = true; dvCoursesSettings.Visible = true; // dvAddNewTask.Visible = true; dvProjects.Visible = true; dvTaskInsights.Visible = true; dvTaskSettings.Visible = true; dvGroups.Visible = true; dvTeam.Visible = true; dvDepartment.Visible = true; dvCourseCategory.Visible = true; dvUserGroupMpng.Visible = true; dvUsers.Visible = true; // dvAddNewCourse.Visible = true; // dvAddNewTask.Visible = true; dvCommunity.Visible = true; dvLearnNewSkills.Visible = true; dvConnectWithOtherLearners.Visible = true; dvDiscoverNewOpportunities.Visible = true; dvFunWithQuizzes.Visible = true; dvOnyxU.Visible = true; dvUsersNTeams.Visible = true; dvUserGroupMpng.Visible = true; dvTeam.Visible = true; dvDepartment.Visible = true; dvDirectorySettings.Visible = true; dvSessions.Visible = true; dvActivityLogs.Visible = true; dvBilling.Visible = false; dvEmail.Visible = false; dvCustomize.Visible = true; dvIntegrations.Visible = true; dvAccountSettings.Visible = true; dvCommunity.Visible = true; dvConnectWithOtherLearners.Visible = true; dvDiscoverNewOpportunities.Visible = true; dvFunWithQuizzes.Visible = true; dvAdminConsole.Visible = true; dvContent.Visible = true; dvSettings.Visible = true; dvSettingsParent.Visible = true; dvMyAccount.Visible = true; dvLanguages.Visible = true; dvNotifications.Visible = true; dvSubMenu_HelpCenter.Visible = true; dvSubMenu_Support.Visible = true; dvSubMenu_Chat.Visible = true; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.subadmin) { dvUserDashboard.Visible = true; dvTopics.Visible = true; dvAllCourses.Visible = true; //dvAddNewCourse.Visible = true; dvCommunity.Visible = true; dvConnectWithOtherLearners.Visible = true; dvDiscoverNewOpportunities.Visible = true; dvFunWithQuizzes.Visible = true; dvAdminConsole.Visible = true; dvContent.Visible = true; // dvAddNewCourse.Visible = true; //dvAddNewTask.Visible = true; dvCoursesInsights.Visible = true; dvCoursesSettings.Visible = true; dvProjects.Visible = true; dvTaskInsights.Visible = true; dvTaskSettings.Visible = true; dvCommunity.Visible = true; dvOnyxU.Visible = true; dvSettings.Visible = true; dvSettingsParent.Visible = true; dvMyAccount.Visible = true; dvLanguages.Visible = true; dvNotifications.Visible = true; dvSubMenu_HelpCenter.Visible = true; dvSubMenu_Support.Visible = true; dvSubMenu_Chat.Visible = true; } else if (HttpContext.Current.Session["RoleName"].ToString() == ConstantMessages.Roles.enduser) { dvUserDashboard.Visible = true; dvTopics.Visible = true; dvCoursesInsights.Visible = true; dvCoursesSettings.Visible = false; dvProjects.Visible = true; dvTaskInsights.Visible = true; dvTaskSettings.Visible = true; dvCommunity.Visible = true; dvOnyxU.Visible = true; dvAllCourses.Visible = true; dvCommunity.Visible = true; dvConnectWithOtherLearners.Visible = true; dvDiscoverNewOpportunities.Visible = true; dvFunWithQuizzes.Visible = true; //dvSettings.Visible = true; dvMyAccount.Visible = true; dvLanguages.Visible = true; dvNotifications.Visible = true; dvSubMenu_HelpCenter.Visible = true; dvSubMenu_Support.Visible = true; dvSubMenu_Chat.Visible = true; } } // Change Theme Colors & Fonts.. var theme1 = Convert.ToString(HttpContext.Current.Session["ThemeColor"]); var theme2 = Convert.ToString(HttpContext.Current.Session["ThemeColor2"]); var theme3 = Convert.ToString(HttpContext.Current.Session["ThemeColor3"]); var theme4 = Convert.ToString(HttpContext.Current.Session["ThemeColor4"]); if (!string.IsNullOrEmpty(theme1)) { //dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme2)) { //dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme3)) { // dvBody.Style.Add("font-family", ""); } if (!string.IsNullOrEmpty(theme4)) { dvBody.Style.Add("font-family", theme4); } } else if (Request.Url.ToString().ToUpper().Contains("/t/course_preview.aspx?courseid".ToUpper())) { //Proceed with page redirection //HttpContext.Current.Session["requestedurlcourse"] = Request.Url.ToString(); //Response.Redirect(Request.Url.ToString(), false); } else { //This is used to keep the page where user requested .Purpose of this is to navigate already logged in user in same browser HttpCookie myCookie = Request.Cookies["UserInfo"]; if (myCookie != null) { HttpContext.Current.Session["requestedurl"] = Request.Url.ToString(); } //End Response.Redirect("~/login.aspx"); } }
public IHttpActionResult UpdateContent(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; string userId = identity.UserID; int topicId = Convert.ToInt32(requestParams["TopicID"].ToString()); int moduleId = Convert.ToInt32(requestParams["ModuleID"].ToString()); int contentId = Convert.ToInt32(requestParams["ContentID"].ToString()); var ds = TrainningBL.UpdateContent(compId, userId, topicId, moduleId, contentId); if (ds.Tables.Count > 0) { var tableIndex = 0; string isGift = "0"; if (ds.Tables[0].Columns.Contains("IsGift")) { // Successful - Unlocked a gift isGift = "1"; data = Utility.ContentUpdated("1", "Success", isGift, Utility.ConvertDataSetToJSONString(ds.Tables[0])); tableIndex = 1; TrainningBL.SendNotification(compId, userId, ConstantMessages.NotificationType.gift, "", ds.Tables[0].Rows[0]["Title"].ToString()); } else if (ds.Tables[0].Rows[0]["StatusCode"].ToString() == "1") { // Successful - Without Gift data = Utility.ContentUpdated("1", "Success", isGift, ""); } else { // Error. Check Logs data = Utility.API_Status("1", "There might be some error. Please try again later"); } if (ds.Tables[tableIndex].Columns.Contains("StatusCode")) { var moduleCompleted = false; if (Convert.ToBoolean(Convert.ToInt32(Convert.ToString(ds.Tables[tableIndex].Rows[0]["IsModuleCompleted"])))) { // Module Completed // ds.Tables[tableIndex + 1]; moduleCompleted = true; TrainningBL.SendNotification(compId, userId, ConstantMessages.NotificationType.module, "", ds.Tables[tableIndex + 1].Rows[0]["Title"].ToString()); } if (Convert.ToBoolean(Convert.ToInt32(Convert.ToString(ds.Tables[tableIndex].Rows[0]["IsTopicCompleted"])))) { // Topic Completed //ds.Tables[tableIndex + 1 + (moduleCompleted ? 1 : 0)]; TrainningBL.SendNotification(compId, userId, ConstantMessages.NotificationType.topic, "", ds.Tables[tableIndex + 1 + (moduleCompleted ? 1 : 0)].Rows[0]["Title"].ToString()); } } } else { // Unknown Error data = Utility.API_Status("0", "No Records Found."); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }
public IHttpActionResult AssignTopicsByEntity(JObject requestParams) { var data = ""; var identity = MyAuthorizationServerProvider.AuthenticateUser(); if (identity != null) { try { int compId = identity.CompId; //string[] mailUserIDs = new string[] { }; List <string> mailUserIDs = new List <string>(); string userId = identity.UserID; var topicIds = Convert.ToString(requestParams["TopicIds"].ToString()); var groupIds = Convert.ToString(requestParams["GroupIds"].ToString()); var userIds = Convert.ToString(requestParams["UserIds"].ToString()); var removeTopic = Convert.ToString(requestParams["RemoveTopics"].ToString()); if (!string.IsNullOrEmpty(userIds)) { var dsTopics = TrainningBL.GetUserAssignedTopic(compId, userIds); string[] arrTopics = topicIds.Split(','); string[] arrUsers = userIds.Split(','); //mailUserIDs = new string[arrUsers.Length]; if (dsTopics.Tables.Count > 0 && dsTopics.Tables[0].Rows.Count > 0) { for (int j = 0; j < arrUsers.Length; j++) { for (int i = 0; i < arrTopics.Length; i++) { if (!dsTopics.Tables[0].Select().ToList().Exists(row => row["Topics"].ToString() == arrTopics[i] && row["UserID"].ToString() == arrUsers[j])) { mailUserIDs.Add(arrUsers[j]); } } } } } var ds = TrainningBL.AssignTopicsByEntity(compId, userId, topicIds, groupIds, userIds, removeTopic); if (ds.Tables.Count > 0) { // Successful data = Utility.Successful(""); if (mailUserIDs.Count() > 0) { mailUserIDs = mailUserIDs.Distinct().ToList(); foreach (string UserID in mailUserIDs) { EmailHelper.GetEmailContent(Convert.ToInt32(UserID), identity.CompId, EmailHelper.Functionality.ADD_TOPIC, "", ""); } } } else { // Unknown Error data = Utility.API_Status("1", "Unknown Error"); } } catch (Exception ex) { data = Utility.Exception(ex);; } } else { data = Utility.AuthenticationError(); } return(new APIResult(Request, data)); }