Beispiel #1
0
    /// <summary>
    /// Load text to title (lblTitle)
    /// </summary>
    private void PopulateLabels()
    {
        var swJudge = false;

        // Verify if the user is judge
        if (challengeJudgeComponent.ChallengeJudge != null)
        {
            if (challengeJudgeComponent.ChallengeJudge.UserId == UserId)
            {
                if (!string.IsNullOrEmpty(challengeJudgeComponent.ChallengeJudge.FromDate.ToString()) || !string.IsNullOrEmpty(challengeJudgeComponent.ChallengeJudge.ToDate.ToString()))
                {
                    if (challengeJudgeComponent.ChallengeJudge.FromDate <= DateTime.Now && DateTime.Now <= challengeJudgeComponent.ChallengeJudge.ToDate)
                    {
                        swJudge = true;
                    }
                    else
                    if ((string.IsNullOrEmpty(challengeJudgeComponent.ChallengeJudge.FromDate.ToString()) && DateTime.Now <= challengeJudgeComponent.ChallengeJudge.ToDate) || (challengeJudgeComponent.ChallengeJudge.FromDate <= DateTime.Now && string.IsNullOrEmpty(challengeJudgeComponent.ChallengeJudge.ToDate.ToString())))
                    {
                        swJudge = true;
                    }
                }
                else
                {
                    swJudge = true;
                }
            }
        }

        //If the User is Administrador, NexsoSupport or Judge
        if (!(UserController.GetCurrentUserInfo().IsInRole("Administrators") || swJudge || UserController.GetCurrentUserInfo().IsInRole("NexsoSupport")))
        {
            Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("notauth"));
        }
        lblTitle.Text = challengeComponent.Challenge.ChallengeTitle;
    }
Beispiel #2
0
 private void RedirectToSing()
 {
     if (TabController.CurrentPage.FullUrl != NexsoHelper.GetCulturedUrlByTabName("registration"))
     {
         Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("registration"), false);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Method for create and indexed Informaction in Lucenen files
        /// </summary>
        /// <param name="directoryInfo"></param>
        /// <param name="listDataIndexed"></param>
        private void IndexedData(DirectoryInfo directoryInfo, List <IndexDataDto> listDataIndexed)
        {
            using (Directory directory = FSDirectory.Open(directoryInfo))
                using (Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30))
                    using (var writer = new IndexWriter(directory, analyzer, new IndexWriter.MaxFieldLength(10000)))
                    {
                        //This list is for update State in the table AnalysisData whene object is indexed lucene file
                        List <Guid> listRequestUpdateState = new List <Guid>();

                        foreach (var item in listDataIndexed)
                        {
                            var    document   = new Document();
                            string objectIdEx = item.objectId.ToString();
                            //This try validate that is there is some error in registration can continue the System
                            try
                            {
                                string fullRequest = string.Empty;
                                fullRequest = string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12}", item.fullRequest, item.title, item.keywords, item.sentences, item.concepts, item.language, item.category, item.key, item.label, item.country, item.region, item.city, item.organizationName);
                                fullRequest = NexsoHelper.DecodeHtmlAndRemoveAccents(fullRequest.ToLower());

                                if (!item.objectId.Equals(Guid.Empty))
                                {
                                    document.Add(new Field("ObjetcId", item.objectId.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
                                }

                                if (!string.IsNullOrEmpty(item.fullRequest))
                                {
                                    document.Add(new Field("Title", NexsoHelper.DecodeHtmlAndRemoveAccents(item.title), Field.Store.YES, Field.Index.ANALYZED));
                                }

                                if (!string.IsNullOrEmpty(item.fullRequest))
                                {
                                    document.Add(new Field("OrganizationName", NexsoHelper.DecodeHtmlAndRemoveAccents(item.organizationName), Field.Store.YES, Field.Index.ANALYZED));
                                }


                                if (!string.IsNullOrEmpty(item.fullRequest))
                                {
                                    document.Add(new Field("FullRequest", fullRequest, Field.Store.YES, Field.Index.ANALYZED));
                                }
                                document.Boost = item.scoreValue;
                                writer.AddDocument(document);
                                listRequestUpdateState.Add(item.objectId);
                            }
                            catch (Exception ex)
                            {
                                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                            }
                        }
                        writer.Optimize();
                        writer.Flush(true, true, true);

                        if (listRequestUpdateState.Count > 0)
                        {
                            UpdateStateIndex(listRequestUpdateState);
                        }
                    }
        }
    public string UrlEscore(string SolutionId, int Status)
    {
        string Url = NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + SolutionId;

        if (Status >= 800)
        {
            Url = NexsoHelper.GetCulturedUrlByTabName("solprofilescore") + "/sl/" + SolutionId;
        }
        return(Url);
    }
Beispiel #5
0
        public static string GetNotificationLink(string indicatorType, string objectType, CultureInfo culture, string id)
        {
            switch (objectType)
            {
            case "SOLUTION":
            {
                return(NexsoHelper.GetCulturedUrlByTabName("solprofile", 7, culture.Name) + "/sl/" + id);
            }
            }

            return("");
        }
Beispiel #6
0
    protected void btnLogin_Click(object sender, System.EventArgs e)
    {
        if (SessionToken <= 3)
        {
            SessionToken++;

            if (txtPassword.Text == "NexsoYChapulinColorado2015")
            {
                SessionToken = 0;
                Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("Home"), true);
            }
        }
        else
        {
            if (SessionToken == 4)
            {
                SessionToken = DateTime.Now.Ticks;
            }
            else
            {
                if (DateTime.Now.Ticks - SessionToken > 300000000)
                {
                    SessionToken = 1;
                }
            }
        }


        //DateTime currentTick = DateTime.Now;

        //if (SessionList[0] == "check")
        //{
        //    SessionList[0] = "1";
        //    SessionList.Add(currentTick.AddSeconds(30).ToString());
        //}
        //else if (Convert.ToInt32(SessionList[0]) < 3)
        //{
        //    SessionList[0] = (Convert.ToInt32(SessionList[0]) + 1).ToString();
        //    SessionList[1] = currentTick.AddSeconds(30).ToString();
        //}



        //if (Convert.ToInt32(SessionList[0]) >= 3 && (DateTime.Compare(Convert.ToDateTime(SessionList[1]), DateTime.Now) > 0))
        //{
        //    SessionList[0] = "3";
        //    SessionList[1] = currentTick.AddSeconds(30).ToString();
        //}
        //else if (Convert.ToInt32(SessionList[0]) >= 3 && (DateTime.Compare(Convert.ToDateTime(SessionList[1]), DateTime.Now) <= 0))
        //{
        //    SessionList[0] = "1";
        //}
    }
