protected void ChangePasswordUser_click(object sender, EventArgs e)
        {
            try
            {
                canvBiz = new CanvasBizProcess();

                if (Request.QueryString["fp"] != null && !string.IsNullOrEmpty(Request["id"]))
                {
                    if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null)
                    {
                        string cid = Request["id"].ToString();
                        id = HttpUtility.UrlDecode(CommonUtility.Decrypt(Request["id"].ToString()));
                        int status = canvBiz.ChangePasswordUser(id, txtpasswordnew.Text.TrimStart(' ').TrimEnd(' '));
                        string script = string.Empty;
                        if (status != 0)
                        {
                            canvBiz.UpdatefpStatus(id, 0);
                            script = "alert('Password Changed Successfully ... ');" + "location.href='Home.aspx?rp=1';";
                            this.ClientScript.RegisterStartupScript(typeof(Page), "RedirectArticle", script, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string imagetoLoad = string.Empty;
                if (!string.IsNullOrEmpty(Request["IDID"].ToString()))
                {
                    imagetoLoad = Request["IDID"].ToString();
                }

                if (!(imagetoLoad.Equals(string.Empty)))
                {
                    prevImage.Src = imagetoLoad;
                }
            }
            catch (Exception ex)
            {
                CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(),"");
            }
        }
Example #3
0
        private void Page_PreRender(object sender, System.EventArgs e)
        {
            SonetPie osonetpie = new SonetPie();
            AppUser oDCAppUser = new AppUser();
            CanvasBizProcess ocanvBiz = new CanvasBizProcess();
            FacebookBizProcess fbBizProc = new FacebookBizProcess();
            try
            {

                if (Request.Browser.IsMobileDevice == true || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android") || Request.UserAgent.ToLower().Contains("ipad"))
                {
                    if (QSVars.Contains("oauth_token") && QSVars.Contains("oauth_token"))
                    {
                        Response.Redirect(NotifyURL + "MobileRedirect.aspx?app_id=" + QSVars["app_id"].ToString() + "&access_tok=" + QSVars["oauth_token"].ToString() + "&user_id=" + QSVars["user_id"], false);
                    }
                    else
                    {
                        Response.Redirect(NotifyURL + "MobileRedirect.aspx?app_id=" + QSVars["app_id"].ToString() + "&access_tok=" + Convert.ToString(Session["oauth_token"]) + "&user_id=" + Convert.ToString(Session["user_id"]), false);
                    }
                }

                MainJavaScriptContent.Text = GetInitializedJS();

                //NEW VERSION 13-April-2012
                //Use the response_type=code to generate the access token
                if (Request.QueryString.Count == 2)
                {

                    //close and redirect to SelectPage
                    StringBuilder oSBWindowScript = new StringBuilder();

                    string pageCaller = "{code:\"" + Convert.ToString(QSVars["code"]) + "\",app_id:\"" + Convert.ToString(QSVars["app_id"]) + "\"}";
                    oSBWindowScript.Append("window.opener.tabSelection(" + pageCaller + ");");
                    oSBWindowScript.Append("window.close();");

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", oSBWindowScript.ToString(), true);

                    Response.Redirect("SelectPage.aspx?app_id=" + Convert.ToString(QSVars["app_id"]) + "&code=" + Convert.ToString(QSVars["code"]), false);

                }

                if (Request.QueryString.Count == 1)
                {
                    osonetpie.QSvarsString = GetQsVarsCollection();
                    osonetpie.AbsolutePath = AbsolutePagePath;

                    if (QSVars.Count > 6)
                    {

                        oDCAppUser.AppConfigDID = QSVars["ADID"].ToString();
                        hdnAppConfigD.Value = oDCAppUser.AppConfigDID;
                        oDCAppUser.SonetID = QSVars["user_id"].ToString();
                        hdnUserID.Value = oDCAppUser.SonetID;
                        hdnAppID.Value = QSVars["app_id"].ToString();
                        Session["UserID"] = hdnUserID.Value;
                        Session["AppID"] = hdnAppID.Value;
                        Session["ADID"] = oDCAppUser.AppConfigDID;
                        oDCAppUser = ofbBiz.GetAppUser(osonetpie, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());

                        if (QSVars.Contains("liked"))
                        {
                            if (QSVars["liked"].Equals("true") && !ofbBiz.IsLikeGatewayAdded(QSVars["ADID"].ToString())) // If Already liked show page else Force user to like, iff like gateway was selected
                            {
                                //check if configuration is still good- that means not EXPIRED
                                if (!ofbBiz.IsConfigurationExpired(QSVars["ADID"].ToString()))
                                {
                                    //populate the AppProduct encapsulation based on app that is loaded
                                    AppProduct oAppProduct = new AppProduct();
                                    FaceBook facebook = new FaceBook();

                                    oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, QSVars["ADID"].ToString());
                                    litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                    // Get the HTML to be shown

                                    //Get Custom Tab name
                                    string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());

                                    //Get Share Button for this Product
                                    string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                                    string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), CustTabNAme);
                                    string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());
                                    string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                    string LinkedInButton = "<script src=\"//platform.linkedin.com/in.js\" type=\"text/javascript\"></script><script type=\"IN/Share\" data-counter=\"right\" data-url=\"" + ofbBiz.GetAppPath(Convert.ToString(Request.QueryString["app_id"])) + "\"  data-onSuccess=\"LIShare\"></script><script type=\"text/javascript\">            function LIShare() { AsycRequest('" + GetNavigationURL(NotifyURL + "FBNotify.aspx?NTYP=LISHARE&PDID=" + oAppProduct.DID + "&NDID=" + _sNotifierDID, true) + "');  }</script>";
                                    if (!oAppProduct.ProductCategory.Equals("WebHutColl."))
                                    {

                                        litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                        // Get the HTML to be shown

                                        string HTML = oAppProduct.ProductHTML;

                                        //Get Share Button for this Product

                                        if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                                        {
                                            addCOMMENT = HTML.Replace("CommBox", CommentBox);
                                        }
                                        else
                                        {
                                            addCOMMENT = HTML.Replace("CommBox", "");
                                        }

                                        if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                                        {
                                            addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                                        }
                                        else
                                        {
                                            addSHARE = addCOMMENT.Replace("ShButton", "");
                                        }
                                        if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                                        {
                                            addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                                        }
                                        else
                                        {
                                            addTwitter = addSHARE.Replace("TwButton", string.Empty);
                                        }

                                        if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                                        {
                                            if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                            {
                                                addPOST = addTwitter.Replace("ReButton", InviteButton);
                                            }
                                            else
                                            {
                                                addPOST = addTwitter.Replace("ReButton", "");
                                            }
                                            //if HTML contains LIKE
                                            addEntry = addPOST.Replace("Entry", EntryFormPlug);

                                            if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                            {
                                                addCaption = addEntry.Replace("Caption", "");
                                            }
                                            else
                                            {
                                                addCaption = addEntry.Replace("Caption", oAppProduct.AppCaption);
                                            }

                                            if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                            {
                                                addLead = addCaption.Replace("Lead", LeadPlugin);
                                            }
                                            else
                                            {
                                                addLead = addCaption.Replace("Lead", "");
                                            }

                                            if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                            {
                                                addLIKE = addLead.Replace("Like", LikePlugin);
                                            }
                                            else
                                            {
                                                addLIKE = addLead.Replace("Like", "");
                                            }

                                            litAppHTML.Text = addLIKE;
                                            hdnStatus.Value = "HIDE";
                                            apppathLink.Visible = false;
                                        }
                                        else
                                        {

                                            if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                            {
                                                addPOST = addTwitter.Replace("ReButton", RecommendButton);
                                            }
                                            else
                                            {
                                                addPOST = addTwitter.Replace("ReButton", "");
                                            }

                                            if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                            {
                                                addLIKE = addPOST.Replace("Like", LikePlugin);
                                            }
                                            else
                                            {
                                                addLIKE = addPOST.Replace("Like", "");
                                            }

                                            //if HTML contains LIKE
                                            addEntry = addLIKE.Replace("Entry", EntryFormPlug);

                                            if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                            {
                                                addLead = addEntry.Replace("Lead", LeadPlugin);
                                            }
                                            else
                                            {
                                                addLead = addEntry.Replace("Lead", "");
                                            }

                                            if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                            {
                                                addCaption = addLead.Replace("Caption", "");
                                            }
                                            else
                                            {
                                                addCaption = addLead.Replace("Caption", oAppProduct.AppCaption);
                                            }
                                            string addPrint = addCaption.Replace("Print", PrintButton);
                                            string addEmail = addPrint.Replace("Email", EmailButton);
                                            addTwitter = addEmail.Replace("TwButton", TwitterButton);
                                            litAppHTML.Text = addEmail;
                                            hdnStatus.Value = "HIDE";
                                            apppathLink.Visible = false;
                                        }
                                    }
                                    else
                                    {

                                        pageToLoad = "index.html";

                                        SiteID = fbBizProc.GetSiteIDForConfig(Convert.ToString(QSVars["ADID"]));
                                        SessionData.Config = new AppConfiguration();
                                        SessionData.Config.SSiteID = SiteID;
                                        TemplateID = fbBizProc.GetTemplateIDForConfig(Convert.ToString(QSVars["ADID"]));

                                        hdnPageToLoad.Value = pageToLoad;
                                        StreamReader streamReader = new StreamReader(Server.MapPath("Sites\\Final\\" + SiteID + "\\" + pageToLoad));
                                        string text = streamReader.ReadToEnd();
                                        streamReader.Close();

                                        //check for DirtyPage
                                        string Query = "select DirtyPage from Sites where SiteId=" + SiteID;

                                        DataSet oDataSet = new DataSet();
                                        SqlHelper.FillDataset(ConfigurationSettings.AppSettings["SoConn"].ToString(), CommandType.Text, Query, oDataSet, new string[] { "SiteDetails" });

                                        string isDirty = Convert.ToString(oDataSet.Tables["SiteDetails"].Rows[0]["DirtyPage"]);

                                        if (isDirty.Equals("Y"))
                                        {
                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\">", ShareButton);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\">", RecommendButton);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\">", LikePlugin);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\">", TwitterButton);
                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\">", LinkedInButton);

                                            if (TemplateID == 11)
                                            {
                                                text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", EmailButton);
                                                text = text.Replace("<img class=\"ActionImg\" src=\"images/print.png\">", PrintButton);
                                            }
                                        }
                                        else
                                        {
                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\" />", ShareButton);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\" />", RecommendButton);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\" />", LikePlugin);

                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\" />", TwitterButton);
                                            text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\">", LinkedInButton);
                                            if (TemplateID == 11)
                                            {
                                                text = text.Replace("<img class=\"ActionImg\" src=\"Images/email.png\">", EmailButton);
                                                text = text.Replace("<img class=\"ActionImg\" src=\"Images/print.png\">", PrintButton);
                                            }
                                        }

                                        //fix all Image tags
                                        string imagesReplaced = text.Replace("images", "images1/" + SiteID);

                                        String style;

                                        if (TemplateID == 12)
                                        {
                                            style = "/CSS/RStore_style.css";
                                            SessionData.PrefData.TemplateID1 = TemplateID;
                                        }
                                        else if (TemplateID == 13)
                                        {
                                            style = "/CSS/FabrikStyle.css";
                                            popupContact.Visible = false;
                                            SessionData.PrefData.TemplateID1 = TemplateID;
                                        }
                                        else if (TemplateID == 11)
                                        {
                                            style = "/CSS/CouponsStyle.css";
                                            popupContact.Visible = false;
                                            SessionData.PrefData.TemplateID1 = TemplateID;
                                        }
                                        else if (TemplateID == 14)
                                        {
                                            style = "/CSS/realestate_styles.css";
                                            SessionData.PrefData.TemplateID1 = TemplateID;

                                        }
                                        else if (TemplateID == 16)
                                        {
                                            style = "/CSS/Restaurantstyle.css";
                                            SessionData.PrefData.TemplateID1 = TemplateID;

                                        }
                                        else if (TemplateID == 17)
                                        {
                                            style = "/CSS/Educationalstyle.css";
                                            SessionData.PrefData.TemplateID1 = TemplateID;

                                        }
                                        else
                                        {
                                            style = "/CSS/PFstyle.css";
                                            SessionData.PrefData.TemplateID1 = TemplateID;

                                        }

                                        //get all the Images, Styles in
                                        System.IO.StreamReader StreamReader1 =
            new System.IO.StreamReader(Server.MapPath("./Sites/Final/" + SiteID + style));
                                        string ReadStyle = StreamReader1.ReadToEnd();
                                        StreamReader1.Close();

                                        if (TemplateID == 14)
                                        {
                                            HtmlLink linking = Page.FindControl("facebookIDStyleSheet") as HtmlLink;
                                            linking.Href = "./Sites/Final/" + SiteID + style;
                                        }

                                        System.IO.StreamReader StreamReader2 =
            new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                        string CleanStyle = StreamReader2.ReadToEnd();
                                        CleanStyle = string.Empty;
                                        StreamReader2.Close();

                                        System.IO.StreamWriter StreamWriter2 =
                        new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                        StreamWriter2.WriteLine(CleanStyle);
                                        StreamWriter2.Close();

                                        System.IO.StreamWriter StreamWriter1 =
                        new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                        StreamWriter1.WriteLine(ReadStyle);
                                        StreamWriter1.Close();

                                        ////saranya

                                        //System.IO.StreamReader sr = new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                        //String fileContents = sr.ReadToEnd();
                                        //sr.Close();

                                        //System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                        //fileContents = fileContents.Replace("images", "images1/" + SiteID + "");
                                        //sw.WriteLine(fileContents);
                                        //sw.Close();

                                        ///NOW process all the images
                                        string imagePath = Server.MapPath("./Sites/Final/" + SiteID + "/Images/");
                                        string[] files = System.IO.Directory.GetFiles(imagePath);

                                        if (!Directory.Exists(Server.MapPath("./Images1/" + SiteID)))
                                        {
                                            Directory.CreateDirectory(Server.MapPath("./Images1/" + SiteID));
                                        }

                                        foreach (string file in files)
                                        {
                                            if (!System.IO.File.Exists(Server.MapPath("./Images1/" + SiteID + "/" + System.IO.Path.GetFileName(file))))
                                            {
                                                System.IO.File.Copy(file, System.IO.Path.Combine(Server.MapPath("./Images1/" + SiteID), System.IO.Path.GetFileName(file)));
                                            }
                                        }
                                        LoadComplete = true;

                                        litAppHTML.Text = imagesReplaced;

                                        if (TemplateID == 13)
                                        {
                                            litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"CSS/FabrikStyle.css\" rel=\"stylesheet\" type=\"text/css\">", "");
                                        }
                                        else if (TemplateID == 11)
                                        {
                                            litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"CSS/CouponsStyle.css\" rel=\"stylesheet\" type=\"text/css\" />", "");
                                        }
                                        backgroundPopup.Visible = false;
                                    }

                                }
                                else if (ofbBiz.IsSweepstakesAppModel(QSVars["ADID"].ToString()) == "SWEEPSTAKES") // Check if Sweepstake Appmodal
                                {
                                    if (ofbBiz.IsSweepstakesWinnerDay(QSVars["ADID"].ToString()))// Check if Sweepstake Date is today, redirect to Show Winners
                                    {
                                        Response.Redirect("SweepstakesWinners.aspx?ADID=" + Convert.ToString(QSVars["ADID"]), false);
                                    }
                                    else
                                    {
                                        string Enddate = ofbBiz.GetSweepstakesEndDate(QSVars["ADID"].ToString());
                                        if (!string.IsNullOrEmpty(Enddate))
                                        {
                                            DateTime sd = DateTime.Parse(Enddate);
                                            Enddate = sd.ToString("dd/M/yyyy");
                                        }
                                        //litAppHTML.Text = "Sweepstakes Contest is over. Results will be shown on ...";
                                        apppathLink.InnerText = "Sweepstakes Contest is over. Winners will be announced on " + Enddate;
                                        popupContact.Style.Add("margin-left", "250px");
                                    }

                                }
                                else
                                {
                                    AppExpired.Visible = true;
                                    litAppHTML.Text = "";
                                    popupContact.Visible = false;
                                }
                            }
                            else
                            {
                                if (ofbBiz.IsLikeGatewayAdded(QSVars["ADID"].ToString()))
                                {
                                    //means app page is liked and now user shud be shown app
                                    if (QSVars["liked"].Equals("true"))
                                    {
                                        if (!ofbBiz.IsConfigurationExpired(QSVars["ADID"].ToString()))
                                        {
                                            //populate the AppProduct encapsulation based on app that is loaded
                                            AppProduct oAppProduct = new AppProduct();
                                            FaceBook facebook = new FaceBook();

                                            oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, QSVars["ADID"].ToString());
                                            litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                            // Get the HTML to be shown

                                            string HTML = oAppProduct.ProductHTML;

                                            //Get Custom Tab name
                                            string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());

                                            //Get Share Button for this Product
                                            string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                                            string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), CustTabNAme);
                                            string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());
                                            string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                            if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                                            {
                                                addCOMMENT = HTML.Replace("CommBox", CommentBox);
                                            }
                                            else
                                            {
                                                addCOMMENT = HTML.Replace("CommBox", "");
                                            }

                                            if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                                            {
                                                addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                                            }
                                            else
                                            {
                                                addSHARE = addCOMMENT.Replace("ShButton", "");
                                            }

                                            if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                                            {
                                                addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                                            }
                                            else
                                            {
                                                addTwitter = addSHARE.Replace("TwButton", string.Empty);
                                            }

                                            if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                                            {
                                                if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", InviteButton);
                                                }
                                                else
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", "");
                                                }
                                                //if HTML contains LIKE
                                                addEntry = addPOST.Replace("Entry", EntryFormPlug);

                                                if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                {
                                                    addCaption = addEntry.Replace("Caption", "");
                                                }
                                                else
                                                {
                                                    addCaption = addEntry.Replace("Caption", oAppProduct.AppCaption);
                                                }

                                                if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                {
                                                    addLead = addCaption.Replace("Lead", LeadPlugin);
                                                }
                                                else
                                                {
                                                    addLead = addCaption.Replace("Lead", "");
                                                }

                                                if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                {
                                                    addLIKE = addLead.Replace("Like", LikePlugin);
                                                }
                                                else
                                                {
                                                    addLIKE = addLead.Replace("Like", "");
                                                }

                                                litAppHTML.Text = addLIKE;
                                                hdnStatus.Value = "HIDE";
                                                apppathLink.Visible = false;
                                            }
                                            else
                                            {

                                                if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", RecommendButton);
                                                }
                                                else
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", "");
                                                }

                                                if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                {
                                                    addLIKE = addPOST.Replace("Like", LikePlugin);
                                                }
                                                else
                                                {
                                                    addLIKE = addPOST.Replace("Like", "");
                                                }

                                                if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                {
                                                    addLead = addLIKE.Replace("Lead", LeadPlugin);
                                                }
                                                else
                                                {
                                                    addLead = addLIKE.Replace("Lead", "");
                                                }

                                                if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                {
                                                    addCaption = addLead.Replace("Caption", "");
                                                }
                                                else
                                                {
                                                    addCaption = addLead.Replace("Caption", oAppProduct.AppCaption);
                                                }
                                                string addPrint = addCaption.Replace("Print", PrintButton);
                                                string addEmail = addPrint.Replace("Email", EmailButton);
                                                litAppHTML.Text = addEmail;
                                                hdnStatus.Value = "HIDE";
                                                apppathLink.Visible = false;
                                            }
                                        }
                                        else if (ofbBiz.IsSweepstakesAppModel(QSVars["ADID"].ToString()) == "SWEEPSTAKES") // Check if Sweepstake Appmodal
                                        {
                                            if (ofbBiz.IsSweepstakesWinnerDay(QSVars["ADID"].ToString()))// Check if Sweepstake Date is today, redirect to Show Winners
                                            {
                                                Response.Redirect("SweepstakesWinners.aspx?ADID=" + Convert.ToString(QSVars["ADID"]), false);
                                            }
                                            else
                                            {
                                                string Enddate = ofbBiz.GetSweepstakesEndDate(QSVars["ADID"].ToString());
                                                if (!string.IsNullOrEmpty(Enddate))
                                                {
                                                    DateTime sd = DateTime.Parse(Enddate);
                                                    Enddate = sd.ToString("dd/M/yyyy");
                                                }
                                                //litAppHTML.Text = "Sweepstakes Contest is over. Results will be shown on ...";
                                                apppathLink.InnerText = "Sweepstakes Contest is over. Winners will be announced on " + Enddate;
                                                popupContact.Style.Add("margin-left", "250px");
                                            }

                                        }
                                        else
                                        {
                                            AppExpired.Visible = true;
                                            litAppHTML.Text = "";
                                            popupContact.Visible = false;
                                        }
                                    }
                                    else
                                    {
                                        if (!QSVars["admin"].Equals("true"))
                                        {
                                            litAppHTML.Text = " <img id=\"imgLGateway\" src=\"Images/like_us_to_proceed.jpg\"/>";
                                            popupContact.Visible = false;
                                            backgroundPopup.Visible = false;
                                        }
                                        else
                                        {
                                            if (!ofbBiz.IsConfigurationExpired(QSVars["ADID"].ToString()))
                                            {
                                                //populate the AppProduct encapsulation based on app that is loaded
                                                AppProduct oAppProduct = new AppProduct();
                                                FaceBook facebook = new FaceBook();

                                                oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, QSVars["ADID"].ToString());
                                                litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                                // Get the HTML to be shown

                                                string HTML = oAppProduct.ProductHTML;

                                                //Get Custom Tab name
                                                string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());

                                                //Get Share Button for this Product
                                                string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                                                string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), CustTabNAme);
                                                string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());
                                                string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                                if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                                                {
                                                    addCOMMENT = HTML.Replace("CommBox", CommentBox);
                                                }
                                                else
                                                {
                                                    addCOMMENT = HTML.Replace("CommBox", "");
                                                }

                                                if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                                                {
                                                    addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                                                }
                                                else
                                                {
                                                    addSHARE = addCOMMENT.Replace("ShButton", "");
                                                }

                                                if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                                                {
                                                    addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                                                }
                                                else
                                                {
                                                    addTwitter = addSHARE.Replace("TwButton", string.Empty);
                                                }

                                                if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                                                {
                                                    if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                    {
                                                        addPOST = addTwitter.Replace("ReButton", InviteButton);
                                                    }
                                                    else
                                                    {
                                                        addPOST = addTwitter.Replace("ReButton", "");
                                                    }
                                                    //if HTML contains LIKE
                                                    addEntry = addPOST.Replace("Entry", EntryFormPlug);

                                                    if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                    {
                                                        addCaption = addEntry.Replace("Caption", "");
                                                    }
                                                    else
                                                    {
                                                        addCaption = addEntry.Replace("Caption", oAppProduct.AppCaption);
                                                    }

                                                    if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                    {
                                                        addLead = addCaption.Replace("Lead", LeadPlugin);
                                                    }
                                                    else
                                                    {
                                                        addLead = addCaption.Replace("Lead", "");
                                                    }

                                                    if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                    {
                                                        addLIKE = addLead.Replace("Like", LikePlugin);
                                                    }
                                                    else
                                                    {
                                                        addLIKE = addLead.Replace("Like", "");
                                                    }

                                                    litAppHTML.Text = addLIKE;
                                                    hdnStatus.Value = "HIDE";
                                                    apppathLink.Visible = false;
                                                }
                                                else
                                                {

                                                    if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                    {
                                                        addPOST = addTwitter.Replace("ReButton", RecommendButton);
                                                    }
                                                    else
                                                    {
                                                        addPOST = addTwitter.Replace("ReButton", "");
                                                    }

                                                    if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                    {
                                                        addLIKE = addPOST.Replace("Like", LikePlugin);
                                                    }
                                                    else
                                                    {
                                                        addLIKE = addPOST.Replace("Like", "");
                                                    }

                                                    if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                    {
                                                        addLead = addLIKE.Replace("Lead", LeadPlugin);
                                                    }
                                                    else
                                                    {
                                                        addLead = addLIKE.Replace("Lead", "");
                                                    }

                                                    if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                    {
                                                        addCaption = addLead.Replace("Caption", "");
                                                    }
                                                    else
                                                    {
                                                        addCaption = addLead.Replace("Caption", oAppProduct.AppCaption);
                                                    }
                                                    string addPrint = addCaption.Replace("Print", PrintButton);
                                                    string addEmail = addPrint.Replace("Email", EmailButton);
                                                    litAppHTML.Text = addEmail;
                                                    hdnStatus.Value = "HIDE";
                                                    apppathLink.Visible = false;
                                                }
                                            }
                                            else if (ofbBiz.IsSweepstakesAppModel(QSVars["ADID"].ToString()) == "SWEEPSTAKES") // Check if Sweepstake Appmodal
                                            {
                                                if (ofbBiz.IsSweepstakesWinnerDay(QSVars["ADID"].ToString()))// Check if Sweepstake Date is today, redirect to Show Winners
                                                {
                                                    Response.Redirect("SweepstakesWinners.aspx?ADID=" + Convert.ToString(QSVars["ADID"]), false);
                                                }
                                                else
                                                {
                                                    string Enddate = ofbBiz.GetSweepstakesEndDate(QSVars["ADID"].ToString());
                                                    if (!string.IsNullOrEmpty(Enddate))
                                                    {
                                                        DateTime sd = DateTime.Parse(Enddate);
                                                        Enddate = sd.ToString("dd/M/yyyy");
                                                    }
                                                    //litAppHTML.Text = "Sweepstakes Contest is over. Results will be shown on ...";
                                                    apppathLink.InnerText = "Sweepstakes Contest is over. Winners will be announced on " + Enddate;
                                                    popupContact.Style.Add("margin-left", "250px");
                                                }

                                            }
                                            else
                                            {
                                                AppExpired.Visible = true;
                                                litAppHTML.Text = "";
                                                popupContact.Visible = false;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (!ofbBiz.IsConfigurationExpired(QSVars["ADID"].ToString()))
                                    {
                                        //populate the AppProduct encapsulation based on app that is loaded
                                        AppProduct oAppProduct = new AppProduct();
                                        oAppProduct.DID = ofbBiz.GetProductDID(Convert.ToString(QSVars["ADID"]));
                                        FaceBook facebook = new FaceBook();
                                        //Get Custom Tab name
                                        string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());
                                        string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                                        string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), CustTabNAme);
                                        string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());
                                        string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                        string LinkedInButton = "<script src=\"//platform.linkedin.com/in.js\" type=\"text/javascript\"></script><script type=\"IN/Share\" data-url=\"" + ofbBiz.GetAppPath(Convert.ToString(Request.QueryString["app_id"])) + "\"  data-onSuccess=\"LIShare\"></script><script type=\"text/javascript\">            function LIShare() { AsycRequest('" + GetNavigationURL(NotifyURL + "FBNotify.aspx?NTYP=LISHARE&PDID=" + oAppProduct.DID + "&NDID=" + _sNotifierDID, true) + "');  }</script>";
                                        oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, QSVars["ADID"].ToString());
                                        if (!oAppProduct.ProductCategory.Equals("WebHutColl."))
                                        {

                                            litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                            // Get the HTML to be shown

                                            string HTML = oAppProduct.ProductHTML;

                                            //Get Share Button for this Product

                                            if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                                            {
                                                addCOMMENT = HTML.Replace("CommBox", CommentBox);
                                            }
                                            else
                                            {
                                                addCOMMENT = HTML.Replace("CommBox", "");
                                            }

                                            if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                                            {
                                                addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                                            }
                                            else
                                            {
                                                addSHARE = addCOMMENT.Replace("ShButton", "");
                                            }
                                            if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                                            {
                                                addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                                            }
                                            else
                                            {
                                                addTwitter = addSHARE.Replace("TwButton", string.Empty);
                                            }

                                            if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                                            {
                                                if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", InviteButton);
                                                }
                                                else
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", "");
                                                }
                                                //if HTML contains LIKE
                                                addEntry = addPOST.Replace("Entry", EntryFormPlug);

                                                if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                {
                                                    addCaption = addEntry.Replace("Caption", "");
                                                }
                                                else
                                                {
                                                    addCaption = addEntry.Replace("Caption", oAppProduct.AppCaption);
                                                }

                                                if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                {
                                                    addLead = addCaption.Replace("Lead", LeadPlugin);
                                                }
                                                else
                                                {
                                                    addLead = addCaption.Replace("Lead", "");
                                                }

                                                if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                {
                                                    addLIKE = addLead.Replace("Like", LikePlugin);
                                                }
                                                else
                                                {
                                                    addLIKE = addLead.Replace("Like", "");
                                                }

                                                litAppHTML.Text = addLIKE;
                                                hdnStatus.Value = "HIDE";
                                                apppathLink.Visible = false;
                                            }
                                            else
                                            {

                                                if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", RecommendButton);
                                                }
                                                else
                                                {
                                                    addPOST = addTwitter.Replace("ReButton", "");
                                                }

                                                if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                                {
                                                    addLIKE = addPOST.Replace("Like", LikePlugin);
                                                }
                                                else
                                                {
                                                    addLIKE = addPOST.Replace("Like", "");
                                                }

                                                //if HTML contains LIKE
                                                addEntry = addLIKE.Replace("Entry", EntryFormPlug);

                                                if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                                {
                                                    addLead = addEntry.Replace("Lead", LeadPlugin);
                                                }
                                                else
                                                {
                                                    addLead = addEntry.Replace("Lead", "");
                                                }

                                                if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                                {
                                                    addCaption = addLead.Replace("Caption", "");
                                                }
                                                else
                                                {
                                                    addCaption = addLead.Replace("Caption", oAppProduct.AppCaption);
                                                }
                                                string addPrint = addCaption.Replace("Print", PrintButton);
                                                string addEmail = addPrint.Replace("Email", EmailButton);
                                                addTwitter = addEmail.Replace("TwButton", TwitterButton);
                                                litAppHTML.Text = addEmail;
                                                hdnStatus.Value = "HIDE";
                                                apppathLink.Visible = false;
                                            }
                                        }
                                        else
                                        {

                                            pageToLoad = "index.html";

                                            SiteID = fbBizProc.GetSiteIDForConfig(Convert.ToString(QSVars["ADID"]));
                                            SessionData.Config = new AppConfiguration();
                                            SessionData.Config.SSiteID = SiteID;
                                            TemplateID = fbBizProc.GetTemplateIDForConfig(Convert.ToString(QSVars["ADID"]));

                                            hdnPageToLoad.Value = pageToLoad;
                                            StreamReader streamReader = new StreamReader(Server.MapPath("Sites\\Final\\" + SiteID + "\\" + pageToLoad));
                                            string text = streamReader.ReadToEnd();
                                            streamReader.Close();

                                            //check for DirtyPage
                                            string Query = "select DirtyPage from Sites where SiteId=" + SiteID;

                                            DataSet oDataSet = new DataSet();
                                            SqlHelper.FillDataset(ConfigurationSettings.AppSettings["SoConn"].ToString(), CommandType.Text, Query, oDataSet, new string[] { "SiteDetails" });

                                            string isDirty = Convert.ToString(oDataSet.Tables["SiteDetails"].Rows[0]["DirtyPage"]);

                                            if (isDirty.Equals("Y"))
                                            {
                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\">", ShareButton);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\">", RecommendButton);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\">", LikePlugin);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\">", TwitterButton);
                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\">", LinkedInButton);

                                                if (TemplateID == 11)
                                                {
                                                    text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", EmailButton);
                                                    text = text.Replace("<img class=\"ActionImg\" src=\"images/print.png\">", PrintButton);
                                                }
                                            }
                                            else
                                            {
                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\" />", ShareButton);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\" />", RecommendButton);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\" />", LikePlugin);

                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\" />", TwitterButton);
                                                text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\" />", LinkedInButton);
                                                if (TemplateID == 11)
                                                {
                                                    text = text.Replace("<img class=\"ActionImg\" src=\"Images/email.png\">", EmailButton);
                                                    text = text.Replace("<img class=\"ActionImg\" src=\"Images/print.png\">", PrintButton);
                                                }
                                            }

                                            //fix all Image tags
                                            string imagesReplaced = text.Replace("images", "images1/" + SiteID);

                                            String style;

                                            if (TemplateID == 12)
                                            {
                                                style = "/CSS/RStore_style.css";
                                                SessionData.PrefData.TemplateID1 = TemplateID;
                                            }
                                            else if (TemplateID == 13)
                                            {
                                                style = "/CSS/FabrikStyle.css";
                                                popupContact.Visible = false;
                                                SessionData.PrefData.TemplateID1 = TemplateID;
                                            }
                                            else if (TemplateID == 11)
                                            {
                                                style = "/CSS/CouponsStyle.css";
                                                popupContact.Visible = false;
                                                SessionData.PrefData.TemplateID1 = TemplateID;
                                            }
                                            else if (TemplateID == 14)
                                            {
                                                style = "/css/realestate_styles.css";
                                                SessionData.PrefData.TemplateID1 = TemplateID;

                                            }
                                            else if (TemplateID == 16)
                                            {
                                                style = "/CSS/Restaurantstyle.css";
                                                SessionData.PrefData.TemplateID1 = TemplateID;

                                            }
                                            else if (TemplateID == 17)
                                            {
                                                style = "/CSS/Educationalstyle.css";
                                                SessionData.PrefData.TemplateID1 = TemplateID;

                                            }

                                            else
                                            {
                                                style = "/css/PFstyle.css";
                                                SessionData.PrefData.TemplateID1 = TemplateID;

                                            }

                                            //get all the Images, Styles in
                                            System.IO.StreamReader StreamReader1 =
            new System.IO.StreamReader(Server.MapPath("./Sites/Final/" + SiteID + style));
                                            string ReadStyle = StreamReader1.ReadToEnd();
                                            StreamReader1.Close();

                                            if (TemplateID == 14)
                                            {
                                                HtmlLink linking = Page.FindControl("facebookIDStyleSheet") as HtmlLink;
                                                linking.Href = "./Sites/Final/" + SiteID + style;
                                            }

                                            System.IO.StreamReader StreamReader2 =
            new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                            string CleanStyle = StreamReader2.ReadToEnd();
                                            CleanStyle = string.Empty;
                                            StreamReader2.Close();

                                            System.IO.StreamWriter StreamWriter2 =
                            new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                            StreamWriter2.WriteLine(CleanStyle);
                                            StreamWriter2.Close();

                                            System.IO.StreamWriter StreamWriter1 =
                            new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                            StreamWriter1.WriteLine(ReadStyle);
                                            StreamWriter1.Close();

                                            ////saranya

                                            //System.IO.StreamReader sr = new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                            //String fileContents = sr.ReadToEnd();
                                            //sr.Close();

                                            //System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                            //fileContents = fileContents.Replace("images", "images1/" + SiteID + "");
                                            //sw.WriteLine(fileContents);
                                            //sw.Close();

                                            ///NOW process all the images
                                            string imagePath = Server.MapPath("./Sites/Final/" + SiteID + "/Images/");
                                            string[] files = System.IO.Directory.GetFiles(imagePath);

                                            if (!Directory.Exists(Server.MapPath("./Images1/" + SiteID)))
                                            {
                                                Directory.CreateDirectory(Server.MapPath("./Images1/" + SiteID));
                                            }

                                            foreach (string file in files)
                                            {
                                                if (!System.IO.File.Exists(Server.MapPath("./Images1/" + SiteID + "/" + System.IO.Path.GetFileName(file))))
                                                {
                                                    System.IO.File.Copy(file, System.IO.Path.Combine(Server.MapPath("./Images1/" + SiteID), System.IO.Path.GetFileName(file)));
                                                }
                                            }
                                            LoadComplete = true;

                                            litAppHTML.Text = imagesReplaced;

                                            if (TemplateID == 13)
                                            {
                                                litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"CSS/FabrikStyle.css\" rel=\"stylesheet\" type=\"text/css\">", "");
                                            }
                                            else if (TemplateID == 11)
                                            {
                                                litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"CSS/CouponsStyle.css\" rel=\"stylesheet\" type=\"text/css\" />", "");
                                            }
                                            backgroundPopup.Visible = false;
                                        }
                                    }
                                    else if (ofbBiz.IsSweepstakesAppModel(QSVars["ADID"].ToString()) == "SWEEPSTAKES") // Check if Sweepstake CampaignType
                                    {
                                        if (ofbBiz.IsSweepstakesWinnerDay(QSVars["ADID"].ToString()))// Check if Sweepstake Date is today, redirect to Show Winners
                                        {
                                            Response.Redirect("SweepstakesWinners.aspx?ADID=" + Convert.ToString(QSVars["ADID"]), false);
                                        }
                                        else
                                        {
                                            string Enddate = ofbBiz.GetSweepstakesEndDate(QSVars["ADID"].ToString());
                                            if (!string.IsNullOrEmpty(Enddate))
                                            {
                                                DateTime sd = DateTime.Parse(Enddate);
                                                Enddate = sd.ToString("dd/M/yyyy");
                                            }
                                            //litAppHTML.Text = "Sweepstakes Contest is over. Results will be shown on ...";
                                            apppathLink.InnerText = "Sweepstakes Contest is over. Winners will be announced on " + Enddate;
                                            popupContact.Style.Add("margin-left", "250px");
                                        }

                                    }
                                    else
                                    {
                                        AppExpired.Visible = true;
                                        litAppHTML.Text = "";
                                        popupContact.Visible = false;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!ofbBiz.IsConfigurationExpired(QSVars["ADID"].ToString()))
                            {
                                //populate the AppProduct encapsulation based on app that is loaded
                                AppProduct oAppProduct = new AppProduct();
                                FaceBook facebook = new FaceBook();
                                //Get Custom Tab name
                                string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());
                                string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                                string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), CustTabNAme);
                                string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());
                                string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                                string LinkedInButton = "<script src=\"//platform.linkedin.com/in.js\" type=\"text/javascript\"></script><script type=\"IN/Share\" data-counter=\"right\" data-url=\"" + ofbBiz.GetAppPath(Convert.ToString(Request.QueryString["app_id"])) + "\"  data-onSuccess=\"LIShare\"></script><script type=\"text/javascript\">            function LIShare() { AsycRequest('" + GetNavigationURL(NotifyURL + "FBNotify.aspx?NTYP=LISHARE&PDID=" + oAppProduct.DID + "&NDID=" + _sNotifierDID, true) + "');  }</script>";
                                oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, QSVars["ADID"].ToString());
                                if (!oAppProduct.ProductCategory.Equals("WebHutColl."))
                                {

                                    litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                                    // Get the HTML to be shown

                                    string HTML = oAppProduct.ProductHTML;

                                    //Get Share Button for this Product

                                    if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                                    {
                                        addCOMMENT = HTML.Replace("CommBox", CommentBox);
                                    }
                                    else
                                    {
                                        addCOMMENT = HTML.Replace("CommBox", "");
                                    }

                                    if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                                    {
                                        addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                                    }
                                    else
                                    {
                                        addSHARE = addCOMMENT.Replace("ShButton", "");
                                    }
                                    if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                                    {
                                        addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                                    }
                                    else
                                    {
                                        addTwitter = addSHARE.Replace("TwButton", string.Empty);
                                    }

                                    if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                                    {
                                        if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                        {
                                            addPOST = addTwitter.Replace("ReButton", InviteButton);
                                        }
                                        else
                                        {
                                            addPOST = addTwitter.Replace("ReButton", "");
                                        }
                                        //if HTML contains LIKE
                                        addEntry = addPOST.Replace("Entry", EntryFormPlug);

                                        if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                        {
                                            addCaption = addEntry.Replace("Caption", "");
                                        }
                                        else
                                        {
                                            addCaption = addEntry.Replace("Caption", oAppProduct.AppCaption);
                                        }

                                        if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                        {
                                            addLead = addCaption.Replace("Lead", LeadPlugin);
                                        }
                                        else
                                        {
                                            addLead = addCaption.Replace("Lead", "");
                                        }

                                        if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                        {
                                            addLIKE = addLead.Replace("Like", LikePlugin);
                                        }
                                        else
                                        {
                                            addLIKE = addLead.Replace("Like", "");
                                        }

                                        litAppHTML.Text = addLIKE;
                                        hdnStatus.Value = "HIDE";
                                        apppathLink.Visible = false;
                                    }
                                    else
                                    {

                                        if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                                        {
                                            addPOST = addTwitter.Replace("ReButton", RecommendButton);
                                        }
                                        else
                                        {
                                            addPOST = addTwitter.Replace("ReButton", "");
                                        }

                                        if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                                        {
                                            addLIKE = addPOST.Replace("Like", LikePlugin);
                                        }
                                        else
                                        {
                                            addLIKE = addPOST.Replace("Like", "");
                                        }

                                        //if HTML contains LIKE
                                        addEntry = addLIKE.Replace("Entry", EntryFormPlug);

                                        if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                                        {
                                            addLead = addEntry.Replace("Lead", LeadPlugin);
                                        }
                                        else
                                        {
                                            addLead = addEntry.Replace("Lead", "");
                                        }

                                        if (string.IsNullOrEmpty(oAppProduct.AppCaption))
                                        {
                                            addCaption = addLead.Replace("Caption", "");
                                        }
                                        else
                                        {
                                            addCaption = addLead.Replace("Caption", oAppProduct.AppCaption);
                                        }
                                        string addPrint = addCaption.Replace("Print", PrintButton);
                                        string addEmail = addPrint.Replace("Email", EmailButton);
                                        addTwitter = addEmail.Replace("TwButton", TwitterButton);
                                        litAppHTML.Text = addEmail;
                                        hdnStatus.Value = "HIDE";
                                        apppathLink.Visible = false;
                                    }
                                }
                                else
                                {

                                    pageToLoad = "index.html";

                                    SiteID = fbBizProc.GetSiteIDForConfig(Convert.ToString(QSVars["ADID"]));
                                    SessionData.Config = new AppConfiguration();
                                    SessionData.Config.SSiteID = SiteID;
                                    TemplateID = fbBizProc.GetTemplateIDForConfig(Convert.ToString(QSVars["ADID"]));

                                    hdnPageToLoad.Value = pageToLoad;
                                    StreamReader streamReader = new StreamReader(Server.MapPath("Sites\\Final\\" + SiteID + "\\" + pageToLoad));
                                    string text = streamReader.ReadToEnd();
                                    streamReader.Close();

                                    //check for DirtyPage
                                    string Query = "select DirtyPage from Sites where SiteId=" + SiteID;
                                    DataSet oDataSet = new DataSet();
                                    SqlHelper.FillDataset(ConfigurationSettings.AppSettings["SoConn"].ToString(), CommandType.Text, Query, oDataSet, new string[] { "SiteDetails" });

                                    string isDirty = Convert.ToString(oDataSet.Tables["SiteDetails"].Rows[0]["DirtyPage"]);

                                    if (isDirty.Equals("Y"))
                                    {
                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\">", ShareButton);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\">", RecommendButton);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\">", LikePlugin);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\">", TwitterButton);
                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\">", LinkedInButton);
                                        if (TemplateID == 11)
                                        {
                                            text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", EmailButton);
                                            text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", PrintButton);
                                        }
                                    }
                                    else
                                    {
                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_facebook.png\" />", ShareButton);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_recommend.png\" />", RecommendButton);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/fb-like-button.png\" />", LikePlugin);

                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_twitter.png\" />", TwitterButton);
                                        text = text.Replace("<img class=\"dynamic\" src=\"images/SNR_linkedIn.png\">", LinkedInButton);
                                        if (TemplateID == 11)
                                        {
                                            text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", EmailButton);
                                            text = text.Replace("<img class=\"ActionImg\" src=\"images/email.png\">", PrintButton);
                                        }
                                    }

                                    //fix all Image tags
                                    string imagesReplaced = text.Replace("images", "images1/" + SiteID);

                                    String style;

                                    if (TemplateID == 12)
                                    {
                                        style = "/CSS/RStore_style.css";

                                    }
                                    else if (TemplateID == 13)
                                    {
                                        style = "/CSS/FabrikStyle.css";
                                        popupContact.Visible = false;
                                    }
                                    else if (TemplateID == 11)
                                    {
                                        style = "/CSS/CouponsStyle.css";
                                        popupContact.Visible = false;
                                    }
                                    else if (TemplateID == 16)
                                    {
                                        style = "/CSS/Restaurantstyle.css";
                                        SessionData.PrefData.TemplateID1 = TemplateID;

                                    }

                                    else if (TemplateID == 17)
                                    {
                                        style = "/CSS/Educationalstyle.css";
                                        SessionData.PrefData.TemplateID1 = TemplateID;

                                    }
                                    else
                                    {
                                        style = "/CSS/realestate_styles.css";

                                    }

                                    //get all the Images, Styles in
                                    System.IO.StreamReader StreamReader1 =
            new System.IO.StreamReader(Server.MapPath("./Sites/Final/" + SiteID + style));
                                    string ReadStyle = StreamReader1.ReadToEnd();
                                    StreamReader1.Close();

                                    if (TemplateID == 14)
                                    {

                                        HtmlLink linking = Page.FindControl("facebookIDStyleSheet") as HtmlLink;
                                        linking.Href = "./Sites/Final/" + SiteID + style;

                                    }

                                    System.IO.StreamReader StreamReader2 =
            new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                    string CleanStyle = StreamReader2.ReadToEnd();
                                    CleanStyle = string.Empty;
                                    StreamReader2.Close();

                                    System.IO.StreamWriter StreamWriter2 =
                    new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                    StreamWriter2.WriteLine(CleanStyle);
                                    StreamWriter2.Close();

                                    System.IO.StreamWriter StreamWriter1 =
                    new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                    StreamWriter1.WriteLine(ReadStyle);
                                    StreamWriter1.Close();

                                    //saranya

                                    System.IO.StreamReader sr = new System.IO.StreamReader(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                    String fileContents = sr.ReadToEnd();
                                    sr.Close();

                                    System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("./ScriptsSonetReach/Facebookstyles.css"));
                                    fileContents = fileContents.Replace("images", "images1/" + SiteID + "");
                                    sw.WriteLine(fileContents);
                                    sw.Close();

                                    ///NOW process all the images
                                    string imagePath = Server.MapPath("./Sites/Final/" + SiteID + "/Images/");
                                    string[] files = System.IO.Directory.GetFiles(imagePath);

                                    if (!Directory.Exists(Server.MapPath("./Images1/" + SiteID)))
                                    {
                                        Directory.CreateDirectory(Server.MapPath("./Images1/" + SiteID));
                                    }

                                    foreach (string file in files)
                                    {
                                        if (!System.IO.File.Exists(Server.MapPath("./Images1/" + SiteID + "/" + System.IO.Path.GetFileName(file))))
                                        {
                                            System.IO.File.Copy(file, System.IO.Path.Combine(Server.MapPath("./Images1/" + SiteID), System.IO.Path.GetFileName(file)));
                                        }
                                    }
                                    LoadComplete = true;

                                    litAppHTML.Text = imagesReplaced;

                                    litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"CSS/FabrikStyle.css\" rel=\"stylesheet\" type=\"text/css\">", "");
                                    //litAppHTML.Text = litAppHTML.Text.Replace("<link href=\"css/realestate_styles.css\" rel=\"stylesheet\" type=\"text/css\">", "");

                                    backgroundPopup.Visible = false;
                                }
                            }
                            else if (ofbBiz.IsSweepstakesAppModel(QSVars["ADID"].ToString()) == "SWEEPSTAKES") // Check if Sweepstake CampaignType
                            {
                                if (ofbBiz.IsSweepstakesWinnerDay(QSVars["ADID"].ToString()))// Check if Sweepstake Date is today, redirect to Show Winners
                                {
                                    Response.Redirect("SweepstakesWinners.aspx?ADID=" + Convert.ToString(QSVars["ADID"]), false);
                                }
                                else
                                {
                                    string Enddate = ofbBiz.GetSweepstakesEndDate(QSVars["ADID"].ToString());
                                    if (!string.IsNullOrEmpty(Enddate))
                                    {
                                        DateTime sd = DateTime.Parse(Enddate);
                                        Enddate = sd.ToString("dd/M/yyyy");
                                    }
                                    //litAppHTML.Text = "Sweepstakes Contest is over. Results will be shown on ...";
                                    apppathLink.InnerText = "Sweepstakes Contest is over. Winners will be announced on " + Enddate;
                                    popupContact.Style.Add("margin-left", "250px");
                                }

                            }
                            else
                            {
                                AppExpired.Visible = true;
                                litAppHTML.Text = "";
                                popupContact.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        oDCAppUser.AppConfigDID = Session["ADID"].ToString();
                        hdnAppConfigD.Value = oDCAppUser.AppConfigDID;
                        oDCAppUser.SonetID = Session["UserID"].ToString();
                        hdnUserID.Value = oDCAppUser.SonetID;
                        hdnAppID.Value = Session["AppID"].ToString();
                        Session["UserID"] = hdnUserID.Value;
                        Session["AppID"] = hdnAppID.Value;
                        oDCAppUser = ofbBiz.GetAppUser(osonetpie, Session["ADID"].ToString(), Session["UserID"].ToString());
                        //populate the AppProduct encapsulation based on app that is loaded
                        AppProduct oAppProduct = new AppProduct();
                        FaceBook facebook = new FaceBook();

                        oAppProduct = ofbBiz.GetActiveAppProduct(osonetpie, Session["ADID"].ToString());
                        litHeadBannerCount.Text = GetHeadBannerURL(oAppProduct.DID);
                        // Get the HTML to be shown

                        string HTML = oAppProduct.ProductHTML;
                        // Fill up Config and Custome
                        //Get Custom Tab name
                        string CustTabNAme = fbBizProc.GetCustomTabName(Session["AppID"].ToString());
                        //Get Share Button for this Product

                        string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString(), fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"])));
                        string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, Session["AppID"].ToString(), CustTabNAme);
                        string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, Session["AppID"].ToString());
                        string RecommendButton = GetRecommendButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, Session["AppID"].ToString());
                        string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, Session["AppID"].ToString());
                        string EntryFormPlug = GetEntryForm(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, Session["ADID"].ToString(), Session["UserID"].ToString().ToString());
                        string LeadPlugin = GetLeadButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                        string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["app_id"].ToString());
                        //if HTML contains SHARE and Widgets are present

                        if (oAppProduct.CommentsWidgetAdded.Equals(TRUE))
                        {
                            addCOMMENT = HTML.Replace("CommBox", CommentBox);
                        }
                        else
                        {
                            addCOMMENT = HTML.Replace("CommBox", "");
                        }

                        if (oAppProduct.ShareWidgetAdded.Equals(TRUE))
                        {
                            addSHARE = addCOMMENT.Replace("ShButton", ShareButton);
                        }
                        else
                        {
                            addSHARE = addCOMMENT.Replace("ShButton", "");
                        }
                        if (oAppProduct.TwitterWidgetAdded.Equals(TRUE))
                        {
                            addTwitter = addSHARE.Replace("TwButton", TwitterButton);
                        }
                        else
                        {
                            addTwitter = addSHARE.Replace("TwButton", string.Empty);
                        }

                        if (ocanvBiz.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                        {
                            if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                            {
                                addPOST = addTwitter.Replace("ReButton", InviteButton);
                            }
                            else
                            {
                                addPOST = addTwitter.Replace("ReButton", "");
                            }
                            //if HTML contains LIKE
                            addEntry = addPOST.Replace("Like", EntryFormPlug);

                            litAppHTML.Text = addEntry;
                            hdnStatus.Value = "HIDE";
                            apppathLink.Visible = false;
                        }
                        else
                        {

                            if (oAppProduct.ReccWidgetAdded.Equals(TRUE))
                            {
                                addPOST = addTwitter.Replace("ReButton", InviteButton);
                            }
                            else
                            {
                                addPOST = addTwitter.Replace("ReButton", "");
                            }

                            if (oAppProduct.LikeWidgetAdded.Equals(TRUE))
                            {
                                addLIKE = addPOST.Replace("Like", LikePlugin);
                            }
                            else
                            {
                                addLIKE = addPOST.Replace("Like", "");
                            }

                            if (oAppProduct.InquiryWidgetAdded.Equals(TRUE))
                            {
                                addLead = addLIKE.Replace("Lead", LeadPlugin);
                            }
                            else
                            {
                                addLead = addLIKE.Replace("Lead", "");
                            }
                            litAppHTML.Text = addLead;
                            hdnStatus.Value = "HIDE";
                            apppathLink.Visible = false;
                        }
                    }
                }
                else if (Request.QueryString.AllKeys.Contains("request_ids"))
                {
                    apppathLink.HRef = fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"]));
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.location.href='" + apppathLink.HRef.ToString() + "'", true);
                }
                else
                {
                    //Nothing to load , show error screen
                    if (QSVars["app_id"] == null)
                    {
                        Server.Transfer("Error.aspx");
                    }
                    else
                    {
                        apppathLink.HRef = fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"]));
                        if (QSVars.Contains("soNETSrc"))
                        {
                            if (!(Convert.ToString(QSVars["soNETSrc"].ToString()).Equals("NULL")))
                            {
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.close();", true);
                            }
                            else
                            {
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.location.href='" + apppathLink.HRef.ToString() + "'", true);
                            }
                        }
                    }

                    if (Request.Url.Query.Contains("fb_source"))
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.location.href='" + apppathLink.HRef.ToString() + "'", true);
                    }
                }

                //saranya
                if (Request.QueryString.AllKeys.Contains("request_ids"))
                {
                    apppathLink.HRef = fbBizProc.GetAppPagePath(Convert.ToString(QSVars["app_id"]));
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.location.href='" + apppathLink.HRef.ToString() + "'", true);
                }
            }
            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);
            }
        }
