コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnRefresh.Click += new EventHandler(btnRefresh_Click);
            Response.Cache.SetCacheability(HttpCacheability.Private);
            ActiveURL = ConfigurationSettings.AppSettings["ActiveURL"];

            if (Request["CDID"] != null)
            {
                CDID = Request["CDID"].ToString();
            }
            if (Request["TID"] != null)
            {
                templateID = Request["TID"].ToString();
            }

            if (Request["Maint"] != null)
            {
                maint = Request["Maint"].ToString();
            }
            if (Request["CustomerName"] != null)
            {
                SessionData.Customer.SCustomerUserName = Convert.ToString(Request["CustomerName"]);
            }

            if (Request["Appname"] != null)
            {
                if (string.IsNullOrEmpty(SessionData.Config.AppID))
                {
                    SessionData.Config = new AppConfiguration();
                    SessionData.Config.AppName = Convert.ToString(Request["Appname"]);
                }
            }

            if (!IsPostBack)
            {
                if (SessionData.Customer.CustomerID.Equals(string.Empty))
                {
                    Response.Redirect("Home.aspx");
                }
                //Fetch Campaign Info from AppConfiguration and AppProduct
                FacebookBizProcess oFBBiz = new FacebookBizProcess();
                SessionData.Config = oFBBiz.GetAppConfiguration(SessionData.Config.AppName, "");
                SessionData.Product = oFBBiz.GetActiveAppProduct(null, SessionData.Config.DID);
                SweepStakesData oSweepDataRetrieved = new SweepStakesData();
                oSweepDataRetrieved = oFBBiz.GetSweepDataForEditing(SessionData.Config.DID);

                //Now prefill all the values
                txtPrizeDetails.Text = oSweepDataRetrieved.SPRizeDetails;
                txtEligibility.Text = oSweepDataRetrieved.SEligibility;
                txtOffRules.Text = oSweepDataRetrieved.SSweeprules;
                txtPrivacy.Text = oSweepDataRetrieved.SSweepPrivacy;
                txtTandC.Text = oSweepDataRetrieved.SSweepTerms;
                ddlSelectWinner.SelectedValue = Convert.ToString(oSweepDataRetrieved.SSweepWinners);
                txtBannerURL.Text = SessionData.Product.SHeaderBannerURL;
                string stdt = oSweepDataRetrieved.SSweepStartDate;
                string edt = oSweepDataRetrieved.SSweepEndDate;
                string exdt = oSweepDataRetrieved.SSweepExpiryDate;

                if (!string.IsNullOrEmpty(stdt))
                {
                    DateTime sd = DateTime.Parse(stdt);
                    datepickerStart.Value = sd.ToString("dd/M/yyyy");
                }

                if (!string.IsNullOrEmpty(edt))
                {
                    DateTime end = DateTime.Parse(edt);
                    datepickerEnd.Value = end.ToString("dd/M/yyyy");
                }

                if (!string.IsNullOrEmpty(exdt))
                {
                    DateTime et = DateTime.Parse(exdt);
                    datepickerExpiry.Value = et.ToString("dd/M/yyyy");
                }

                //Sweepstakes Details tab
                txtHeaderText.Text = SessionData.Product.AppCaption;
                txtCustomTabNamePromo2.Text = SessionData.Config.SCustomtTabName;
                if (SessionData.Product.ShareWidgetAdded.Equals(TRUE))
                {
                    chkShareButton.Checked = true;
                }
                if (SessionData.Product.ReccWidgetAdded.Equals(TRUE))
                {
                    chkRecc.Checked = true;
                }
                if (SessionData.Product.InquiryWidgetAdded.Equals(TRUE))
                {
                    chkInquiry.Checked = true;
                }
                if (SessionData.Product.CommentsWidgetAdded.Equals(TRUE))
                {
                    chkComment.Checked = true;
                }
                if (SessionData.Product.LikeWidgetAdded.Equals(TRUE))
                {
                    chkLike.Checked = true;
                }

                if (SessionData.Product.LikeGatewayAdded.Equals(TRUE))
                {
                    chkLikeGateway.Checked = true;
                    filePromo2LikeGateWayImage.Visible = true;
                }
                if (SessionData.Product.TwitterWidgetAdded.Equals(TRUE))
                {
                    chkTweeter.Checked = true;

                }

                //Sweepstakes Details tab
                txtHeaderText.Text = SessionData.Product.AppCaption;

            }
            if (hdnTabStatus.Value.Equals(STEP_ONE_COMPLETE))
            {

                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "none");

                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");
                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "none");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#campDetLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myStepOneScript", oSBLastTab.ToString(), true);
            }
            else if (hdnTabStatus.Value.Equals(STEP_TWO_COMPLETE))
            {
                //Step two complete,
                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");

                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "block");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#widgetLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myStepTwoDesc", oSBLastTab.ToString(), true);
            }
            else if (hdnTabStatus.Value.Equals(STEP_THREE_COMPLETE))
            {

                //Step two complete,
                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");

                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                fbook.Style.Add("display", "block");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "block");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#fbLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myStepTthree", oSBLastTab.ToString(), true);

            }
            else
            {
                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "none");

                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");
                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "none");
            }

            if (!string.IsNullOrEmpty(hdnCode.Value))
            {
                //Select page call
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close();", true);
                framePage.Attributes.Add("src", "SelectPage.aspx?code=" + hdnCode.Value + "&app_id=" + hdnAppid.Value + "&Twitter=" + hdnTweetEnabled.Value);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnRefresh.Click += new EventHandler(btnRefresh_Click);
            Response.Cache.SetCacheability(HttpCacheability.Private);
            ActiveURL = ConfigurationSettings.AppSettings["ActiveURL"];
            if (!IsPostBack)
            {
                if (SessionData.Customer.CustomerID.Equals(string.Empty))
                {
                    Response.Redirect("Home.aspx");
                }

            }
            if (Request["CDID"] != null)
            {
                CDID = Request["CDID"].ToString();

                //create session based on CDID
                if (SessionData.Customer.CustomerID == null || SessionData.Customer.CustomerID == "")
                {
                    SessionData.Customer = new AppCustomer();
                    SessionData.Customer = canv.GetCustomerInfo(null, CDID, false);
                }
            }
            if (Request["TID"] != null)
            {
                templateID = Request["TID"].ToString();
                //tdLogout.Visible = true;
                //tdLogin.Visible = false;
                //tdSignup.Visible = false;
            }
            if (Request["Maint"] != null)
            {
                maint = Request["Maint"].ToString();
            }
            if (Request["CustomerName"] != null)
            {
                SessionData.Customer.SCustomerUserName = Convert.ToString(Request["CustomerName"]);
            }

            if (!IsPostBack)
            {
                if (Request["Appname"] != null)
                {
                    SessionData.Config = new AppConfiguration();
                    SessionData.Config.AppName = Convert.ToString(Request["Appname"]);
                }

                if (Request["Maint"] != null)
                {
                    //Fetch Campaign Info from AppConfiguration and AppProduct
                    FacebookBizProcess oFBBiz = new FacebookBizProcess();
                    SessionData.Config = oFBBiz.GetAppConfiguration(SessionData.Config.AppName, "");
                    SessionData.Product = oFBBiz.GetActiveAppProduct(null, SessionData.Config.DID);

                    oVidShareData = fbBiz.GetVideoShareData(SessionData.Config.DID);

                    //Now prefill all the values

                    txtCustomTabNamePromo2.Text = SessionData.Config.SCustomtTabName;

                    //Sweepstakes Details tab
                    txtHeaderText.Text = SessionData.Product.AppCaption;
                    txtVideoURL.Text = oVidShareData.SVideoShareURL;
                    txtDescription.Text = oVidShareData.SVideoShareDesc;
                    txtBannerURL.Text = SessionData.Product.SHeaderBannerURL;

                    if (SessionData.Product.ShareWidgetAdded.Equals(TRUE))
                    {
                        chkShareButton.Checked = true;
                    }
                    if (SessionData.Product.ReccWidgetAdded.Equals(TRUE))
                    {
                        chkRecc.Checked = true;
                    }
                    if (SessionData.Product.InquiryWidgetAdded.Equals(TRUE))
                    {
                        chkInquiry.Checked = true;
                        txtInquiryEmail.Visible = true;
                        txtInquiryEmail.Text = SessionData.Config.SInquiryEmail;
                    }
                    if (SessionData.Product.CommentsWidgetAdded.Equals(TRUE))
                    {
                        chkComment.Checked = true;
                    }
                    if (SessionData.Product.LikeWidgetAdded.Equals(TRUE))
                    {
                        chkLike.Checked = true;
                    }

                    string startDate = SessionData.Config.SAppStartDT;
                    string endDate = SessionData.Config.AppExpiryDT;

                    if (!string.IsNullOrEmpty(startDate))
                    {
                        DateTime sd = DateTime.Parse(startDate);
                        datepickerStart.Value = sd.ToString("dd/MM/yyyy");
                    }

                    if (!string.IsNullOrEmpty(endDate))
                    {
                        DateTime end = DateTime.Parse(endDate);
                        datepickerEnd.Value = end.ToString("dd/MM/yyyy");
                    }

                    if (SessionData.Product.LikeGatewayAdded.Equals(TRUE))
                    {
                        chkLikeGateway.Checked = true;
                        filePromo2LikeGateWayImage.Visible = true;
                    }

                    if (SessionData.Product.TwitterWidgetAdded.Equals(TRUE))
                    {
                        chkTweeter.Checked = true;

                    }
                }
            }

            if (hdnTabStatus.Value.Equals(STEP_ONE_COMPLETE))
            {
                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");
                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "none");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#campDetLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", oSBLastTab.ToString(), true);
            }
            else if (hdnTabStatus.Value.Equals(STEP_TWO_COMPLETE))
            {
                //Step two complete,
                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");

                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "block");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#widgetLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", oSBLastTab.ToString(), true);
            }
            else if (hdnTabStatus.Value.Equals(STEP_THREE_COMPLETE))
            {
                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");

                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                fbook.Style.Add("display", "block");
                btnPreviewCampaign.Disabled = false;

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "block");

                StringBuilder oSBLastTab = new StringBuilder();
                oSBLastTab.Append(" $(document).ready(function () {");
                oSBLastTab.Append("$(\"#fbLinker\").trigger('click')");
                oSBLastTab.Append("});");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", oSBLastTab.ToString(), true);
            }
            else
            {
                HtmlGenericControl camp = new HtmlGenericControl();
                camp = (HtmlGenericControl)MainList.FindControl("CampDetails");
                camp.Style.Add("display", "block");

                HtmlGenericControl fbook = new HtmlGenericControl();
                fbook = (HtmlGenericControl)MainList.FindControl("FacebookDet");
                fbook.Style.Add("display", "none");

                HtmlGenericControl fbookShow = new HtmlGenericControl();
                fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets");
                fbookShow.Style.Add("display", "none");
            }

            if (!string.IsNullOrEmpty(hdnCode.Value))
            {
                //Select page call
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close();", true);
                framePage.Attributes.Add("src", "SelectPage.aspx?code=" + hdnCode.Value + "&app_id=" + hdnAppid.Value + "&Twitter=" + hdnTweetEnabled.Value);
            }
        }