Beispiel #7
0
        public static void SendCommentNotificationEmails(SolutionCommentComponent solutionCommentComponent, PortalSettings portalSettings, UserInfo currentUser)
        {
            ResourceManager Localization = new ResourceManager("NexsoServices.App_LocalResources.Resource",
                                                               Assembly.GetExecutingAssembly());
            List <int> userIds = new List <int>();

            foreach (SolutionComment solutionComment in solutionCommentComponent.SolutionComment.Solution.SolutionComments)
            {
                if (!userIds.Contains(solutionComment.UserId.GetValueOrDefault(-1)))
                {
                    userIds.Add(solutionComment.UserId.GetValueOrDefault(-1));
                }
            }
            if (solutionCommentComponent.SolutionComment.Solution.CreatedUserId.GetValueOrDefault(-1) != -1)
            {
                userIds.Add(solutionCommentComponent.SolutionComment.Solution.CreatedUserId.GetValueOrDefault(-1));
            }
            foreach (int userids in userIds)
            {
                UserInfo user = DotNetNuke.Entities.Users.UserController.GetUserById(portalSettings.PortalId, userids);
                UserPropertyComponent property = new UserPropertyComponent(userids);
                if (currentUser.UserID != user.UserID)
                {
                    CultureInfo language = new CultureInfo(HelperMethods.GetUserLanguage(property.UserProperty.Language.GetValueOrDefault(1)));
                    DotNetNuke.Services.Mail.Mail.SendEmail("*****@*****.**",
                                                            user.Email,
                                                            string.Format(
                                                                Localization.GetString("MessageTitleComment", language),
                                                                currentUser.FirstName + " " + currentUser.LastName,
                                                                solutionCommentComponent.SolutionComment.Solution.Title),
                                                            Localization.GetString("MessageBodyComment", language).Replace(
                                                                "{COMMENT:Body}", solutionCommentComponent.SolutionComment.Comment).Replace(
                                                                "{SOLUTION:Title}", solutionCommentComponent.SolutionComment.Solution.Title).Replace(
                                                                "{SOLUTION:PageLink}", NexsoHelper.GetCulturedUrlByTabName("solprofile", 7, language.Name) +
                                                                "/sl/" + solutionCommentComponent.SolutionComment.Solution.SolutionId.ToString())
                                                            );
                }
            }
            CultureInfo langua = new CultureInfo("en-US");

            DotNetNuke.Services.Mail.Mail.SendEmail("*****@*****.**",
                                                    "[email protected],[email protected], [email protected],[email protected],[email protected]", "NOTIFICATION: " +
                                                    string.Format(
                                                        Localization.GetString("MessageTitleComment", langua),
                                                        currentUser.FirstName + " " + currentUser.LastName, solutionCommentComponent.SolutionComment
                                                        .Solution.Title),
                                                    Localization.GetString("MessageBodyComment", langua).Replace(
                                                        "{COMMENT:Body}", solutionCommentComponent.SolutionComment.Comment).Replace(
                                                        "{SOLUTION:Title}", solutionCommentComponent.SolutionComment.Solution.Title).Replace(
                                                        "{SOLUTION:PageLink}", NexsoHelper.GetCulturedUrlByTabName("solprofile", 7, langua.Name) +
                                                        "/sl/" + solutionCommentComponent.SolutionComment.Solution.SolutionId.ToString())
                                                    );
        }
Beispiel #8
0
    public void ShowData()
    {
        objTabController = new TabController();
        if (solutionId != Guid.Empty)
        {
            SolutionComponent solutionComponent = new SolutionComponent(solutionId);
            lnkSolutionName.Text        = solutionComponent.Solution.Title;
            lnkSolutionName.NavigateUrl = NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + solutionId.ToString();
            OrganizationComponent organizationComponent = new OrganizationComponent(solutionComponent.Solution.OrganizationId);
            lnkInstitutionName.Text        = organizationComponent.Organization.Name;
            lnkInstitutionName.NavigateUrl = NexsoHelper.GetCulturedUrlByTabName("insprofile") + "/in/" + organizationComponent.Organization.OrganizationID;

            lblSolutionshortDescription.Text = solutionComponent.Solution.TagLine;


            lblduration.Text = ListComponent.GetLabelFromListValue("ProjectDuration", Thread.CurrentThread.CurrentCulture.Name, solutionComponent.Solution.Duration.ToString());
            // lblFormat.Text = ListComponent.GetLabelFromListValue("DeliveryFormat", Thread.CurrentThread.CurrentCulture.Name, solutionComponent.Solution.DeliveryFormat.ToString());
            FillBeneficiaries();
            FillThemes();
            FillFormat();
            LocationList1.SolutionId = solutionComponent.Solution.SolutionId;
            LocationList1.EditMode   = false;
            mainPanel.Visible        = true;
            EmptyPanel.Visible       = false;
            LocationList1.LoadData();

            if (!string.IsNullOrEmpty(organizationComponent.Organization.Logo))
            {
                imgOrganizationLogo.ImageUrl = PortalSettings.HomeDirectory + "ModIma/Images/" +
                                               organizationComponent.Organization.Logo;
            }
            else
            {
                imgOrganizationLogo.ImageUrl = PortalSettings.HomeDirectory + "ModIma/Images/noImage.png";
            }

            imgThemeIcon.ImageUrl = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "") + ControlPath +
                                    "images/theme.png";
            imgBeneficiariesIcon.ImageUrl = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "") + ControlPath +
                                            "images/beneficiaries.png";
            btnView.CommandArgument = solutionId.ToString();
        }
        else
        {
            mainPanel.Visible  = false;
            EmptyPanel.Visible = true;
        }
    }