Example #4
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);
                HideBranding = false;
                EnableAppUser = true;
                NotifyURL = ConfigurationManager.AppSettings["NotifyURL"];
                ActiveURL = ConfigurationSettings.AppSettings["ActiveURL"];

                HttpCookie exampleCookie = Request.Cookies["ExampleCookie"];
                if (exampleCookie != null)
                {
                    pageToLoad = exampleCookie["pagetoload"];
                }
            }
            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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                btnRefresh.Click += new EventHandler(btnRefresh_Click);
                litEnableFBJS.Text = GetInitializedJS();
                litOGTags.Text = GetOGMetaTags();
                string access_token = hdnAuthToken.Value;
                string signedrequest = hdnSignedRequest.Value;
                string userid = hdnUserID.Value;
                string Liked = hdnLike.Value;

                NotifyURL = ConfigurationSettings.AppSettings["NotifyURL"];

                if (Request.UrlReferrer != null)
                {
                    if (Request.UrlReferrer.Query.Length > 5 && Request.UrlReferrer.Query.Contains("NTYP"))
                    {
                        //notification happened
                        string fullRef = Request.UrlReferrer.Query.ToString();
                        string[] fragment = fullRef.Split('&');

                        string ShareCheck = fragment[1].ToString();
                        string[] ShareCheckSpilt = ShareCheck.Split('=');
                        string IsShare = ShareCheckSpilt[1].ToString(); //USE this value

                        string ProdDID = fragment[2].ToString();
                        string[] ProdDIDSplit = ProdDID.Split('=');
                        string ISPDID = ProdDIDSplit[1].ToString();

                        string NotDID = fragment[3].ToString();
                        string[] NotIDSplit = NotDID.Split('=');
                        string IsNOTIFDID = NotIDSplit[1].ToString();

                        string FBUserID = fragment[4].ToString();
                        string[] FBUserIDSplit = FBUserID.Split('=');
                        if (FBUserIDSplit.Length > 1)
                        {
                            oDCAppUser.SonetID = FBUserIDSplit[1].ToString();
                            Session["SonetID"] = oDCAppUser.SonetID;
                        }

                        //get UserDID
                        string ConfigDID = fbBiz.GetConfigDEED(Convert.ToString(Request["app_id"].ToString())); string UDID;
                        if (string.IsNullOrEmpty(oDCAppUser.SonetID))
                        {
                            UDID = fbBiz.GetUserDID(ConfigDID, Session["SonetID"].ToString());
                        }
                        else
                        {
                            UDID = fbBiz.GetUserDID(ConfigDID, oDCAppUser.SonetID);
                        }

                        //Now Send Notifier to DB
                        if (fbBiz.RaiseAppNotifier(oDCAppUser, IsShare, UDID, ISPDID, IsNOTIFDID, oAppLead, string.Empty))
                        {
                            //do something

                        }
                    }
                    else
                    {
                        if (Request.QueryString["app_id"] != null)
                        {
                            if (!string.IsNullOrEmpty(access_token) || !string.IsNullOrEmpty(userid))
                            {
                                Response.Redirect(NotifyURL + "SonetReachPDA.aspx?acc_tok=" + access_token + "&uID=" + userid + "&app_id=" + Convert.ToString(Request["app_id"]),false);
                            }

                        }
                    }
                }

                else
                {
                    if (Request.QueryString["app_id"] != null)
                    {
                        if (!string.IsNullOrEmpty(access_token) || !string.IsNullOrEmpty(userid))
                        {
                            Response.Redirect(NotifyURL + "SonetReachPDA.aspx?acc_tok=" + access_token + "&uID=" + userid + "&app_id=" + Convert.ToString(Request["app_id"]),false);
                        }
                    }
                }

            }
            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);
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (!string.IsNullOrEmpty(Request["TDID"].ToString()))
                    {
                        TDID = Request["TDID"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request["PDID"].ToString()))
                    {
                        PDID = Request["PDID"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request["CDID"].ToString()))
                    {
                        CDID = Request["CDID"].ToString();
                    }

                    FacebookBizProcess fbBiz = new FacebookBizProcess();

                    //Fetch Product Info to show Selected Widgets during Preview
                    string tempTEMPLATE = fbBiz.GetPreviewProduct(PDID).Rows[0]["ProductHTML"].ToString();

                    if (!tempTEMPLATE.Equals(NO_PREVIEW)) //Check if Preview is available
                    {
                        //SHARE, LIKE, INQUIRY
                        if (SessionData.Product.LikeWidgetAdded.Equals(TRUE))
                        {
                            likeWork = tempTEMPLATE.Replace("Like", "<input id=\"LikeButton\" type=\"button\"  disabled=\"disabled\">");
                        }
                        else
                        {
                            likeWork = tempTEMPLATE.Replace("Like", "");
                        }
                        if (SessionData.Product.ShareWidgetAdded.Equals(TRUE))
                        {
                            shareWork = likeWork.Replace("ShButton", "<input id=\"ShareButton\" type=\"button\"  disabled=\"disabled\">");
                        }
                        else
                        {
                            shareWork = likeWork.Replace("ShButton", "");
                        }
                        if (SessionData.Product.InquiryWidgetAdded.Equals(TRUE))
                        {
                            leadWork = shareWork.Replace("Lead", "<input id=\"LeadButton\" type=\"button\" disabled=\"disabled\">");
                        }
                        else
                        {
                            leadWork = shareWork.Replace("Lead", "");
                        }
                        if (SessionData.Product.TwitterWidgetAdded.Equals(TRUE))
                        {
                            twitterWork = leadWork.Replace("TwButton", "<input id=\"TwiButton\" type=\"button\" disabled=\"disabled\">");
                        }
                        else
                        {
                            twitterWork = leadWork.Replace("TwButton", "");
                        }

                        //RECOMMEND
                        if (SessionData.Product.ReccWidgetAdded.Equals(TRUE))
                        {
                            if (TDID == "3")
                            {
                                postWork = twitterWork.Replace("ReButton", "<input id=\"ReccoButton\" type=\"button\" disabled=\"disabled\">");
                            }
                            else if (TDID == "5")
                            {
                                postWork = twitterWork.Replace("ReButton", "<input id=\"ReccoButton\" type=\"button\" disabled=\"disabled\">");
                            }
                            else if (TDID == "6")
                            {
                                postWork = twitterWork.Replace("ReButton", "<input id=\"ReccoButton\" type=\"button\" disabled=\"disabled\">");
                            }
                            else if (TDID == "4")
                            {
                                postWork = twitterWork.Replace("ReButton", "<input id=\"ReccoButton\" type=\"button\" disabled=\"disabled\">");
                            }
                        }
                        else
                        {
                            postWork = twitterWork.Replace("ReButton", "");
                        }

                        //COMMENTS
                        if (SessionData.Product.CommentsWidgetAdded.Equals(TRUE))
                        {
                            commWork = postWork.Replace("CommBox", "<img id=\"imgComment\" alt=\"\" src=\"Images/fb-comment_Preview.jpg\">");
                        }
                        else
                        {
                            commWork = postWork.Replace("CommBox", "");
                        }

                        //CAPTION
                        if (!string.IsNullOrEmpty(SessionData.Product.AppCaption))
                        {
                            captionWork = commWork.Replace("Caption", SessionData.Product.AppCaption);
                        }
                        else
                        {
                            captionWork = commWork.Replace("Caption", "");
                        }

                        if (TDID == "7")
                        {
                            printWork = captionWork.Replace("Print", "<input id=\"printButton\" type=\"button\" disabled=\"disabled\">");
                            emailWork = printWork.Replace("Email", "<input id=\"emailButton\" type=\"button\" disabled=\"disabled\">");
                        }

                        //Finally, render the preview
                        litPreview.Text = captionWork;
                    }
                    else
                    {
                        litPreview.Text = NO_PREVIEW;
                    }

                }
            }
            catch (Exception ex)
            {
                CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }
