Пример #1
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(this.ActivityID);

        if (ai == null)
        {
            return;
        }

        string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);

        try
        {
            ucDetails = this.Page.LoadControl(pathToControl) as ActivityDetail;
            bool dataLoaded = ucDetails.LoadData(ai);
            pnlDetails.GroupingText = GetString("om.activity.details.groupdetails");
            pnlDetails.Controls.Add(ucDetails);
            ucDetails.Visible  = dataLoaded;
            pnlDetails.Visible = dataLoaded;
        }
        catch (HttpException)
        {
            // Failed to load the control
        }
    }
Пример #2
0
    private void btnSave_Click(object sender, EventArgs e)
    {
        if (userIsAuthorized && (activityId > 0))
        {
            ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(activityId);
            EditedObject = ai;
            ai.ActivityComment = txtComment.Value;
            ai.ActivityTitle = TextHelper.LimitLength(txtTitle.Text, 250, String.Empty);
            ai.ActivityURLReferrer = txtURLRef.Text;
            ai.ActivityURL = txtURL.Text;

            // Get changed columns
            List<string> changes = ai.ChangedColumns();

            // Save activity info
            ActivityInfoProvider.SetActivityInfo(ai);
            
            if ((changes != null) && (changes.Count > 0))
            {
                // Get IDs of scores where activity's contact exceeded score limit
                DataSet limitScores = ScoreInfoProvider.GetScoresWhereContactExceededLimit(ai.ActivityActiveContactID);

                // Recalculate scoring groups
                ScoreInfoProvider.RecalculateScores(ai.ActivityType, RuleTypeEnum.Activity, ai.ActivityActiveContactID, ai.ActivitySiteID);

                // Check if contact gained enough points and alternatively send notification e-mail
                ScoreInfoProvider.CheckScoringLimits(ContactInfoProvider.GetContactInfo(ai.ActivityActiveContactID), limitScores);
            }


            // Reload form (due to "view URL" button)
            LoadData();
        }
    }
Пример #3
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(ActivityID);

        if (ai == null)
        {
            return;
        }

        string         pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);
        ActivityDetail ucDetails     = null;

        try
        {
            ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail;
        }
        catch (HttpException exception)
        {
            // Ignore not existing control.
            // File.Exists cannot be used because user control is not available on filesystem for precompiled web application.
            if (exception.GetHttpCode() != (int)HttpStatusCode.NotFound)
            {
                throw;
            }
        }

        if (ucDetails != null && ucDetails.LoadData(ai))
        {
            pnlDetails.Controls.Add(ucDetails);
            return;
        }

        // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details.
        Visible = false;
    }
Пример #4
0
    void btnSave_Click(object sender, EventArgs e)
    {
        if (userIsAuthorized && (activityId > 0))
        {
            ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(activityId);
            EditedObject       = ai;
            ai.ActivityComment = txtComment.Value;
            ai.ActivityTitle   = TextHelper.LimitLength(txtTitle.Text, 250, String.Empty);
            ai.ActivityURL     = txtURL.Text;
            ActivityInfoProvider.SetActivityInfo(ai);

            // Reload form (due to "view URL" button)
            LoadData();
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!QueryHelper.ValidateHash("hash", "activityid") || Parameters == null)
        {
            return;
        }

        isSitemanager = ValidationHelper.GetBoolean(Parameters["issitemanager"], false);

        // Get activity ID from query string
        activityId = QueryHelper.GetInteger("activityid", 0);

        ActivityInfo activity = ActivityInfoProvider.GetActivityInfo(activityId);

        if (activity == null)
        {
            RedirectToInformation("editedobject.notexists");
        }

        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadActivities", SiteInfoProvider.GetSiteName(activity.ActivitySiteID)))
        {
            RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadActivities");
        }

        LoadData();

        // Enable text boxes and show save button if user is autorized to change activities
        userIsAuthorized = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ManageActivities", SiteInfoProvider.GetSiteName(activity.ActivitySiteID));
        if (userIsAuthorized)
        {
            Save                  += btnSave_Click;
            txtURL.ReadOnly        = false;
            txtTitle.ReadOnly      = false;
            txtURLRef.ReadOnly     = false;
            txtComment.Enabled     = true;
            btnStamp.Enabled       = true;
            btnStamp.OnClientClick = "AddStamp('" + txtComment.ClientID + "'); return false;";
        }

        // Disable collapse of toolbar (IE7 bug)
        txtComment.ToolbarCanCollapse = false;

        RegisterScripts();
    }