Beispiel #9
0
    /// <summary>
    /// Load text to labels and load the all categories of user preferences
    /// </summary>
    private void PopulateControls()
    {
        var list          = ListComponent.GetListPerCategory("AvailableResource", Thread.CurrentThread.CurrentCulture.Name).ToList();
        var listEmptyItem = new NexsoProDAL.List();

        listEmptyItem.Value = "0";
        listEmptyItem.Label = Localization.GetString("SelectItem", LocalResourceFile);
        list = ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkTheme.DataSource = list;
        chkTheme.DataBind();
        list = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkBeneficiaries.DataSource = list;
        chkBeneficiaries.DataBind();
        list = ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkSector.DataSource = list;
        chkSector.DataBind();
        list = ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlWhoareYou.DataSource = list;
        ddlWhoareYou.DataBind();
        list = ListComponent.GetListPerCategory("Source", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlSource.DataSource = list;
        ddlSource.DataBind();
        list = ListComponent.GetListPerCategory("Language", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlLanguage.DataSource = list;
        ddlLanguage.DataBind();
        if (userId > 0)
        {
            txtEmail.Text    = currentUser.Email;
            lblEmailTxt.Text = txtEmail.Text;
            foreach (ProfilePropertyDefinition property in currentUser.Profile.ProfileProperties)
            {
                MapPropToPage(property.PropertyName, property.PropertyValue);
            }
            MapPropToPage(userId);
        }

        var    returnUrl = Globals.UserProfileURL(userId);
        string url       = NexsoHelper.GetCulturedUrlByTabName("Change Password") + "?returnurl=" + returnUrl;

        passwordLink.NavigateUrl = url;
        if (PortalSettings.EnablePopUps)
        {
            passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650));
        }
    }
Beispiel #10
0
        /// <summary>
        /// </summary>
        /// <param name="textSearcher">This is a text for get data</param>
        /// <returns>List of all Id gets for the search in Lucene Indexed files</returns>
        public List <string> SearcherId(string textSearcher)
        {
            var lReturn = new List <string>();

            DirectoryInfo directoryInfo = null;
            string        directoryPath = NexsoHelper.AssemblyDirectory.Replace("bin", "App_Data");

            directoryInfo = new DirectoryInfo(directoryPath + SettingsAppIndex.Default.LuceneFullPath);
            //This line is for remove Accents of text
            textSearcher = NexsoHelper.DecodeHtmlAndRemoveAccents(textSearcher.ToLower());

            if (directoryInfo != null)
            {
                GetDataIndexId(directoryInfo, ref textSearcher, ref lReturn);
            }

            return(lReturn);
        }
Beispiel #11
0
    //protected void txtEmail_TextChanged(object sender, EventArgs e)
    //{
    //    int total = 0;
    //    UserController.GetUsersByUserName(PortalId, txtEmail.Text, 1, 1, ref total);
    //    if (total > 0)
    //        cvExistingMail.IsValid = false;
    //    else
    //        cvExistingMail.IsValid = true;
    //}
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (userId < 0)
        {
            userId = AddUser();
            if (userId >= 0)
            {
                rfvExistingMail.IsValid = true;
                SaveRadListView("Theme");
                SaveRadListView("Beneficiaries");
                SaveRadListView("WhoAreYou");
                SaveRadListView("Sector");
            }
            else
            {
                rfvExistingMail.IsValid = false;
                return;
            }
        }
        else
        {
            SaveProfile(userPropertyComponent.UserProperty);
            userPropertyComponent.Save();
        }

        if (!string.IsNullOrEmpty(returnParameter))
        {
            Response.Redirect(NexsoHelper.GetCulturedUrlByTabName(returnParameter), false);
        }
        else
        {
            if (!string.IsNullOrEmpty(returnUrl))
            {
                Response.Redirect(returnUrl, false);
            }
            else
            {
                Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("Explore"), false);
            }
        }
    }
Beispiel #12
0
        public static async Task SendEmailToUser(string subjectTemplate, string bodyTemplate, UserInfo userTo, CultureInfo culture, string messageSubject, string messageBody)
        {
            await Task.Run(() =>
            {
                ResourceManager Localization = new ResourceManager("NexsoServices.App_LocalResources.Resource",
                                                                   Assembly.GetExecutingAssembly());

                UserPropertyComponent currentUser = new UserPropertyComponent(userTo.UserID);
                DotNetNuke.Services.Mail.Mail.SendEmail("*****@*****.**",
                                                        userTo.Email,
                                                        string.Format(
                                                            Localization.GetString(subjectTemplate, culture),
                                                            currentUser.UserProperty.FirstName + " " + currentUser.UserProperty.LastName
                                                            ),
                                                        Localization.GetString("MessageBodyMessage", culture).Replace(
                                                            "{MESSAGE:Body}", messageBody).Replace(
                                                            "{MESSAGE:ViewLink}", NexsoHelper.GetCulturedUrlByTabName("MyMessages", 7, culture.Name))

                                                        );
            }
                           );
        }