Example #7
0
        protected override void OnPreLoad(EventArgs e)
        {
            try
            {
                base.OnPreLoad(e);
                FacebookBizProcess fbBiz = new FacebookBizProcess();
                FaceBook oFBUtility = new FaceBook();
                SonetPieBizProcess sonetpiebiz = new SonetPieBizProcess();
                SonetPie sonetpie = new SonetPie();
                NotifyURL = ConfigurationSettings.AppSettings["NotifyURL"];
                pageRefreshed = false;

                if (QSVars.Contains("user_id"))
                {
                    Session["facebook_user_id"] = QSVars["user_id"].ToString();
                }
                if (QSVars.Contains("UDID"))
                {
                    Session["sr_user_did"] = QSVars["UDID"].ToString();
                }
                if (QSVars.Contains("PDID"))
                {
                    Session["sr_product_did"] = QSVars["PDID"].ToString();
                }

                if (Request.Url.Query.Contains("request") && !(Request.Url.Query.Contains("fb_source"))) //AppRequest callback, now save to notifiers
                {

                    for (int i = 0; i < Request.QueryString.Count - 2; i++)
                    {
                        //every Request["to[i]"] has a userID for AppNotifier
                        string fbUID = Request["to[" + i + "]"].ToString();
                        string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
                        string facebook_user_id = Convert.ToString(Session["facebook_user_id"]);
                        string UDID = Convert.ToString(Session["sr_user_did"]);
                        if (QSVars.Contains("NDID"))
                            QSVars["NDID"] = _sNotifierDID;
                        else
                            QSVars.Add("NDID", _sNotifierDID);

                        //Build DCAppWallPost for each user

                        AppUser oDCAppUser = new AppUser();
                        string ConfigDID = fbBiz.GetConfigDEED(Convert.ToString(QSVars["app_id"]));
                        if (!QSVars.Contains("ADID"))
                        {
                            QSVars.Add("ADID", ConfigDID);
                        }
                        if (!QSVars.Contains("PDID"))
                        {
                            QSVars.Add("PDID", Convert.ToString(Session["sr_product_did"]));
                        }
                        oDCAppUser = ofbBiz.GetAppUser(osonetpie, QSVars["ADID"].ToString(), facebook_user_id);

                        _oDCAppWallPost.FromUserID = Convert.ToString(QSVars["user_id"]);
                        _oDCAppWallPost.ToUserID = fbUID;
                        _oDCAppWallPost.Name = ofbBiz.GetCustomTabName(QSVars["app_id"].ToString());
                        _oDCAppWallPost.Source = Convert.ToString(QSVars["user_id"]);
                        AppLeadData oAppLead = new AppLeadData();

                        if (Request.Browser.IsMobileDevice == true || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android"))
                        {
                            if (fbBiz.RaiseAppNotifier(oDCAppUser, "MPOST", UDID, Convert.ToString(QSVars["PDID"]), "", fbUID))
                            {

                            }
                        }
                        else
                        {
                            if (fbBiz.RaiseAppNotifier(oDCAppUser, "POST", UDID, Convert.ToString(QSVars["PDID"]), "", fbUID))
                            {

                            }
                        }
                    }
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close();", true);
                }

                if (Request["code"] == null)
                {
                    if ((Request.QueryString.Count > 0) && !(Request["LIKED"] != null))
                    {
                        //ParseRequest & set values to qsvars
                        if (!(Request.QueryString).AllKeys[0].ToString().Contains("tabs_added"))
                        {
                            //REVISIT

                            sonetpie.QSvarsString = GetQsVarsCollection();
                            sonetpie.FormvarsString = GetFormVarsCollection();
                            sonetpie.AbsolutePath = AbsolutePagePath;

                            if (Request.Form.ToString() != string.Empty)
                            {
                                FormVars.Add("signed_request", Request.Form.Get(0).ToString());
                            }

                            //Init Biz
                            //SonetPieBizProcess sonetpiebiz = new SonetPieBizProcess();

                            if (QSVars.Contains("app_id"))
                            {

                                if (EnableAppServices) _oDCAppConfiguration = sonetpiebiz.GetAppConfiguration("", QSVars["app_id"].ToString());
                                SessionData.Config.DID = _oDCAppConfiguration.DID;
                                //DigiMa.Common.FaceBook oFBUtility1 = new DigiMa.Common.FaceBook();

                                //check AppConfig got loaded
                                if (AppConfig != null)
                                {
                                    //Add CDID to Load customer
                                    if (QSVars.Contains("CDID"))
                                        QSVars["CDID"] = AppConfig.AppCustomerDID;
                                    else
                                        QSVars.Add("CDID", AppConfig.AppCustomerDID);

                                    //Add ADID to Load customer
                                    if (QSVars.Contains("ADID"))
                                        QSVars["ADID"] = AppConfig.DID;
                                    else
                                        QSVars.Add("ADID", AppConfig.DID);

                                    //Reset KOKO QSVars
                                    sonetpie.QSvarsString = GetQsVarsCollection();
                                    _oDCAppCustomer = fbBiz.GetAppCustomer(Convert.ToString(QSVars["CDID"]));

                                    //ParseSigned Request
                                    if ((!QSVars.Contains("oauth_token")))
                                    {
                                        oFBUtility.ParseSignedRequest(ref _qsVars, ref _frmVars, AppConfig);
                                    }

                                    if (QSVars.Contains("oauth_token"))
                                    {
                                        Session["oauth_token"] = Convert.ToString(QSVars["oauth_token"]);
                                    }

                                    if (QSVars.Contains("user_id"))
                                    {
                                        Session["user_id"] = Convert.ToString(QSVars["user_id"]);
                                    }

                                    //call graph to get page_Acc_tok
                                    if (QSVars.Contains("oauth_token") && (_oDCAppConfiguration.SAppCustomNameAdded == null || _oDCAppConfiguration.SAppCustomNameAdded == ""))
                                    {
                                        page_access_token = facebook.GetPageAccessToken(QSVars["oauth_token"].ToString());
                                        System.Web.Script.Serialization.JavaScriptSerializer _oJavaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                                        JObject obj = JObject.Parse(page_access_token);
                                        IEnumerable<string> query = from res in (Newtonsoft.Json.Linq.JArray)obj["data"]
                                                                    let reso = res as JObject
                                                                    where ((string)reso["id"]).ToLower() == _oDCAppConfiguration.SPageID
                                                                    select (string)reso["access_token"];

                                        //fetch the logo of this Campaign from AppProduct and pass to CallPages

                                        if (facebook.CallPages(_oDCAppConfiguration.SPageID, query.ToList()[0].ToString(), "app_" + QSVars["app_id"].ToString(), _oDCAppConfiguration.SCustomtTabName, fbBiz.FetchAppLogo(QSVars["app_id"].ToString())))
                                        {
                                            //update custom_updated to Y
                                            fbBiz.UpdateCustomTabNAme(_oDCAppConfiguration.DID);
                                            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);
                                        }

                                    }

                                    //parse the JSON
                                    if (HasAuthorization)
                                    {
                                        if (!QSVars.Contains("oauth_token"))
                                        {
                                            //Set Authorization stamp on redirect url
                                            AppConfig.AppPath += "?soNETSrc=";
                                            if (QSVars.Contains("NDID"))
                                                AppConfig.AppPath += Convert.ToString(QSVars["NDID"]);
                                            else
                                                AppConfig.AppPath += "NULL";

                                            //oFBUtility.GetAccessToken(QSVars["code"].ToString(), "user_location,email,friends_location,publish_stream",AppConfig.AppPath,AppConfig);

                                            // CHeck if Request is coming from Mobile device, then open Standalone
                                            if (Request.Browser.IsMobileDevice == true || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android"))
                                            {
                                                //oFBUtility.AuthorizeMob(this, "user_location,email,friends_location,user_birthday", AppConfig);
                                            }
                                            else
                                            {
                                                oFBUtility.Authorize(this, "user_location,email,friends_location,user_birthday", AppConfig);
                                            }

                                        }
                                        else
                                        {
                                            //Insert user into DB
                                            if (true)
                                            {
                                                //Call service to store into DB
                                                AppUser oDCAppUser = new AppUser();
                                                oDCAppUser.AppConfigDID = AppConfig.DID;
                                                oDCAppUser.EmailID = "NULL";
                                                oDCAppUser.SonetID = Convert.ToString(QSVars["user_id"]);
                                                oDCAppUser.SonetSRC = Convert.ToString(QSVars["soNETSrc"]);
                                                oDCAppUser.UserStatus = "Active";
                                                oDCAppUser.SMType = "FB";
                                                oDCAppUser = oFBUtility.GetUserDetail(Convert.ToString(QSVars["user_id"]), Convert.ToString(QSVars["oauth_token"]), oDCAppUser);

                                                //Save to DB
                                                if (!fbBiz.IsUserCreatedForFacebook(oDCAppUser.SonetID, oDCAppUser.AppConfigDID))
                                                {
                                                    if (fbBiz.SetAppUserAuthorize(oDCAppUser, Convert.ToString(QSVars["ADID"]))) _oDCAppUser = oDCAppUser;
                                                }
                                            }
                                        }
                                    }
                                }

                                //refrsh to get tab name
                                //fbBiz.UpdateCustomTabNAme(_oDCAppConfiguration.DID);
                                //ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);

                                //Load AppUser based on property
                                if (_bEnableAppUser && _qsVars.Contains("user_id"))
                                {
                                    sonetpie.QSvarsString = GetQsVarsCollection();
                                    _oDCAppUser = fbBiz.GetAppUser(sonetpie, Convert.ToString(QSVars["ADID"]), Convert.ToString(QSVars["user_id"]));
                                    if (_oDCAppUser != null)
                                    {
                                        if (!_qsVars.Contains("UDID")) _qsVars.Add("UDID", _oDCAppUser.DID); else _qsVars["UDID"] = _oDCAppUser.DID;
                                        if (QSVars.Count < 8)
                                        {
                                            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + _oDCAppConfiguration.SAppPagePath + "'", true);//To ensure all QSVARS are loaded from facebook
                                        }
                                    }
                                }

                                //Update Notifier count based on NDID or soNETSrc
                                if (QSVars.Contains("soNETSrc") || QSVars.Contains("NDID"))
                                {
                                    AppNotifier oAppNotifier = new AppNotifier();
                                    if (QSVars.Contains("soNETSrc")) oAppNotifier.DID = Convert.ToString(QSVars["soNETSrc"]);
                                    if (QSVars.Contains("NDID")) oAppNotifier.DID = Convert.ToString(QSVars["NDID"]);
                                    if (!string.IsNullOrEmpty(oAppNotifier.DID)) fbBiz.EditAppNotifierDetails(oAppNotifier);
                                }
                            }
                        }

                    }
                    else
                    {
                        //
                    }
                }

                else
                {

                    //Here redirect user to Page path
                    if (QSVars.Contains("app_id") && QSVars.Contains("soNETSrc"))
                    {
                        //string pageToRedirect = fbBiz.GetAppPagePath(Convert.ToString(QSVars["app_id"]));
                        //Response.Redirect(pageToRedirect,true);

                    }

                }

            }
            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);
            }
        }