Пример #6
0
    private void btnSave_Click(object sender, EventArgs e)
    {
        if (userIsAuthorized && (activityId > 0))
        {
            ActivityInfo activity = ActivityInfoProvider.GetActivityInfo(activityId);
            EditedObject                 = activity;
            activity.ActivityComment     = txtComment.Value;
            activity.ActivityTitle       = TextHelper.LimitLength(txtTitle.Text, 250, String.Empty);
            activity.ActivityURLReferrer = txtURLRef.Text;
            activity.ActivityURL         = txtURL.Text;

            // Save activity info
            ActivityInfoProvider.SetActivityInfo(activity);

            // Reload form (due to "view URL" button)
            LoadData();

            ltlScript.Text = ScriptHelper.GetScript("CloseDialog();");
        }
    }
Пример #7
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(ActivityID);

        if (ai == null)
        {
            return;
        }

        string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);

        if (FileHelper.FileExists(pathToControl))
        {
            ActivityDetail ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail;
            if (ucDetails.LoadData(ai))
            {
                pnlDetails.Controls.Add(ucDetails);
                return;
            }
        }

        // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details.
        Visible = false;
    }
Пример #8
0
    /// <summary>
    /// Loads data of specific activity.
    /// </summary>
    protected void LoadData()
    {
        if (activityId <= 0)
        {
            return;
        }

        // Load and check if object exists
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(activityId);

        EditedObject = ai;

        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(ai.ActivityType);

        plcActivityValue.Visible = (ati == null) || ati.ActivityTypeIsCustom || (ati.ActivityTypeName == PredefinedActivityType.PAGE_VISIT) && !String.IsNullOrEmpty(ai.ActivityValue);

        string dispName = (ati != null ? ati.ActivityTypeDisplayName : GetString("general.na"));

        lblTypeVal.Text    = String.Format("{0}", HTMLHelper.HTMLEncode(dispName));
        lblContactVal.Text = HTMLHelper.HTMLEncode(ContactInfoProvider.GetContactFullName(ai.ActivityActiveContactID));

        // Init contact detail link
        string contactURL = UIContextHelper.GetElementDialogUrl(ModuleName.ONLINEMARKETING, "EditContact", ai.ActivityActiveContactID, "isSiteManager=" + ContactHelper.IsSiteManager);

        btnContact.Attributes.Add("onClick", ScriptHelper.GetModalDialogScript(contactURL, "ContactDetail"));
        btnContact.ToolTip = GetString("general.edit");

        lblDateVal.Text = (ai.ActivityCreated == DateTimeHelper.ZERO_TIME ? GetString("general.na") : HTMLHelper.HTMLEncode(ai.ActivityCreated.ToString()));

        // Get site display name
        string siteName = SiteInfoProvider.GetSiteName(ai.ActivitySiteID);

        if (String.IsNullOrEmpty(siteName))
        {
            siteName = GetString("general.na");
        }
        else
        {
            // Retrieve site info and its display name
            SiteInfo si = SiteInfoProvider.GetSiteInfo(siteName);
            if (si != null)
            {
                siteName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(si.DisplayName));
            }
            else
            {
                siteName = GetString("general.na");
            }
        }
        lblSiteVal.Text = siteName;

        string url = ai.ActivityURL;

        plcCampaign.Visible = !String.IsNullOrEmpty(ai.ActivityCampaign);
        lblCampaignVal.Text = HTMLHelper.HTMLEncode(ai.ActivityCampaign);
        lblValue.Text       = HTMLHelper.HTMLEncode(String.IsNullOrEmpty(ai.ActivityValue) ? GetString("general.na") : ai.ActivityValue);

        // Init textboxes only for the first time
        if (!RequestHelper.IsPostBack())
        {
            txtComment.Value = ai.ActivityComment;
            txtTitle.Text    = ai.ActivityTitle;
            txtURLRef.Text   = ai.ActivityURLReferrer;
            if (ai.ActivityType != PredefinedActivityType.NEWSLETTER_CLICKTHROUGH)
            {
                txtURL.Text = url;
            }
        }

        cDetails.ActivityID = activityId;

        // Init link button URL
        if (ai.ActivitySiteID > 0)
        {
            SiteInfo si = SiteInfoProvider.GetSiteInfo(ai.ActivitySiteID);
            if (si != null)
            {
                // Hide view button if URL is blank
                string activityUrl = ai.ActivityURL;
                if ((activityUrl != null) && !String.IsNullOrEmpty(activityUrl.Trim()))
                {
                    string appUrl = URLHelper.GetApplicationUrl(si.DomainName);
                    url                 = URLHelper.GetAbsoluteUrl(activityUrl, appUrl, appUrl, "");
                    url                 = URLHelper.AddParameterToUrl(url, URLHelper.SYSTEM_QUERY_PARAMETER, "1");
                    btnView.ToolTip     = GetString("general.view");
                    btnView.NavigateUrl = url;
                    btnView.Visible     = true;
                }
                else
                {
                    btnView.Visible = false;
                }
            }
        }
    }