Beispiel #13
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                if (!LegacyMode)
                {
                    registerLink.Visible = false;
                }

                if (!String.IsNullOrEmpty(CssClass))
                {
                    registerLink.CssClass         = CssClass;
                    enhancedRegisterLink.CssClass = CssClass;
                }

                if (Request.IsAuthenticated == false)
                {
                    userFirstName.Text = Localization.GetString("SignIn", Localization.GetResourceFile(this, MyFileName));
                    Logout.Text        = Localization.GetString("LogIn", Localization.GetResourceFile(this, MyFileName));

                    string returnUrl = HttpContext.Current.Request.RawUrl;
                    if (returnUrl.IndexOf("?returnurl=") != -1)
                    {
                        returnUrl = returnUrl.Substring(0, returnUrl.IndexOf("?returnurl="));
                    }
                    returnUrl = HttpUtility.UrlEncode(returnUrl);


                    Logout.NavigateUrl = Globals.LoginURL(returnUrl, (Request.QueryString["override"] != null));



                    messageGroup.Visible      = false;
                    notificationGroup.Visible = false;
                    avatarGroup.Visible       = false;
                    Messages.Visible          = false;
                    if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration)
                    {
                        if (!String.IsNullOrEmpty(Text))
                        {
                            if (Text.IndexOf("src=") != -1)
                            {
                                Text = Text.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                            }
                            registerLink.Text         = Text;
                            enhancedRegisterLink.Text = Text;
                        }
                        else
                        {
                            registerLink.Text            = Localization.GetString("Register", Localization.GetResourceFile(this, MyFileName));
                            enhancedRegisterLink.Text    = registerLink.Text;
                            registerLink.ToolTip         = registerLink.Text;
                            enhancedRegisterLink.ToolTip = registerLink.Text;
                        }
                        if (PortalSettings.Users < PortalSettings.UserQuota || PortalSettings.UserQuota == 0)
                        {
                            if (LegacyMode)
                            {
                                registerLink.Visible = true;
                            }
                            else
                            {
                                enhancedRegisterLink.Visible = true;
                            }
                        }
                        else
                        {
                            registerLink.Visible = false;
                        }

                        registerLink.NavigateUrl = !String.IsNullOrEmpty(URL)
                                            ? URL
                                            : Globals.RegisterURL(HttpUtility.UrlEncode(Globals.NavigateURL()), Null.NullString);
                        enhancedRegisterLink.NavigateUrl = registerLink.NavigateUrl;

                        if (PortalSettings.EnablePopUps && PortalSettings.RegisterTabId == Null.NullInteger &&
                            !HasSocialAuthenticationEnabled())
                        {
                            var clickEvent = "return " + UrlUtils.PopUpUrl(registerLink.NavigateUrl, this, PortalSettings, true, false, 600, 950);
                            registerLink.Attributes.Add("onclick", clickEvent);
                            enhancedRegisterLink.Attributes.Add("onclick", clickEvent);
                        }
                    }
                    else
                    {
                        registerLink.Visible = false;
                    }
                }
                else
                {
                    var userInfo = UserController.GetCurrentUserInfo();
                    if (userInfo.UserID != -1)
                    {
                        Messages.Visible         = true;
                        email.Text               = userInfo.Email;
                        userFirstName.Text       = userInfo.FirstName;
                        registerLink.Text        = userInfo.DisplayName;
                        registerLink.NavigateUrl = Globals.UserProfileURL(userInfo.UserID);
                        registerLink.ToolTip     = Localization.GetString("VisitMyProfile", Localization.GetResourceFile(this, MyFileName));

                        enhancedRegisterLink.Text        = Localization.GetString("MyProfile", Localization.GetResourceFile(this, MyFileName));
                        enhancedRegisterLink.NavigateUrl = registerLink.NavigateUrl;
                        enhancedRegisterLink.ToolTip     = registerLink.ToolTip;

                        Settings.Text        = Localization.GetString("Settings", Localization.GetResourceFile(this, MyFileName));
                        Settings.NavigateUrl = NexsoHelper.GetCulturedUrlByTabName("Registration");

                        //MySolutions.Text = Localization.GetString("MySolutions", Localization.GetResourceFile(this, MyFileName));
                        //MySolutions.NavigateUrl = NexsoHelper.GetCulturedUrlByTabName("explore")+"?ui="+userInfo.UserID;

                        Logout.Text        = Localization.GetString("Logout", Localization.GetResourceFile(this, MyFileName));
                        Logout.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Logoff");

                        Messages.Text        = Localization.GetString("MyMessages", Localization.GetResourceFile(this, MyFileName));
                        Messages.NavigateUrl = NexsoHelper.GetCulturedUrlByTabName("MyMessages");
                        if (ShowUnreadMessages)
                        {
                            var unreadMessages = InternalMessagingController.Instance.CountUnreadMessages(userInfo.UserID, userInfo.PortalID);
                            var unreadAlerts   = NotificationsController.Instance.CountNotifications(userInfo.UserID, userInfo.PortalID);

                            messageLink.Text      = unreadMessages > 0 ? string.Format(Localization.GetString("Messages", Localization.GetResourceFile(this, MyFileName)), unreadMessages) : Localization.GetString("NoMessages", Localization.GetResourceFile(this, MyFileName));
                            notificationLink.Text = unreadAlerts > 0 ? string.Format(Localization.GetString("Notifications", Localization.GetResourceFile(this, MyFileName)), unreadAlerts) : Localization.GetString("NoNotifications", Localization.GetResourceFile(this, MyFileName));

                            var messageTabUrl = Globals.NavigateURL(GetMessageTab(), "", string.Format("userId={0}", userInfo.UserID));
                            messageLink.NavigateUrl      = messageTabUrl;
                            notificationLink.NavigateUrl = messageTabUrl + "?view=notifications&action=notifications";
                            notificationLink.ToolTip     = Localization.GetString("CheckNotifications", Localization.GetResourceFile(this, MyFileName));
                            messageLink.ToolTip          = Localization.GetString("CheckMessages", Localization.GetResourceFile(this, MyFileName));
                            messageGroup.Visible         = true;
                            notificationGroup.Visible    = true;

                            if (LegacyMode && unreadMessages > 0)
                            {
                                registerLink.Text = registerLink.Text + string.Format(Localization.GetString("NewMessages", Localization.GetResourceFile(this, MyFileName)), unreadMessages);
                            }
                        }
                        else
                        {
                            messageGroup.Visible      = false;
                            notificationGroup.Visible = false;
                        }

                        if (ShowAvatar)
                        {
                            avatar.ImageUrl     = string.Format(Globals.UserProfilePicFormattedUrl(), userInfo.UserID, 32, 32);
                            avatar.NavigateUrl  = enhancedRegisterLink.NavigateUrl;
                            avatar.ToolTip      = Localization.GetString("ProfileAvatar", Localization.GetResourceFile(this, MyFileName));
                            avatarGroup.Visible = true;
                        }
                        else
                        {
                            avatarGroup.Visible = false;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #14
0
 protected void btnView_Click1(object sender, EventArgs e)
 {
     Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + ((Button)sender).CommandArgument);
 }
Beispiel #15
0
    /// <summary>
    /// Changes the view to edit mode
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnEditProfile_Click1(object sender, EventArgs e)
    {
        if (btnEditProfile.CommandArgument == "EDIT")
        {
            PopulateControls();
            setControl("EDIT");
        }
        else if (btnEditProfile.CommandArgument == "CREATE")
        {
            int userIdTmp = AddUser();

            if (userId == -1000)
            {
                userId = userIdTmp;
                SaveChkControl("Theme", chkTheme);
                Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("My Nexso") + "/ui/" + userId,
                                  false);
            }
            else if (userIdTmp >= 0)
            {
                userId = userIdTmp;
                SaveChkControl("Theme", chkTheme);
                Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("Discover solutions"),
                                  false);
            }
        }
        else if (btnEditProfile.CommandArgument == "EDITING")
        {
            btnEditProfile.CommandArgument = "EDIT";
            btnEditProfile.Text            = Localization.GetString("EditProfile",
                                                                    LocalResourceFile);
            UserPropertyComponent userProperty = new UserPropertyComponent(userId);
            UserInfo myDnnUser = currentUser;
            myDnnUser.Profile.InitialiseProfile(myDnnUser.PortalID);
            SaveProfile(myDnnUser);
            UserController.UpdateUser(myDnnUser.PortalID, myDnnUser);
            var sw = SaveProfile(userProperty.UserProperty);
            CountryStateCityViewMode.SelectedAddress    = CountryStateCityEditMode.SelectedAddress;
            CountryStateCityViewMode.SelectedCity       = CountryStateCityEditMode.SelectedCity;
            CountryStateCityViewMode.SelectedState      = CountryStateCityEditMode.SelectedState;
            CountryStateCityViewMode.SelectedCountry    = CountryStateCityEditMode.SelectedCountry;
            CountryStateCityViewMode.SelectedPostalCode = CountryStateCityEditMode.SelectedPostalCode;
            CountryStateCityViewMode.SelectedLongitude  = CountryStateCityEditMode.SelectedLongitude;
            CountryStateCityViewMode.SelectedLatitude   = CountryStateCityEditMode.SelectedLatitude;
            CountryStateCityViewMode.UpdateMap();
            if (sw >= 0)
            {
                userProperty.Save();
            }
            else
            {
                return;
            }
            SaveChkControl("Theme", chkTheme);
            SaveChkControl("Beneficiaries", chkBeneficiaries);
            SaveChkControl("Sector", chkSector);

            if (!myDnnUser.IsInRole("Registered Users"))
            {
                var oDnnRoleController = new RoleController();

                RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "Registered Users");
                oDnnRoleController.AddUserRole(this.PortalId, myDnnUser.UserID, oCurrentRole.RoleID,
                                               System.DateTime.Now.AddDays(-1),
                                               DotNetNuke.Common.Utilities.Null.NullDate);
            }

            PopulateControls();
            setControl("VIEW");
        }
    }