Example #8
0
        //DONE
        public AppConfiguration GetAvailableConfig(string CDID)
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                DataSet dsFinalHTML = new DataSet();
                AppConfiguration _oAppConfig = new AppConfiguration();

                dsFinalHTML = oDBH.FillData_SP("GetAvailableConfig");
                if (dsFinalHTML.Tables.Count > 0)
                {
                    if (dsFinalHTML.Tables[0].Rows.Count > 0)
                    {
                        _oAppConfig.AppCustomerDID = CDID;
                        _oAppConfig.AppID = dsFinalHTML.Tables[0].Rows[0]["AppID"].ToString();
                        objCommon.SendErrorMail(Convert.ToString(_oAppConfig.AppID), "DALC", "", "", "");
                        _oAppConfig.AppKey = dsFinalHTML.Tables[0].Rows[0]["AppKey"].ToString();
                        _oAppConfig.AppSecretKey = dsFinalHTML.Tables[0].Rows[0]["AppSecretKey"].ToString();
                        _oAppConfig.AppPath = dsFinalHTML.Tables[0].Rows[0]["AppName"].ToString();
                        _oAppConfig.AppName = dsFinalHTML.Tables[0].Rows[0]["AppType"].ToString();
                        //_oAppConfig.DID = new AppConfiguration().GetNewDIDWithPrefix();
                    }
                    //Now Update this row status to IA

                    string sqlQueryUpdate = "update [AppConfigRefrence] set AppConfigStatus='IA' where RowID=" + dsFinalHTML.Tables[0].Rows[0]["RowID"].ToString();
                    if (oDBH.ExecuteNonQuery(sqlQueryUpdate) > 0) return _oAppConfig; else return _oAppConfig;
                }
                else
                {
                    return null;
                }
            }
            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);
            }
            return null;
        }
 private string GenerateRandomCode()
 {
     int size = 6;
     try
     {
         char[] cr = "0123456789abcdefghijklmnopqrstuvwxyz".ToCharArray();
         string result = string.Empty;
         Random r = new Random();
         for (int i = 0; i < size; i++)
         {
             result += cr[r.Next(0, cr.Length - 1)].ToString();
         }
         return result;
     }
     catch (Exception ex)
     {
         DigiMa.Common.CommonUtility objCommon = new CommonUtility();
         objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
     }
     return string.Empty;
 }