コード例 #3
0
ファイル: SelectPage.aspx.cs プロジェクト: apreshchandra/Test
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    ActiveURL = ConfigurationSettings.AppSettings["ActiveURL"];
                    if (Request["app_id"] != null)
                    {
                        appID = Request["app_id"].ToString();
                    }
                    if (Request["code"] != null)
                    {
                        Dictionary<string, string> token = new Dictionary<string, string>();

                        //fetch secret key for app_id
                        FacebookBizProcess fbBiz = new FacebookBizProcess();
                        appSecret = fbBiz.GetAppSecret(appID);

                        token = GetAccessToken(Request["code"].ToString(), "manage_pages,publish_stream", ActiveURL + appID, appID, appSecret);

                        //Get List of Pages
                        FaceBook fb = new FaceBook();
                        string sPages = fb.GetPageAccessToken(token["access_token"].ToString());
                        SessionData.Config = fbBiz.GetAppConfiguration("", appID);
                        string pagetab = string.Empty;

                        DataColumn[] dcPage = new DataColumn[3];

                        dcPage[0] = new DataColumn("pid", System.Type.GetType("System.String"));
                        dtPage.Columns.Add(dcPage[0]);
                        dcPage[1] = new DataColumn("pname", System.Type.GetType("System.String"));
                        dtPage.Columns.Add(dcPage[1]);
                        dcPage[2] = new DataColumn("pacctoken", System.Type.GetType("System.String"));
                        dtPage.Columns.Add(dcPage[2]);

                        System.Web.Script.Serialization.JavaScriptSerializer _oJavaScriptSerializerJason = new System.Web.Script.Serialization.JavaScriptSerializer();
                        JObject objJason = JObject.Parse(sPages);
                        foreach (var i in objJason["data"].Children())
                        {
                            if ((i["category"].ToString().Replace("\"", "")) != "Application")
                            {
                                DataRow drPage = dtPage.NewRow();
                                drPage["pid"] = i["id"].ToString().Replace("\"", "");
                                drPage["pname"] = i["name"].ToString().Replace("\"", "");
                                drPage["pacctoken"] = i["access_token"].ToString().Replace("\"", "");
                                dtPage.Rows.Add(drPage);
                            }
                        }

                        dsPage.Tables.Add(dtPage);

                        //now bind all pages to drop down
                        if (dtPage.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dtPage.Rows)
                            {
                                ddlPageSelect.Items.Add(new ListItem(dr["pname"].ToString(), dr["pacctoken"].ToString()));
                            }
                            Cache["PageDetails"] = dtPage;
                            ddlPageSelect.DataTextField = "pname";
                            ddlPageSelect.DataValueField = "pacctoken";
                        }
                        else
                        {
                            pageSelect.Visible = false;
                            noPageFound.Visible = true;
                            lblNoPage.Text = "You are not admin of any pages";
                        }
                    }
                }

                if (Request["Twitter"] != null)
                {
                    bEnableTwitter = true;
                    //litEnableTweet.Text = GetTwitterShareURL();
                }
            }
            catch (Exception ex)
            {
                CommonUtility commUtil = new CommonUtility();
                commUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
        }