Beispiel #16
0
        private void OnLoginClick(object sender, EventArgs e)
        {
            //It validates whether the user will be reset your password.
            var listUser = Membership.GetAllUsers().Cast <MembershipUser>().Where(x => x.Email.ToLower().Trim() == txtUsername.Text.ToLower().Trim() && x.Comment == "ChangePassword").FirstOrDefault();

            if (listUser != null)
            {
                // Gets user information
                _user = UserController.GetUserByEmail(PortalSettings.PortalId, txtUsername.Text.Trim());

                // Validates if the user is not removed from the system
                if (!_user.IsDeleted)
                {
                    //Web config parameters are validated and the password reset token
                    if (MembershipProviderConfig.PasswordRetrievalEnabled || MembershipProviderConfig.PasswordResetEnabled)
                    {
                        UserController.ResetPasswordToken(_user);
                    }

                    //The email is sent to the user and the Comment field is updated in the table asp [ aspnet_Membership ]
                    Mail.SendMail(_user, MessageType.PasswordReminder, PortalSettings);
                    listUser.Comment = string.Empty;
                    Membership.UpdateUser(listUser);
                    Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("RessetSecurityPassword"));
                }
            }
            else
            {
                if ((UseCaptcha && ctlCaptcha.IsValid) || !UseCaptcha)
                {
                    var    loginStatus = UserLoginStatus.LOGIN_FAILURE;
                    string userName    = new PortalSecurity().InputFilter(txtUsername.Text,
                                                                          PortalSecurity.FilterFlag.NoScripting |
                                                                          PortalSecurity.FilterFlag.NoAngleBrackets |
                                                                          PortalSecurity.FilterFlag.NoMarkup);

                    //DNN-6093
                    //check if we use email address here rather than username
                    if (PortalController.GetPortalSettingAsBoolean("Registration_UseEmailAsUserName", PortalId, false))
                    {
                        var testUser = UserController.GetUserByEmail(PortalId, userName); // one additonal call to db to see if an account with that email actually exists
                        if (testUser != null)
                        {
                            userName = testUser.Username; //we need the username of the account in order to authenticate in the next step
                        }
                    }

                    var objUser       = UserController.ValidateUser(PortalId, userName, txtPassword.Text, "DNN", string.Empty, PortalSettings.PortalName, IPAddress, ref loginStatus);
                    var authenticated = Null.NullBoolean;
                    var message       = Null.NullString;
                    if (loginStatus == UserLoginStatus.LOGIN_USERNOTAPPROVED)
                    {
                        message = "UserNotAuthorized";
                    }
                    else
                    {
                        authenticated = (loginStatus != UserLoginStatus.LOGIN_FAILURE);
                    }

                    if (loginStatus != UserLoginStatus.LOGIN_FAILURE && PortalController.GetPortalSettingAsBoolean("Registration_UseEmailAsUserName", PortalId, false))
                    {
                        //make sure internal username matches current e-mail address
                        if (objUser.Username.ToLower() != objUser.Email.ToLower())
                        {
                            UserController.ChangeUsername(objUser.UserID, objUser.Email);
                        }

                        Response.Cookies.Remove("USERNAME_CHANGED");
                    }

                    //Raise UserAuthenticated Event
                    var eventArgs = new UserAuthenticatedEventArgs(objUser, userName, loginStatus, "DNN")
                    {
                        Authenticated = authenticated,
                        Message       = message,
                        RememberMe    = chkCookie.Checked
                    };
                    OnUserAuthenticated(eventArgs);
                }
            }
        }