Example #10
0
        protected void submibmail_Click(object sender, EventArgs e)
        {
            canvBiz = new CanvasBizProcess();
            AppCustomer oAppCustomer = new AppCustomer();

            string uid = canvBiz.GetCustId(txtmailid.Text.TrimStart(' ').TrimEnd(' '));
            try
            {
                if (txtmailid.Text.Contains(">") || txtmailid.Text.Contains("<") || txtmailid.Text.Contains("'") || txtmailid.Text.Contains("--") || txtmailid.Text.Contains("%"))
                {
                    txtmailid.Text = "";
                }
                else
                {
                    if (flag)
                    {
                        string NewTempPass = GenerateNewPassword(8);
                        string temppass = _oEncryptionUtilities.getEncryptedCode(NewTempPass);
                        int chkavalible = canvBiz.VerifyEmailInsertNewPassword(txtmailid.Text.TrimStart(' ').TrimEnd(' '), temppass);

                        if (chkavalible == 1)
                        {
                            int mailstatus = MailTrigger(txtmailid.Text);
                            if (mailstatus == 1)
                            {
                                string script = "alert('Password Sent To Email.');" + "location.href='Home.aspx?';";
                                this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true);
                                CanvasBizProcess canvasBiz = new CanvasBizProcess();
                                //UPdate fpStatus to 1 as user has requested reset password
                                canvasBiz.UpdatefpStatus(uid, 1);
                                //canvBiz.UpdateTempPwd(txtmailid.Text, temppass);

                            }
                        }
                        else
                        {
                            maillbl.Visible = true;
                            maillbl.Text = " Invalid Email Id /Please Check Email Id Again.";
                            CodeNumberTextBox.Text = "";
                            this.Session["CaptchaImageText"] = GenerateRandomCode();
                            errorlblsecurity.Text = string.Empty;
                        }
                    }
                    else
                    {
                        errorlblsecurity.Style.Add("display", "block");
                        errorlblsecurity.Text = "The Characters Doesn't Match. Please Try Again.";
                        CodeNumberTextBox.Text = "";
                        errorlblsecurity.Focus();
                    }

                }
            }

            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }
