Exemplo n.º 1
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            var property           = context.DataContext.GetProperties()[Salesforce_Marketing_Cloud_Scope.SalesForcePropertyTag];
            var salesForceProperty = property.GetValue(context.DataContext) as SalesForceProperty;

            String id = CampaignID.Get(context);

            var task = (new CmdRestAPI(salesForceProperty.AuthToken, salesForceProperty.ServiceURL, salesForceProperty.SoapClient, null, "campaigns", id, "", Type_of_Command.DeleteCampaign)).ExecuteAsync();
            var tcs  = new TaskCompletionSource <CmdRestAPI>(state);

            task.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    tcs.TrySetException(t.Exception.InnerExceptions);
                }
                else if (t.IsCanceled)
                {
                    tcs.TrySetCanceled();
                }
                else
                {
                    tcs.TrySetResult(t.Result);
                }
                if (callback != null)
                {
                    callback(tcs.Task);
                }
            });

            return(tcs.Task);
        }
Exemplo n.º 2
0
        protected override CmdRestAPI EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
        {
            CmdRestAPI temp = ((Task <CmdRestAPI>)result).Result;

            Response.Set(context, temp.Response);
            CampaignID.Set(context, temp.ID);
            ValidConnection.Set(context, temp.ValidConnection);
            return(temp);
        }