Beispiel #17
0
    /// <summary>
    /// Load information to the grid. This method allows you to filter and sort the grid by various parameters (fisrtname, email, permissions, todate, fromdate).
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem edititem = (GridEditFormItem)e.Item;

            RadComboBox rdEmail = (RadComboBox)edititem.FindControl("rdEmail");

            MIFNEXSOEntities nx = new MIFNEXSOEntities();

            rdEmail.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            rdEmail.DataSource   = nx.UserProperties.ToList();
            rdEmail.DataBind();


            RadComboBox rdPermisionLevel = (RadComboBox)edititem.FindControl("rdPermisionLevel");
            var         list             = ListComponent.GetListPerCategory("PermisionLevel", Thread.CurrentThread.CurrentCulture.Name).ToList();
            rdPermisionLevel.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            rdPermisionLevel.DataSource   = list;
            rdPermisionLevel.DataBind();


            CheckBoxList cblSolutions = (CheckBoxList)edititem.FindControl("cblSolutions");

            var            listSolutionsAux = SolutionComponent.GetPublishSolutionPerChallenge(challenge).Where(x => x.Deleted == false || x.Deleted == null).OrderBy(x => x.Title);
            List <Generic> listGeneric      = new List <Generic>();

            int count = 1;
            foreach (var item in listSolutionsAux)
            {
                var text = "<span style=\"margin-right:1em;\"><b>" + count.ToString() + ".</b></span><a href='" + NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + item.SolutionId + "' Target=\"_blank\" style=\"color:#3786bd;\">" + item.Title + "<a> - " + item.Language;


                listGeneric.Add(new Generic {
                    Id = item.SolutionId, Text = text
                });
                count++;
            }

            cblSolutions.DataSource = listGeneric;
            cblSolutions.DataBind();


            if (!(e.Item is GridEditFormInsertItem))
            {
                try
                {
                    int UserId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "UserId"));

                    var userProfile = new UserPropertyComponent(UserId);

                    string challengeJudgeId = DataBinder.Eval(e.Item.DataItem, "ChallengeJudgeId").ToString();
                    challengeJudgeComponent = new ChallengeJudgeComponent(new Guid(challengeJudgeId));

                    TextBox txtEmail = (TextBox)edititem.FindControl("txtEmail");
                    txtEmail.Text    = userProfile.UserProperty.email;
                    txtEmail.Enabled = false;
                    txtEmail.Visible = true;
                    rdEmail.Visible  = false;
                    RequiredFieldValidator rfvrdEmail = (RequiredFieldValidator)edititem.FindControl("rfvrdEmail");
                    rfvrdEmail.Visible         = false;
                    rfvrdEmail.ValidationGroup = string.Empty;
                    var itemm = (RadComboBoxItem)rdPermisionLevel.Items.FindItemByValue(challengeJudgeComponent.ChallengeJudge.PermisionLevel);
                    if (itemm != null)
                    {
                        itemm.Selected = true;
                        itemm.Checked  = true;
                    }



                    var itemmaux = (RadComboBoxItem)rdEmail.Items.FindItemByValue(userProfile.UserProperty.UserId.ToString());
                    if (itemmaux != null)
                    {
                        itemmaux.Selected = true;
                        itemmaux.Checked  = true;
                    }


                    RadDatePicker dtFromDate = (RadDatePicker)edititem.FindControl("dtFromDate");
                    dtFromDate.SelectedDate = Convert.ToDateTime(challengeJudgeComponent.ChallengeJudge.FromDate);

                    RadDatePicker dtToDate = (RadDatePicker)edititem.FindControl("dtToDate");
                    dtToDate.SelectedDate = Convert.ToDateTime(challengeJudgeComponent.ChallengeJudge.ToDate);


                    var listJudgesAssignations = challengeJudgeComponent.ChallengeJudge.JudgesAssignations.ToList();



                    SetChkControl(listJudgesAssignations, cblSolutions);
                }
                catch
                {
                }
            }
        }
    }