Example #11
0
        protected void btnPageSelect_Click(object sender, EventArgs e)
        {
            try
            {

                DataTable dtNewPages = new DataTable();
                DataColumn[] dcPage = new DataColumn[3];

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

                dtNewPages = (DataTable)(Cache["PageDetails"]);

                DataView dv;
                dv = new DataView((DataTable)(Cache["PageDetails"]));
                dv.RowFilter = "pname= '" + ddlPageSelect.SelectedItem.ToString() + "'";

                //fetch the custom tab name
                FacebookBizProcess fbBiz = new FacebookBizProcess();
                string custTabName = fbBiz.GetCustomTabName(SessionData.Config.AppID);
                StringBuilder _sbPostToWallPostData = new StringBuilder();
                _sbPostToWallPostData.Append("custom_name=" + custTabName);

                string pagetab = "https://graph.facebook.com/" + dv[0]["pid"].ToString().Replace("\"", "") + "/tabs?method=POST&app_id=" + SessionData.Config.AppID + "&access_token=" + ddlPageSelect.SelectedValue.ToString().Replace("\"", "");
                FaceBook fabo = new FaceBook();
                fabo.CallWebRequest("POST", pagetab, _sbPostToWallPostData.ToString());

                //generate URL for page tab
                //string pageName = CallPageTabs(dv[0]["pid"].ToString());
                StringBuilder oSBAppPath = new StringBuilder();
                oSBAppPath.Append("https://www.facebook.com/pages/");
                oSBAppPath.Append(ddlPageSelect.SelectedItem.ToString() + "/");
                oSBAppPath.Append(dv[0]["pid"].ToString() + "/");
                oSBAppPath.Append("?sk=app_" + SessionData.Config.AppID);
                lblResult.Text = "Campaign uploaded. Click";

                if (SessionData.UserAction.TaskComplete.Equals("M"))
                {
                    lblInformation.Text = "Your Microsite has been processed ! Please find the details in your Email inbox.";
                }
                else if (SessionData.UserAction.TaskComplete.Equals("Y"))
                {
                    lblInformation.Text = "Your Microsite has been processed ! Please find the details in your Email inbox.";
                }
                else
                {
                    lblInformation.Text = string.Empty;
                }
                fbBiz.UpdateAppPagePath(oSBAppPath.ToString(), SessionData.Config.AppID, dv[0]["pid"].ToString());
                linkToCamp.HRef = oSBAppPath.ToString();
                tblPageSelect.Visible = false;
                tblResult.Visible = true;
                if (bEnableTwitter == true)
                {
                    tblTweet.Visible = true;
                }
                //Response.Redirect("CanvasArea.aspx?CDID=" + SessionData.Customer.CustomerID+"&pageSelected=T&TID=0",true);

            }
            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);

            }
        }