Exemplo n.º 3
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            var property           = context.DataContext.GetProperties()[Salesforce_Marketing_Cloud_Scope.SalesForcePropertyTag];
            var salesForceProperty = property.GetValue(context.DataContext) as SalesForceProperty;

            String id = CampaignID.Get(context);

            var newDataTable = new System.Data.DataTable();

            newDataTable.TableName = "TableName";
            newDataTable.Columns.Add(new DataColumn("Parameter", typeof(string))
            {
                MaxLength = 200
            });
            newDataTable.Columns.Add(new DataColumn("Value", typeof(string))
            {
                MaxLength = 60000
            });
            newDataTable.Columns.Add(new DataColumn("isEnabled", typeof(Boolean))
            {
                DefaultValue = true
            });
            foreach (ParametersArgument item in Parameters)
            {
                var row = newDataTable.NewRow();
                row["Parameter"] = item.Parameter.Get(context);
                row["Value"]     = item.ValueData.Get(context);
                newDataTable.Rows.Add(row);
            }

            var task = (new CmdRestAPI(salesForceProperty.AuthToken, salesForceProperty.ServiceURL, salesForceProperty.SoapClient, newDataTable, "campaigns", id, "", cmdTYPE)).ExecuteAsync();
            var tcs  = new TaskCompletionSource <CmdRestAPI>(state);

            task.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    tcs.TrySetException(t.Exception.InnerExceptions);
                }
                else if (t.IsCanceled)
                {
                    tcs.TrySetCanceled();
                }
                else
                {
                    tcs.TrySetResult(t.Result);
                }
                if (callback != null)
                {
                    callback(tcs.Task);
                }
            });

            return(tcs.Task);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string encCampaignID = String.Empty;

            string href;

            if (!String.IsNullOrEmpty(CampaignName) && Page.RouteData.Values["camp"] != null)
            {
                if (Page.RouteData.Values["cat"] != null)
                {
                    encCampaignID  = Page.RouteData.Values["camp"].ToString();
                    href           = "/campaign/" + encCampaignID + "/";
                    aCampaign.HRef = href;
                    setCategoryAndParent(href);
                }
                else
                {
                    this.Visible = false;
                }
            }

            if (ProductID != 0)
            {
                encCampaignID  = Encryption.Encrypt(CampaignID.ToString());
                href           = "/campaign/" + encCampaignID + "/";
                aCampaign.HRef = href;
                setCategoryAndParent(href);
                if (Page.RouteData.Values["prod"] != null)
                {
                    aProduct.HRef                     = "";
                    aProduct.Disabled                 = true;
                    aProduct.Style["color"]           = "grey";
                    aProduct.Style["text-decoration"] = "none";
                }
                sep3.Visible = true;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Saves an Event. If the record status == Delete, then the record is deleted.
        /// </summary>
        /// <param name="sUserUpdating">User name of who is doing it.</param>
        /// <returns></returns>
        public int Save(string sUserUpdating)
        {
            if (RecStatus == RecordStatuses.Delete)
            {
                SortedList Params = new SortedList();
                Params.Add("@UserID", "1");
                Params.Add("@RecordID", EventID.ToString());

                cUtilities.PerformNonQuery("uspDelCMEvents", Params, "LARPortal", sUserUpdating);
            }
            else
            {
                SortedList Params = new SortedList();
                Params.Add("@UserID", "1");
                Params.Add("@EventID", EventID.ToString());
                Params.Add("@CampaignID", CampaignID.ToString());
                if (EventName != null)
                {
                    Params.Add("@EventName", EventName);
                }
                if (IGEventLocation != null)
                {
                    Params.Add("@IGEventLocation", IGEventLocation);
                }
                if (DecisionByDate.HasValue)
                {
                    Params.Add("@DecisionByDate", DecisionByDate.ToString());
                }
                if (NotificationDate.HasValue)
                {
                    Params.Add("@NotificationDate", NotificationDate.Value.ToShortDateString());
                }
                if (SharePlanningInfo.HasValue)
                {
                    Params.Add("@SharePlanningInfo", SharePlanningInfo.ToString());
                }
                if (StatusID.HasValue)
                {
                    Params.Add("@StatusID", StatusID.ToString());
                }
                if (EventDescription != null)
                {
                    Params.Add("@EventDescription", EventDescription);
                }
                if (StartDateTime.HasValue)
                {
                    Params.Add("@StartDate", StartDateTime.Value.ToShortDateString());
                    Params.Add("@StartTime", StartDateTime.Value.ToShortTimeString());
                }
                if (EndDateTime.HasValue)
                {
                    Params.Add("@EndDate", EndDateTime.Value.ToShortDateString());
                    Params.Add("@EndTime", EndDateTime.Value.ToShortTimeString());
                }
                Params.Add("@SiteID", SiteID.ToString());
                if (MaximumPCCount.HasValue)
                {
                    Params.Add("@MaximumPCCount", MaximumPCCount.ToString());
                }
                if (BaseNPCCount.HasValue)
                {
                    Params.Add("@BaseNPCCount", BaseNPCCount.ToString());
                }
                if (NPCOverrideRatio.HasValue)
                {
                    Params.Add("@NPCOverrideRatio", NPCOverrideRatio.ToString());
                }
                if (CapThresholdNotification.HasValue)
                {
                    Params.Add("@CapThresholdNotification", CapThresholdNotification.ToString());
                }
                if (CapMetNotification.HasValue)
                {
                    Params.Add("@CapMetNotification", CapMetNotification.ToString());
                }
                if (MaximumPCCount.HasValue)
                {
                    Params.Add("@MaximumNPCCount", MaximumNPCCount.ToString());
                }
                if (AutoApproveWaitListOpenings.HasValue)
                {
                    Params.Add("@AutoApproveWaitListOpenings", AutoApproveWaitListOpenings.ToString());
                }
                if (RegistrationOpenDateTime.HasValue)
                {
                    Params.Add("@RegistrationOpenDate", RegistrationOpenDateTime.Value.ToShortDateString());
                    Params.Add("@RegistrationOpenTime", RegistrationOpenDateTime.Value.ToShortTimeString());
                }
                if (PreregistrationDeadline.HasValue)
                {
                    Params.Add("@PreregistrationDeadline", PreregistrationDeadline.Value.ToShortDateString());
                }
                if (PreregistrationPrice.HasValue)
                {
                    Params.Add("@PreregistrationPrice", PreregistrationPrice.ToString());
                }
                if (LateRegistrationPrice.HasValue)
                {
                    Params.Add("@LateRegistrationPrice", LateRegistrationPrice.ToString());
                }
                if (CheckinPrice.HasValue)
                {
                    Params.Add("@CheckinPrice", CheckinPrice.ToString());
                }
                if (DaysToAutoCancelOtherPlayerRegistration.HasValue)
                {
                    Params.Add("@DaysToAutoCancelOtherPlayerRegistration", DaysToAutoCancelOtherPlayerRegistration.ToString());
                }
                if (PCFoodService.HasValue)
                {
                    Params.Add("@PCFoodService", PCFoodService.ToString());
                }
                if (NPCFoodService.HasValue)
                {
                    Params.Add("@NPCFoodService", NPCFoodService.ToString());
                }
                if (CookingFacilitiesAvailable.HasValue)
                {
                    Params.Add("@CookingFacilitiesAvailable", CookingFacilitiesAvailable.ToString());
                }
                if (RefrigeratorAvailable.HasValue)
                {
                    Params.Add("@RefrigeratorAvailable", RefrigeratorAvailable.ToString());
                }
                if (PELDeadlineDate.HasValue)
                {
                    Params.Add("@PELDeadlineDate", PELDeadlineDate.Value.ToShortDateString());
                }
                if (InfoSkillDeadlineDate.HasValue)
                {
                    Params.Add("@InfoSkillDeadlineDate", InfoSkillDeadlineDate.Value.ToShortDateString());
                }
                if (Comments != null)
                {
                    Params.Add("@Comments", Comments);
                }

                DataTable UpdateResults = cUtilities.LoadDataTable("uspInsUpdCMEvents", Params, "LARPortal", sUserUpdating, "cEvent.Save");
                if (UpdateResults.Rows.Count > 0)
                {
                    int iEventID;
                    if (int.TryParse(UpdateResults.Rows[0]["EventID"].ToString(), out iEventID))
                    {
                        EventID = iEventID;
                    }
                }
            }

            return(0);
        }
Exemplo n.º 6
0
        protected void ddlCampaigns_SelectedIndexChanged(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (ddlCampaigns.SelectedValue == "-1")
            {
                Response.Redirect("~/Campaigns/JoinACampaign.aspx");
            }

            //			Classes.LogWriter oLogWriter = new Classes.LogWriter();

            // If the campaign ID has changed...
            if (CampaignID.ToString() != ddlCampaigns.SelectedValue)
            {
                //				oLogWriter.AddLogMessage("Starting to change campaign from " + CampaignID.ToString() + " to " + ddlCampaigns.SelectedValue, "Master.ddlCampaigns_SelectedIndexChanged", "", Session.SessionID);
                int iCampaignID;
                if (int.TryParse(ddlCampaigns.SelectedValue, out iCampaignID))
                {
                    Session["CampaignID"]   = iCampaignID;
                    Session["CampaignName"] = ddlCampaigns.SelectedItem.Text;

                    //					oLogWriter.AddLogMessage("New campaign will be " + iCampaignID.ToString(), "Master.ddlCampaigns_SelectedIndexChanged", "", Session.SessionID);

                    if (iCampaignID > 0)
                    {
                        // Since the campaign has changed, need to save the last campaign to the database.

                        Classes.cUser      UserInfo  = new Classes.cUser(UserName, "NOPASSWORD", Session.SessionID);
                        Classes.cUtilities utilities = new Classes.cUtilities();
                        SortedList         sParams   = new SortedList();
                        sParams.Add("@intUserId", UserID);
                        DataTable dtCharList = Classes.cUtilities.LoadDataTable("uspGetCharacterIDsByUserID", sParams, "LARPortal", UserName, lsRoutineName + ".GetCharList");
                        DataView  dvCampChar = new DataView(dtCharList, "CampaignID = " + iCampaignID.ToString(), "CharacterAKA", DataViewRowState.CurrentRows);
                        if (dvCampChar.Count > 0)
                        {
                            int iTemp;
                            if (int.TryParse(dvCampChar[0]["CharacterID"].ToString(), out iTemp))
                            {
                                UserInfo.LastLoggedInCharacter    = iTemp;
                                UserInfo.LastLoggedInMyCharOrCamp = "M";
                            }
                        }
                        else
                        {
                            UserInfo.LastLoggedInCharacter = -1;
                        }
                        UserInfo.LastLoggedInCampaign = iCampaignID;
                        UserInfo.Save();

                        Classes.cCampaignBase Campaign = new Classes.cCampaignBase(iCampaignID, UserName, UserID);



                        //oLogWriter.AddLogMessage("UserInfo was saved." + UserInfo.LastLoggedInCampaign.ToString(), "Master.ddlCampaigns_SelectedIndexChanged", "", Session.SessionID);
                        //Classes.cUser NewUserInfo = new Classes.cUser(UserName, "NOPASSWORD", Session.SessionID);
                        //oLogWriter.AddLogMessage("CampaignID after update was " + NewUserInfo.LastLoggedInCampaign.ToString(), "Master.ddlCampaigns_SelectedIndexChanged", "", Session.SessionID);

                        // Now that we have saved the campaign ID to the database, clear the session variables so it will force a reload.
                        Session.Remove("CampaignID");
                        Session.Remove("CampaignName");
                        Session.Remove("CampaignList");
                        Session.Remove("RoleString");

                        LoadData();

                        if (CampaignChanged != null)
                        {
                            CampaignChanged(this, EventArgs.Empty);
                        }
                    }
                    //					oLogWriter.AddLogMessage("Done with adding." + CampaignID.ToString(), "Master.ddlCampaigns_SelectedIndexChanged", "", Session.SessionID);
                }
            }
        }
Exemplo n.º 7
0
        /// <inheritdoc />
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(AccountID))
            {
                throw new MissingRequiredAttribute("AccountID", AccountID);
            }

            writer.AddAttribute("uacct", AccountID);
            if (!string.IsNullOrEmpty(PageName))
            {
                writer.AddAttribute("page", PageName, true);
            }
            if (!ClientInfoEnabled)
            {
                writer.AddAttribute("ufsc", FbmlConstants.ZERO);
            }
            if (_udn != GoogleAnalyticsDomainCookieType.Auto)
            {
                writer.AddAttribute("udn", DomainCookie.ToString().ToLowerInvariant());
            }
            if (!UniqueDomainHashEnabled)
            {
                writer.AddAttribute("uhash", FbmlConstants.OFF);
            }
            if (InactiveSessionTimeout != 1800)
            {
                writer.AddAttribute("utimeout", _utimeout.ToString(CultureInfo.InvariantCulture));
            }
            if (!string.Equals(TrackerImagePath, "/__utm.gif", StringComparison.Ordinal))
            {
                writer.AddAttribute("ugifpath", TrackerImagePath, true);
            }
            if (!string.Equals(TransactionFieldSeparator, "|", StringComparison.Ordinal))
            {
                writer.AddAttribute("utsp", TransactionFieldSeparator, true);
            }
            if (!FlashDetectionEnabled)
            {
                writer.AddAttribute("uflash", FbmlConstants.ZERO);
            }
            if (!TitleDetectionEnabled)
            {
                writer.AddAttribute("utitle", FbmlConstants.ZERO);
            }
            if (LinkerEnabled)
            {
                writer.AddAttribute("ulink", FbmlConstants.ONE);
            }
            if (CampaignAnchorsEnabled)
            {
                writer.AddAttribute("uanchor", FbmlConstants.ONE);
            }
            if (!string.Equals(TrackingCookiePath, "/", StringComparison.Ordinal))
            {
                writer.AddAttribute("utcp", TrackingCookiePath, true);
            }
            if (SamplePercentageTracked != 100)
            {
                writer.AddAttribute("usample", SamplePercentageTracked.ToString(CultureInfo.InvariantCulture));
            }
            if (!CampaignTrackingEnabled)
            {
                writer.AddAttribute("uctm", FbmlConstants.ZERO);
            }
            if (_ucto != 15768000)
            {
                writer.AddAttribute("ucto", _ucto.ToString(CultureInfo.InvariantCulture));
            }
            if (!string.IsNullOrEmpty(CampaignName))
            {
                writer.AddAttribute("uccn", CampaignName, true);
            }
            if (_ucmd != GoogleAnalyticsCampaignMedium.Default)
            {
                writer.AddAttribute("ucmd", _ucmd.ToString().ToLowerInvariant());
            }
            if (!string.IsNullOrEmpty(CampaignSource))
            {
                writer.AddAttribute("ucsr", CampaignSource, true);
            }
            if (!string.IsNullOrEmpty(CampaignKeyword))
            {
                writer.AddAttribute("uctr", CampaignKeyword, true);
            }
            if (!string.IsNullOrEmpty(CampaignContent))
            {
                writer.AddAttribute("ucct", CampaignContent, true);
            }
            if (CampaignID != 0)
            {
                writer.AddAttribute("ucid", CampaignID.ToString(CultureInfo.InvariantCulture));
            }
            if (OverrideCampaign)
            {
                writer.AddAttribute("ucno", "ut_override");
            }

            base.AddAttributesToRender(writer);
        }