Beispiel #18
0
 public void redirect()
 {
     Session.Timeout = 600; //10hr
     Response.Redirect(NexsoHelper.GetCulturedUrlByTabName("Home"), true);
 }
Beispiel #19
0
    //Gets each POI and make the format required by the map.
    public string GetAllLocations()
    {
        StringBuilder retstrmarks       = new StringBuilder();
        string        initialCharacter  = string.Empty;
        Organization  lastMapNxPoiMap   = null;
        string        lastHTMLInfo      = string.Empty;
        var           organizationQuery = (from org in entityCommentComponent.Organization
                                           orderby org.Latitude, org.Longitude
                                           where org.Latitude != null && org.Longitude != null && org.Latitude != 0 && org.Longitude != 0
                                           select org
                                           ).OrderBy(o => o.Latitude).ToList();

        foreach (var item in organizationQuery)
        {
            string curHTMLInfo = string.Empty;//Contains the HTML for detail solutions

            StringBuilder html = new StringBuilder("");

            var listSolution = item.Solutions.Where(n => n.SolutionState >= 1000 && (n.Deleted == false || n.Deleted == null)).ToList();

            if (listSolution.Count > 0)
            {
                html.Append("<a href=\"" + NexsoHelper.GetCulturedUrlByTabName("insprofile") + "/in/" +
                            item.OrganizationID + "\"><h3 class='gg'>" + ReplaceChars(ReplaceChars(item.Name)) + "</h3></a>");

                html.Append("<ul class=\"title-map\">");

                foreach (var item2 in listSolution)
                {
                    html.Append("<li  class=\"item-map\"><a href=\"" +
                                NexsoHelper.GetCulturedUrlByTabName("solprofile") +
                                "/sl/" + item2.SolutionId.ToString() + "\">" + ReplaceChars(item2.Title) + "</a></li>");
                }

                html.Append("</ul>");


                curHTMLInfo = html.ToString();

                if (lastMapNxPoiMap != null)
                {
                    if (retstrmarks.ToString().Length == 0)
                    {
                        initialCharacter = "{";
                    }
                    else
                    {
                        initialCharacter = ",{";
                    }
                    //If there are organizations in the same geographic point.
                    if (lastMapNxPoiMap.Latitude.Equals(item.Latitude) &&
                        lastMapNxPoiMap.Longitude.Equals(item.Longitude))
                    {
                        lastMapNxPoiMap.Code = string.Format("{0} - {1}", lastMapNxPoiMap.Code, item.Code);
                        lastHTMLInfo         = string.Format("{0}{1}", lastHTMLInfo, curHTMLInfo);
                        lastMapNxPoiMap.Name = string.Format("{0} - {1}", lastMapNxPoiMap.Name, ReplaceChars(item.Name));
                    }
                    else
                    {
                        //Get the marks for a Organization object in JSON format.
                        string strMarkData = GetMarkData(lastMapNxPoiMap, lastHTMLInfo, initialCharacter);
                        retstrmarks.Append(strMarkData);
                        lastMapNxPoiMap = item;
                        lastHTMLInfo    = curHTMLInfo;
                    }
                }
                else
                {
                    lastMapNxPoiMap = item;
                    lastHTMLInfo    = curHTMLInfo;
                }
            }
        }

        //Set last POI
        if (lastMapNxPoiMap != null)
        {
            if (retstrmarks.ToString().Length == 0)
            {
                initialCharacter = "{";
            }
            else
            {
                initialCharacter = ",{";
            }
            //Get the marks for a Organization object in JSON format.
            string marks = GetMarkData(lastMapNxPoiMap, lastHTMLInfo, initialCharacter);

            retstrmarks.Append(marks);
        }

        //Complete list of objects in JSON format
        string retstrAllObject = string.Format("{0}{2}{1}", "[", "];", retstrmarks.ToString());


        return(retstrAllObject);
    }