Example #12
0
        private Dictionary<string, string> GetAccessToken(string code, string scope, string redirectUrl, string appID, string appSecret)
        {
            string url = string.Empty;
            try
            {
                Dictionary<string, string> tokens = new Dictionary<string, string>();
                string clientId = appID;
                string clientSecret = appSecret;
                url = string.Format("https://graph.facebook.com/oauth/access_token?client_id=" + appID + "&redirect_uri=" + redirectUrl + "&client_secret=" + appSecret + "&code=" + code + "&scope=" + scope,
                                clientId, redirectUrl, clientSecret, code, scope);
                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    string retVal = reader.ReadToEnd();

                    foreach (string token in retVal.Split('&'))
                    {
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }
                return tokens;
            }
            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);
            }

            return GetAccessToken(code, scope, redirectUrl, appID, appSecret);
        }
Example #13
0
        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);
            }
        }
        protected void imgPromo_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID))
                {
                    Response.Redirect("CanvasAreaPromoTwo.aspx?CDID=" + SessionData.Customer.CustomerID + "&TID=5", false);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You have used up 4 free Campaigns OR your trial period has expired! Please contact [email protected]\")", true);
                }
            }
            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);

            }
        }
Example #15
0
        public string CallWebRequest(string Method, string Url, string PostData)
        {
            try
            {
                string ResponseString = "";

                // setup request object
                HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(Url);
                Request.Method = Method;
                Request.ServicePoint.Expect100Continue = false;
                Request.UserAgent = "soNET";
                Request.Timeout = 20000;

                // add post data
                if (Method == "POST")
                {
                    Request.ContentType = "application/x-www-form-urlencoded";
                    Stream RequestStream = Request.GetRequestStream();
                    if (RequestStream != null)
                    {
                        StreamWriter RequestWriter = new StreamWriter(RequestStream);
                        RequestWriter.Write(PostData);
                        RequestWriter.Close();
                    }
                }

                WebResponse Response = Request.GetResponse();
                if (Response != null)
                {
                    System.IO.Stream Stream = Response.GetResponseStream();
                    if (Stream != null)
                    {
                        StreamReader Reader = new StreamReader(Stream);
                        ResponseString = Reader.ReadToEnd();
                        Reader.Close();
                        Stream.Close();
                    }
                }

                return ResponseString;
            }
            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);
            }
            return string.Empty;
        }
Example #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             canvBiz = new CanvasBizProcess();
             if (Request.QueryString["nu"] != null && Request.QueryString["nu"].Contains("1"))
             {
                 if (Request.QueryString["nu"].Contains("1") && Request.QueryString["id"] != null)
                 {
                     // Check if user is using the same link again to reset his password
                     id = HttpUtility.UrlDecode(CommonUtility.Decrypt(Request["id"].ToString()));
                     int fpStatus = canvBiz.ConfirmResetPassword(id.TrimStart(' ').TrimEnd(' '));
                     if (fpStatus != 0)
                     {
                         newFrm.Attributes.Add("style", "display:block");
                     }
                     else
                     {
                         newFrm.Attributes.Add("style", "display:none");
                         lblLoginuser.Visible = true;
                         lblLoginuser.Text = "This link is expired.";
                     }
                 }
             }
             else
             {
                 lblLoginuser.Visible = true;
                 lblLoginuser.Text = "Oops !!! Something went wrong.";
             }
         }
     }
     catch (Exception ex)
     {
         DigiMa.Common.CommonUtility objCommon = new CommonUtility();
         objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
     }
 }
Example #17
0
        public int MailTrigger(string txtmailid)
        {
            try
            {
                string uid = canvBiz.GetCustId(txtmailid);
                AppCustomer oAppCustomer = new AppCustomer();
                oAppCustomer = canvBiz.GetCustomerInfo(txtmailid, uid, false);
                MailMessage mail = new MailMessage();
                //string adminid = txtmailid;
                string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"];
                string admpass = "******";// ConfigurationManager.AppSettings["userpassword"];
                System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);
                mail.From = new MailAddress(adminid);//TODO: Put actual sender email address
                mail.To.Add(new MailAddress(txtmailid));
                mail.Subject = "Reset your sonetreach password";    // Mail Subject
                mail.IsBodyHtml = true;
                mail.Priority = MailPriority.High; //Mail Priority

                StringBuilder strBody = new StringBuilder();

                strBody.Append("<div><center><table border=\"2px black\" width=\"800px\" style=\"height:200px;\">");
                strBody.Append("<tr><td style=\"background-color: #8BCD98; height: 40px; width: 400px;\">");
                strBody.Append("<center><span style=\"color: #0D6DA0; font-family: Verdana; font-size: large;\">");
                strBody.Append("SONETREACH");
                strBody.Append("</span></center></td></tr><tr><td>");
                strBody.Append("<span style=\"font-family: Verdana;\">");
                strBody.Append("<br/>");
                strBody.Append("Hello");
                strBody.Append("<br>");
                strBody.Append("<br>");
                strBody.Append("You recently asked for your SONETREACH Password.To complete your request, Please follow this link to reset your password.<br /><br/>");

                strBody.Append("https://www.sonetreach.com/Reset_Password.aspx?fp=1&id=" + HttpUtility.UrlEncode(CommonUtility.Encrypt(uid)) + "");
                strBody.Append("<br><br>");
                strBody.Append("User Name: &nbsp;");
                strBody.Append(txtmailid);
                strBody.Append("<br><br>");
                strBody.Append("<br><br><br>");
                strBody.Append("Thanks,");
                strBody.Append("<br><br>");
                strBody.Append("DigiMa Team");
                strBody.Append("</span></td></tr></tr></table></center></div>");

                mail.Body = strBody.ToString();
                SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                mSMTPClient.EnableSsl = false;
                mSMTPClient.UseDefaultCredentials = true;
                mSMTPClient.Credentials = auth;
                mSMTPClient.Port = 25; // PORT NUMBER
                mSMTPClient.Host = "smtpauth.net4india.com";
                mSMTPClient.Send(mail);
                return 1;
            }
            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
            return 0;
        }
Example #18
0
        protected override void OnPreLoad(EventArgs e)
        {
            string PDID = string.Empty;
            string NDID = string.Empty;
            string ADID = string.Empty;
            string UDID = string.Empty;
            string NTYP = string.Empty;
            string user_id = string.Empty;
            string TO_id = string.Empty;
            try
            {
                base.OnPreLoad(e);
                //Initialize KOKO
                SonetPie osonetpie = new SonetPie();
                osonetpie.QSvarsString = GetQsVarsCollection();
                osonetpie.AbsolutePath = AbsolutePagePath;

                //Call Service to load app settings
                AppUser oAppUser = new AppUser();
                AppLeadData oAppLead = new AppLeadData();
                FacebookBizProcess ofbBiz = new FacebookBizProcess();
                SonetPieBizProcess sonetpiebiz = new SonetPieBizProcess();

                //CHeck if User has Liked. Using Jquery AJAX we will get Params in Request.Form
                if (Request.HttpMethod == "POST")
                {
                    PDID = Request.Form["PDID"];
                    NDID = Request.Form["NDID"];
                    ADID = Request.Form["ADID"];
                    UDID = Request.Form["UDID"];
                    NTYP = Request.Form["NTYP"];
                    user_id = Request.Form["user_id"];

                    oAppUser = ofbBiz.GetAppUser(osonetpie, ADID, user_id);

                    if (NTYP != null && UDID != null && PDID != null)
                    {
                        if (ofbBiz.RaiseAppNotifier(oAppUser, NTYP, UDID, PDID, NDID, oAppLead, string.Empty))
                            litRunTimeHTMLContent.Text = "Successfully raised notifier.";
                        else
                            litRunTimeHTMLContent.Text = "Unable to raise notifier.";
                    }
                    else litRunTimeHTMLContent.Text = "In-Complete information.";
                }
                else
                {
                    if (QSVars["NTYP"].ToString().Equals("MPOST"))
                    {
                        if (!QSVars.Contains("UDID"))
                        {
                            UDID = ofbBiz.GetUserDID(QSVars["ADID"].ToString(), Request["userID"].ToString());
                            if (Request.Cookies.AllKeys[0] != null)
                            {
                                TO_id = Request.Cookies.AllKeys[0];
                                if (TO_id.Contains(","))
                                {
                                    string[] allFriends = TO_id.Split(',');
                                    for (int i = 0; i < allFriends.Length; i++)
                                    {
                                        if (ofbBiz.RaiseAppNotifier(oAppUser, Convert.ToString(QSVars["NTYP"]), UDID, Convert.ToString(QSVars["PDID"]), "", oAppLead, allFriends[i]))
                                            litRunTimeHTMLContent.Text = "Successfully raised notifier.";
                                        else
                                            litRunTimeHTMLContent.Text = "Unable to raise notifier.";
                                    }
                                }
                                else
                                {
                                    if (ofbBiz.RaiseAppNotifier(oAppUser, Convert.ToString(QSVars["NTYP"]), UDID, Convert.ToString(QSVars["PDID"]), "", oAppLead, TO_id))
                                        litRunTimeHTMLContent.Text = "Successfully raised notifier.";
                                    else
                                        litRunTimeHTMLContent.Text = "Unable to raise notifier.";
                                }
                            }
                        }

                        if (ofbBiz.RaiseAppNotifier(oAppUser, Convert.ToString(QSVars["NTYP"]), UDID, Convert.ToString(QSVars["PDID"]), "", oAppLead, TO_id))
                            litRunTimeHTMLContent.Text = "Successfully raised notifier.";
                        else
                            litRunTimeHTMLContent.Text = "Unable to raise notifier.";

                    }
                    else
                    {
                        bool CheckLikeNotify = ofbBiz.CheckLikeNotify(QSVars["UDID"].ToString());
                        if (CheckLikeNotify != true)
                        {
                            oAppUser = ofbBiz.GetAppUser(osonetpie, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());

                            //Load AppUser from DB Based on user_id
                            if (QSVars.Contains("NTYP") && QSVars.Contains("UDID") && QSVars.Contains("PDID"))
                            {
                                if (ofbBiz.RaiseAppNotifier(oAppUser, Convert.ToString(QSVars["NTYP"]), Convert.ToString(QSVars["UDID"]), Convert.ToString(QSVars["PDID"]), Convert.ToString(QSVars["NDID"]), oAppLead, string.Empty))
                                    litRunTimeHTMLContent.Text = "Successfully raised notifier.";
                                else
                                    litRunTimeHTMLContent.Text = "Unable to raise notifier.";
                            }
                            else litRunTimeHTMLContent.Text = "In-Complete information.";
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                DigiMa.Common.CommonUtility objCommon = new CommonUtility();
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
            }
        }
Example #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //divBackBtn.Attributes.Add("style","display:block");
     try
     {
         if (!IsPostBack)
         {
             this.Session["CaptchaImageText"] = GenerateRandomCode();
             errorlblsecurity.Style.Add("display", "none");
             CodeNumberTextBox.Text = "";
             //tdLogin.Visible = false;
             //tdSignup.Visible = false;
         }
         else
         {
             if (this.CodeNumberTextBox.Text.TrimStart(' ').TrimEnd(' ') == this.Session["CaptchaImageText"].ToString())
             {
                 flag = true;
             }
             else
             {
                 //wrong
                 this.Session["CaptchaImageText"] = GenerateRandomCode();
             }
         }
         txtmailid.Focus();
     }
     catch (Exception ex)
     {
         CommonUtility objCommon = new CommonUtility();
         objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), "");
     }
 }
Example #20
0
        private void Page_PreRender(object sender, System.EventArgs e)
        {
            try
            {

                if (AppConfig != null)
                {

                    //Initialize Facebook JS ScriptsSonetReach
                    Literal oLitJavaScript = new Literal();
                    Control oMainJavaScriptContent = this.Controls[0].FindControl("MainJavaScriptContent");
                    if (oMainJavaScriptContent != null) oMainJavaScriptContent.Controls.Add(oLitJavaScript);
                }
            }
            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);
            }
        }
Example #21
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            //Initialize API Core
            FaceBook oFacebook = new FaceBook();

            //Initialize KOKO
            SonetPie osonetpie = new SonetPie();
            QSVars.Add("NTYP", "LEAD");
            osonetpie.QSvarsString = GetQsVarsCollection();
            osonetpie.AbsolutePath = AbsolutePagePath;

            //Load app settings

            oDCAppUser = fbBizProc.GetAppUser(osonetpie, QSVars["ADID"].ToString(), QSVars["user_id"].ToString());

            oAppProduct = fbBizProc.GetAppProductDetails(osonetpie, QSVars["PDID"].ToString());

            //get Inquiry Email if exists
            //fetch Inmquiry EMAIL data
            string inquiryEmail;
            inquiryEmail = fbBizProc.GetInquiryEmail(Convert.ToString(QSVars["ADID"]));

            //Bind Post content at runtime
            if (oAppProduct.DID.Equals("AP006KV63YSPT0ZDHTMD"))
            {
                txtLeadContent.Text = "I am interested to know more on this event.";
            }
            else if (oAppProduct.DID.Equals("AP000CH69W22X9KDGZTT") || oAppProduct.DID.Equals("AP001CS762FRSC4BPCV3") || oAppProduct.DID.Equals("AP005S976CL8C85Y2HV5") || oAppProduct.DID.Equals("AP002PX605GMMMG9MQ59"))
            {
                txtLeadContent.Text = "I am interested to know more on this product.";
            }
            lblProductSummary.Text = GetProductSummary();

            //Prefill product context
            if (oAppProduct != null)
            {
                if (oAppProduct.DID.Equals("AP006KV63YSPT0ZDHTMD"))
                {
                    txtLeadContext.Text = oAppProduct.ProductName + " event inquiry";
                }
                else if (oAppProduct.DID.Equals("AP000CH69W22X9KDGZTT") || oAppProduct.DID.Equals("AP001CS762FRSC4BPCV3") || oAppProduct.DID.Equals("AP005S976CL8C85Y2HV5") || oAppProduct.DID.Equals("AP002PX605GMMMG9MQ59"))
                {
                    txtLeadContext.Text = oAppProduct.ProductName + " product inquiry";
                }
            }
            else
                txtLeadContext.Text = "product inquiry";

            //Prefill Email id
            if (!string.IsNullOrEmpty(inquiryEmail)) txtLeadEmailID.Text = oDCAppUser.EmailID;

            //Clear Error text
            lblValidationSummary.Text = string.Empty;

            //Perform Post to wall friends & Store notifierDID stat
            if (this.IsPostBack && oAppProduct != null && AppCustomer != null && AppConfig != null)
            {
                if (FormVars.Contains("BtnSubmit"))
                {
                    if (Convert.ToString(FormVars["txtLeadEmailID"]).Trim().Length <= 0) Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Specify email id.\")", true);
                    else if (Convert.ToString(FormVars["txtLeadContext"]).Trim().Length <= 0) lblValidationSummary.Text = "Specify email subject.";
                    else if (Convert.ToString(FormVars["txtLeadContent"]).Trim().Length <= 0) lblValidationSummary.Text = "Specify email content.";
                    else
                    {
                        AppLeadData oAppLeadData = new AppLeadData();
                        oAppLeadData.EmailID = Convert.ToString(FormVars["txtLeadEmailID"]);
                        oAppLeadData.Subject = Convert.ToString(FormVars["txtLeadContext"]);
                        oAppLeadData.Body = Convert.ToString(FormVars["txtLeadContent"]);
                        string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
                        if (QSVars.Contains("NDID"))
                            QSVars["NDID"] = _sNotifierDID;
                        else
                            QSVars.Add("NDID", _sNotifierDID);
                        if (fbBizProc.RaiseAppNotifier(oDCAppUser, "LEAD", QSVars["UDID"].ToString(), QSVars["PDID"].ToString(), QSVars["NDID"].ToString(), oAppLeadData, string.Empty))
                        {
                            //Now send email
                            CommonUtility comUtil = new CommonUtility();
                            custTabName = fbBizProc.GetCustomTabName(Convert.ToString(QSVars["app_id"]));
                            comUtil.SendEnquiryMail(inquiryEmail, oAppLeadData.Subject, oAppLeadData.Body, custTabName, oAppProduct,oDCAppUser.EmailID);

                            Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true);
                        }
                    }
                }
            }

            //Set error message section
            if (!string.IsNullOrEmpty(lblValidationSummary.Text)) trErrorMsg.Visible = true; else trErrorMsg.Visible = false;
        }