Beispiel #20
0
    /// <summary>
    /// Registers the client script with the Page object using a key and a URL, which enables the script to be called from the client.
    /// </summary>
    private void RegisterScripts()
    {
        if (!IsPostBack)
        {
            string OrganizationName = string.Empty;
            string ProfileOrg       = string.Empty;
            if (Organization != null)
            {
                ProfileOrg       = NexsoHelper.GetCulturedUrlByTabName("insprofile") + "/in/" + Organization.OrganizationID;
                OrganizationName = Organization.Name;
            }

            Page.ClientScript.RegisterClientScriptInclude(
                this.GetType(), "countryStateCity", ControlPath + "resources/js/countryStateCity.js");

            if (address.Value != string.Empty)
            {
                if (string.IsNullOrEmpty(ValidateSecurity.ValidateString(address.Value, false)))
                {
                    lblMessage.ErrorMessage = Localization.GetString("InvalidFormat", LocalResourceFile);
                    lblMessage.IsValid      = false;
                    return;
                }
            }
            string script = "<script>" +

                            "var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/organizationbldg.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var iconGenTestLocation" + this.ClientID + "='" + String.Format("{0}Images/testlocationcrc.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var profileOrg" + this.ClientID + "='" + ProfileOrg.ToString().ToLower() + "';"
                            +
                            "var orgName" + this.ClientID + "='" + OrganizationName.ToLower() + "';"
                            +
                            "var iconGenIni" + this.ClientID + "='" + String.Format("{0}Images/marker-yellow.png", PortalSettings.HomeDirectory) + "';"
                            +
                            //"var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/marker-blue.png", PortalSettings.HomeDirectory) + "';"
                            //+
                            "var multiSelectIni" + this.ClientID + "=" + MultiSelect.ToString().ToLower() + ";"
                            +
                            "var addressRequiredIni" + this.ClientID + "=" + AddressRequired.ToString().ToLower() + ";"

                            +
                            "var viewInEditModeIni" + this.ClientID + "=" + ViewInEditMode.ToString().ToLower() + ";"
                            +
                            "var addressPlaceHolderIni" + this.ClientID + "='" + GetLabelAddresPlaceHolder() + "';"
                            +
                            "var cscPlaceHolderIni" + this.ClientID + "='" + GetLabelCityStateCountryPlaceHolder() + "';"
                            +
                            "function load" + ClientID + "(){initializemap(document.getElementById('map_canvas" +
                            ClientID + "'), document.getElementById('" + pac_input.ClientID +
                            "'), document.getElementById('" + address.ClientID +
                            "'),document.getElementById('btnGeocode" + ClientID + "'),document.getElementById('" +
                            hdVal1.ClientID + "'),'" + this.ClientID + "');}" +

                            "$(document).ready(function () {Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(load" +
                            ClientID + ");Sys.WebForms.PageRequestManager.getInstance().add_endRequest(load" + ClientID +
                            ");});" +


                            "</script>";


            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script" + ClientID, script);
            rfvAddress.Visible = LocationRequired;
        }
    }
Beispiel #21
0
    /// <summary>
    /// Send message to the other user
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSendMessage_Click(object sender, EventArgs e)
    {
        try
        {
            Button button     = (Button)sender;
            var    txtMessage = (TextBox)button.Parent.FindControl("txtMessage");
            if (!string.IsNullOrEmpty(txtMessage.Text))
            {
                var              ToUserId         = button.CommandArgument;
                Repeater         rpMessages       = (Repeater)button.Parent.FindControl("rpMessages");
                MessageComponent messageComponent = new MessageComponent();
                // verify that the message doesn't have script and styles
                messageComponent.Message.Message1    = ValidateSecurity.ValidateString(txtMessage.Text, false);
                messageComponent.Message.DateCreated = DateTime.Now;
                messageComponent.Message.FromUserId  = UserInfo.UserID;
                messageComponent.Message.ToUserId    = Convert.ToInt32(ValidateSecurity.ValidateString(ToUserId, false));

                //Save message in the database
                if (messageComponent.Save() > -1)
                {
                    var list = FillMessages(GetListMessagesForUser(Convert.ToInt32(ValidateSecurity.ValidateString(ToUserId, false))));
                    rpMessages.DataSource = list;
                    rpMessages.DataBind();
                    txtMessage.Text = string.Empty;
                    UserPropertyComponent userPropertyComponent = new UserPropertyComponent(Convert.ToInt32(ToUserId));
                    UserInfo userTo = UserController.GetUserById(PortalId, userPropertyComponent.UserProperty.UserId);
                    UserPropertyComponent userProperty = new UserPropertyComponent(UserInfo.UserID);

                    //Send message
                    try
                    {
                        CultureInfo language = new CultureInfo(getUserLanguage(userPropertyComponent.UserProperty.Language.GetValueOrDefault(1)));
                        DotNetNuke.Services.Mail.Mail.SendEmail("*****@*****.**",
                                                                userTo.Email,
                                                                string.Format(
                                                                    Localization.GetString("MessageTitle", LocalResourceFile, language.Name),
                                                                    userProperty.UserProperty.FirstName + " " + userProperty.UserProperty.LastName
                                                                    ),

                                                                Localization.GetString("MessageBody", LocalResourceFile, language.Name).Replace("{MESSAGE:Body}",
                                                                                                                                                messageComponent.Message.Message1).Replace("{MESSAGE:ViewLink}",
                                                                                                                                                                                           NexsoHelper.GetCulturedUrlByTabName("MyMessages"))
                                                                );
                    }
                    catch (Exception ex)
                    {
                        Exceptions.ProcessModuleLoadException(this, ex);
                    }
                }
            }
        }
        catch (Exception exc)
        {
            Exceptions.
            ProcessModuleLoadException(
                this, exc);
        }
    }
Beispiel #22
0
    /// <summary>
    /// GetSolutions per judge
    /// </summary>
    /// <param name="list"></param>
    /// <returns></returns>
    private string GetAssignedSolutions(List <JudgesAssignation> list)
    {
        string txt = string.Empty;

        var listSolutionsAux = SolutionComponent.GetPublishSolutionPerChallenge(challenge).Where(x => x.Deleted == false || x.Deleted == null).OrderBy(x => x.Title).ToList();

        int count = 1;

        foreach (var item in listSolutionsAux)
        {
            var existItem = list.Exists(x => x.SolutionId == item.SolutionId);
            if (existItem)
            {
                txt = txt + "<span style=\"margin-right:1em;\"><b>" + count.ToString() + ".</b></span><a href='" + NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + item.SolutionId + "' Target=\"_blank\" style=\"color:#3786bd;\">" + item.Title + "<a> - " + item.Language + " - " + NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + item.SolutionId + "<br/>";
            }

            count++;
        }

        return(txt);
    }