예제 #1
0
        protected void btnPrint(object sender, EventArgs e)
        {
            //Initialize API Core
            FaceBook oFacebook = new FaceBook();

            //Initialize KOKO
            SonetPie osonetpie = new SonetPie();
            osonetpie.QSvarsString = GetQsVarsCollection();
            osonetpie.AbsolutePath = AbsolutePagePath;

            string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
            if (QSVars.Contains("NDID"))
                QSVars["NDID"] = _sNotifierDID;
            else
                QSVars.Add("NDID", _sNotifierDID);
            //Load app settings

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

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

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

            ofbBiz.RaiseAppNotifier(oDCAppUser, "PRINT", Convert.ToString(QSVars["UDID"]), Convert.ToString(QSVars["PDID"]), Convert.ToString(QSVars["NDID"]));
        }
예제 #2
0
        public bool UpdateStatus(string token, string SecretKey)
        {
            try
            {
                var consumerKey = ConfigurationManager.AppSettings["TwitterConsumerKey"];
                var consumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"];
                string ADID = Request.QueryString["ADID"];

                OAuthTokens accessToken = new OAuthTokens();
                accessToken.AccessToken = token;
                accessToken.AccessTokenSecret = SecretKey;
                accessToken.ConsumerKey = consumerKey;
                accessToken.ConsumerSecret = consumerSecret;

                string postcontent = "Tweeted via " + ofbBiz.GetAppPath(Convert.ToString(Request.QueryString["app_id"]));

                // string postcontent = "Tweeted via " + ofbBiz.GetAppPath(Convert.ToString(Request.QueryString["app_id"]));

                TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Update(accessToken, postcontent);
                if (tweetResponse.Result == RequestResult.Success)
                {
                    //Tweeted Successfully
                    SonetPie osonetpie = new SonetPie();
                    AppLeadData oAppLeadData = new AppLeadData();
                    AppProduct dAppproduct = new AppProduct();
                    dAppproduct = ofbBiz.GetAppProduct(ADID);
                    string PDID = dAppproduct.DID;

                    string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
                    string NDID = _sNotifierDID;
                    //Load app settings

                    oDCAppUser = ofbBiz.GetAppUser(osonetpie, ADID, SessionData.TwitterData.CachedUserId1);

                    oAppProduct = ofbBiz.GetAppProductDetails(osonetpie, PDID);

                    ofbBiz.RaiseAppNotifier(oDCAppUser, "TWEET", oDCAppUser.DID, PDID, NDID, oAppLeadData, string.Empty);

                }
                else
                {
                    // Something bad happened
                }
                return true;
            }
            catch (Exception ex)
            {

            }
            return false;
        }
예제 #3
0
        public AppProduct GetAppProductDetails(SonetPie osonetpie, string PDID)
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                DataSet dsFinalHTML = new DataSet();

                dsFinalHTML = oDBH.FillData_SP("GetAppProductDetails");
                if (dsFinalHTML.Tables.Count > 0)
                {
                    AppProduct _oAppProduct = new AppProduct();
                    _oAppProduct.DID = dsFinalHTML.Tables[0].Rows[0]["DID"].ToString();
                    _oAppProduct.AppConfigDID = dsFinalHTML.Tables[0].Rows[0]["AppConfigDID"].ToString();
                    _oAppProduct.ProductCategory = dsFinalHTML.Tables[0].Rows[0]["ProductCategory"].ToString();
                    _oAppProduct.ProductName = dsFinalHTML.Tables[0].Rows[0]["ProductName"].ToString();
                    _oAppProduct.ProductLogo = HttpUtility.HtmlDecode(dsFinalHTML.Tables[0].Rows[0]["ProductLogo"].ToString());
                    _oAppProduct.ProductShortDesc = dsFinalHTML.Tables[0].Rows[0]["ProductShortDesc"].ToString();
                    _oAppProduct.ProductDesc = HttpUtility.HtmlDecode(dsFinalHTML.Tables[0].Rows[0]["ProductDesc"].ToString());
                    _oAppProduct.ProductHTML = HttpUtility.HtmlDecode(dsFinalHTML.Tables[0].Rows[0]["ProductHTML"].ToString());
                    _oAppProduct.ProductStatus = dsFinalHTML.Tables[0].Rows[0]["ProductStatus"].ToString();
                    _oAppProduct.Email = dsFinalHTML.Tables[0].Rows[0]["eMail"].ToString();
                    _oAppProduct.ShareWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["ShareWidgetAdded"].ToString();
                    _oAppProduct.ReccWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["ReccWidgetAdded"].ToString();
                    _oAppProduct.InquiryWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["InquiryWidgetAdded"].ToString();
                    _oAppProduct.CommentsWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["CommentsWidgetAdded"].ToString();
                    _oAppProduct.LikeGatewayAdded = dsFinalHTML.Tables[0].Rows[0]["LikeGatewayAdded"].ToString();
                    _oAppProduct.LikeWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["LikeWidgetAdded"].ToString();
                    _oAppProduct.CanvasHeight = dsFinalHTML.Tables[0].Rows[0]["AppCanvasHeight"].ToString();
                    _oAppProduct.CanvasWidth = dsFinalHTML.Tables[0].Rows[0]["AppCanvasWidth"].ToString();
                    _oAppProduct.AppCaption = dsFinalHTML.Tables[0].Rows[0]["AppCaption"].ToString();
                    return _oAppProduct;
                }
                else { return null; }
            }
            catch (Exception ex)
            {
                //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
                throw ex;
            }
        }
예제 #4
0
        public AppProduct GetAppProduct(string ADID)
        {
            //try
            //{
            //    DatabaseHandler oDBH = new DatabaseHandler();
            //    return oDBH.FillData_SP("GetAppProduct", osonetpie.QSvars["ADID"].ToString()).Tables[0];
            //}
            //catch (Exception ex)
            //{
            //    //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
            //    throw ex;
            //}
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                DataSet dsFinalHTML = new DataSet();

                dsFinalHTML = oDBH.FillData_SP("GetAppProduct", ADID);
                if (dsFinalHTML.Tables.Count > 0)
                {
                    AppProduct _oAppProduct = new AppProduct();
                    _oAppProduct.DID = dsFinalHTML.Tables[0].Rows[0]["DID"].ToString();
                    _oAppProduct.AppConfigDID = dsFinalHTML.Tables[0].Rows[0]["AppConfigDID"].ToString();

                    return _oAppProduct;
                }
                else { return null; }
            }
            catch (Exception ex)
            {
                //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
                throw ex;
            }
        }
예제 #5
0
 public AppProduct GetActiveAppProduct(SonetPie osonetpie, string ADID)
 {
     try
     {
         DatabaseHandler oDBH = new DatabaseHandler();
         DataSet dsFinalHTML = new DataSet();
         dsFinalHTML = oDBH.FillData_SP("GetActiveAppProduct", ADID);
         if (dsFinalHTML.Tables.Count > 0)
         {
             AppProduct oAppProduct = new AppProduct();
             oAppProduct.ProductHTML = dsFinalHTML.Tables[0].Rows[0]["producthtml"].ToString();
             oAppProduct.AppConfigDID = dsFinalHTML.Tables[0].Rows[0]["AppConfigDID"].ToString();
             oAppProduct.DID = dsFinalHTML.Tables[0].Rows[0]["DID"].ToString();
             oAppProduct.ProductStatus = dsFinalHTML.Tables[0].Rows[0]["ProductStatus"].ToString();
             oAppProduct.ProductName = dsFinalHTML.Tables[0].Rows[0]["ProductName"].ToString();
             oAppProduct.ShareWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["ShareWidgetAdded"].ToString();
             oAppProduct.CommentsWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["CommentsWidgetAdded"].ToString();
             oAppProduct.LikeWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["LikeWidgetAdded"].ToString();
             oAppProduct.LikeGatewayAdded = dsFinalHTML.Tables[0].Rows[0]["LikeGatewayAdded"].ToString();
             oAppProduct.InquiryWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["InquiryWidgetAdded"].ToString();
             oAppProduct.ReccWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["ReccWidgetAdded"].ToString();
             oAppProduct.AppCaption = dsFinalHTML.Tables[0].Rows[0]["AppCaption"].ToString();
             oAppProduct.CanvasHeight = dsFinalHTML.Tables[0].Rows[0]["AppCanvasHeight"].ToString();
             oAppProduct.CanvasWidth = dsFinalHTML.Tables[0].Rows[0]["AppCanvasWidth"].ToString();
             oAppProduct.SProductHeaderImage = dsFinalHTML.Tables[0].Rows[0]["ProductHeaderImage"].ToString();
             oAppProduct.SProductContentImage = dsFinalHTML.Tables[0].Rows[0]["ProductContentImage"].ToString();
             oAppProduct.SProductFooterImage = dsFinalHTML.Tables[0].Rows[0]["ProductFooterImage"].ToString();
             oAppProduct.TwitterWidgetAdded = dsFinalHTML.Tables[0].Rows[0]["TwitterWidgetAdded"].ToString();
             oAppProduct.SHeaderBannerImg = dsFinalHTML.Tables[0].Rows[0]["ProductBannerImage"].ToString();
             oAppProduct.SHeaderBannerURL = dsFinalHTML.Tables[0].Rows[0]["ProductBannerURL"].ToString();
             oAppProduct.ProductCategory = dsFinalHTML.Tables[0].Rows[0]["ProductCategory"].ToString();
             return oAppProduct;
         }
         else
         {
             return null;
         }
     }
     catch (Exception ex)
     {
         //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
         throw ex;
     }
 }
예제 #6
0
        public bool UpdateProductDetails(AppProduct oAppProduct)
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                StringBuilder _sbQuery = new StringBuilder();
                int i = oDBH.ExecuteNonQuery_SP("UpdateProductDetails", oAppProduct.DID,
                          oAppProduct.ProductCategory,
                          oAppProduct.ProductName,
                          oAppProduct.ProductLogo,
                          oAppProduct.ProductShortDesc,
                          oAppProduct.ProductDesc,
                          oAppProduct.ProductHTML,
                          "A",
                          oAppProduct.SProductContentImage,
                          oAppProduct.SProductHeaderImage,
                          oAppProduct.SProductFooterImage,
                          oAppProduct.SProductFooterURL, oAppProduct.ShareWidgetAdded, oAppProduct.LikeWidgetAdded, oAppProduct.ReccWidgetAdded, oAppProduct.CommentsWidgetAdded, oAppProduct.InquiryWidgetAdded, oAppProduct.LikeGatewayAdded, oAppProduct.CanvasHeight, oAppProduct.CanvasWidth, oAppProduct.AppCaption, oAppProduct.TwitterWidgetAdded, oAppProduct.SHeaderBannerImg, oAppProduct.SHeaderBannerURL);

                if (i < 0) return false; else return true;
            }
            catch (Exception ex)
            {
                //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
                throw ex;
            }
        }
예제 #7
0
        public bool SetNewProductDetails(AppProduct oAppProduct)
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                StringBuilder _sbQuery = new StringBuilder();
                int i = oDBH.ExecuteNonQuery_SP("SetNewProductDetails", oAppProduct.DID,
                         oAppProduct.AppConfigDID,
                          oAppProduct.ProductCategory,
                          oAppProduct.ProductName,
                          oAppProduct.ProductLogo,
                          oAppProduct.ProductShortDesc,
                          oAppProduct.ProductDesc,
                          oAppProduct.ProductHTML,
                          "A",
                          oAppProduct.SProductContentImage,
                          oAppProduct.SProductHeaderImage,
                          oAppProduct.SProductFooterImage,
                          oAppProduct.SProductFooterURL, oAppProduct.ShareWidgetAdded, oAppProduct.LikeWidgetAdded, oAppProduct.ReccWidgetAdded, oAppProduct.CommentsWidgetAdded, oAppProduct.InquiryWidgetAdded, oAppProduct.LikeGatewayAdded, oAppProduct.CanvasHeight, oAppProduct.CanvasWidth, oAppProduct.AppCaption, oAppProduct.TwitterWidgetAdded, oAppProduct.SHeaderBannerImg, oAppProduct.SHeaderBannerURL);

                if (i < 0) return false; else return true;
            }
            catch (Exception ex)
            {
                objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Product.DID);
                throw ex;
            }
        }
예제 #8
0
 public bool UpdateProductDetails(AppProduct oAppProduct)
 {
     try
     {
         return fbDALC.UpdateProductDetails(oAppProduct);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
        public bool InsertFinalHTML(AppProduct oAppProduct)
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();
                if (oDBH.ExecuteNonQuery_SP("InsertFinalHTML", oAppProduct.AppConfigDID, oAppProduct.ProductHTML, oAppProduct.DID) > 0)
                {

                    DatabaseHandler oDBHProd = new DatabaseHandler();
                    StringBuilder oSBQueryPRod = new StringBuilder();
                    oSBQueryPRod.Append("Update [AppProduct] set PRoductHTML='" + oAppProduct.ProductHTML + "'");
                    oSBQueryPRod.Append("where DID='" + oAppProduct.DID + "'");
                    if (oDBHProd.ExecuteNonQuery(oSBQueryPRod.ToString()) > 0) return true; else return false;
                }
                //Now insert this FetchFinalHTML to AppProduct too!
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #10
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);
            }
        }
예제 #11
0
        private string GetNotifyLIKE(string sProductID)
        {
            string _sAppPathLink = ofbBiz.GetAppPagePath(QSVars["app_id"].ToString());
            string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
            if (!_sAppPathLink.EndsWith("?")) _sAppPathLink += "&";
            //Build NotifierDID & pass it to link
            _sAppPathLink += "NDID=" + _sNotifierDID;
            AppProduct oAppProduct = new AppProduct();
            StringBuilder sbNotifyLIKE = new StringBuilder();
            sbNotifyLIKE.Append("<script>" + Environment.NewLine);
            sbNotifyLIKE.Append("$(\"document\").ready(function () {" + Environment.NewLine);
            //catch like event
            sbNotifyLIKE.Append("FB.Event.subscribe('edge.create', function (href, widget) {" + Environment.NewLine);
            sbNotifyLIKE.Append("AsycRequest('" + GetNavigationURL("https://www.testsonetreach.com/FBNotify.aspx?NTYP=LIKE&PDID=" + sProductID + "&NDID=" + _sNotifierDID, true) + "');" + Environment.NewLine);
            sbNotifyLIKE.Append("});" + Environment.NewLine);
            //catch unlike event
            sbNotifyLIKE.Append("FB.Event.subscribe('edge.remove', function (href, widget) {" + Environment.NewLine);
            //sbNotifyLIKE.Append("alert('You just unliked ' + href);" + Environment.NewLine);
            sbNotifyLIKE.Append("});" + Environment.NewLine);
            sbNotifyLIKE.Append("});" + Environment.NewLine);
            sbNotifyLIKE.Append("</script>" + Environment.NewLine);

            return sbNotifyLIKE.ToString();
        }
예제 #12
0
        public void SendEnquiryMail(string toEmailID, string subject, string body, string tabName, AppProduct oAppProduct, string fromEmailID)
        {
            try
            {
                if (!string.IsNullOrEmpty(fromEmailID))
                {
                    MailMessage mail = new MailMessage();
                    //string adminid = txtmailid;
                    string adminid = "*****@*****.**";
                    string admpass = "******";

                    System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass);

                    mail.From = new MailAddress(fromEmailID); //AppUser email

                    mail.To.Add(new MailAddress(toEmailID)); //Inquiry Email
                    mail.Subject = subject;  // 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: Black; height: 40px; width: 400px;\">");
                    strBody.Append("<center><span style=\"color: Red; font-family: Verdana; font-size: large;\">");
                    strBody.Append("Enquiry for " + tabName);
                    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(body);
                    strBody.Append("<br>");
                    strBody.Append("<br>");
                    strBody.Append("Sent By: " + toEmailID);

                    strBody.Append("</span></td></tr></tr></table></center></div>");

                    mail.Body = strBody.ToString();
                    SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25);
                    mSMTPClient.UseDefaultCredentials = true;
                    mSMTPClient.EnableSsl = false;
                    mSMTPClient.Credentials = auth;

                    mSMTPClient.Send(mail);
                }
            }
            catch (Exception ex)
            {
                SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID);
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //litOGTags.Text = GetOGMetaTags();
            NotifyURL = ConfigurationSettings.AppSettings["NotifyURL"];

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

            if (Request["uID"] != null)
            {
                userID = Request["uID"].ToString();
            }
            if (Request["app_id"] != null)
            {
                app_id = Request["app_id"].ToString();
            }
            litEnableFBJS.Text = GetInitializedJS();
            //string id = hdnUserID.Value;
            FaceBook facebook = new FaceBook();

            if (!string.IsNullOrEmpty(access_tok))
            {
                oDCAppUser = facebook.GetUserDetail(userID, access_tok, oDCAppUser);
            }

            oDCAppUser.AppConfigDID = fbBiz.GetConfigDEED(app_id);
            ADID = oDCAppUser.AppConfigDID;
            //Now INSERT User details to AppUser table
            if (Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("android"))
            {
                oDCAppUser.SonetSRC = MOBILE_USER;
            }
            else
            {
                oDCAppUser.SonetSRC = TAB_USER;
                if (Request.UserAgent.ToLower().Contains("ipad"))
                {
                    //modify css to suit width

                }
            }

            if (string.IsNullOrEmpty(oDCAppUser.SonetID))
            {
                oDCAppUser.SonetID = userID;
            }

            if (!fbBiz.IsAppUserExistMobile(oDCAppUser))
            {
                if (fbBiz.SetAppUserAuthorize(oDCAppUser, ADID)) //
                {
                }
            }

            bool ISPageLiked;
            if (!string.IsNullOrEmpty(access_tok))
            {
                ISPageLiked = facebook.IsPageLiked("314911595222628", access_tok);
            }
            else
            {
                ISPageLiked = false;
            }

            //show HTML, LIKE gatewat
            if (!fbBiz.IsLikeGatewayAdded(app_id)) // If Already liked show page else Force user to like, iff like gateway was selected
            {

                SessionData.Config = new AppConfiguration();
                SessionData.Config.DID = fbBiz.GetConfigDEED(app_id);
                //check if configuration is still good- that means not EXPIRED
                if (!fbBiz.IsConfigurationExpired(SessionData.Config.DID))
                {
                    //populate the AppProduct encapsulation based on app that is loaded
                    AppProduct oAppProduct = new AppProduct();

                    oAppProduct = fbBiz.GetActiveAppProduct(osonetpie, SessionData.Config.DID);
                    string HTML = oAppProduct.ProductHTML;

                    //Get Custom Tab name
                    string CustTabNAme = fbBiz.GetCustomTabName(app_id);

                    //Get Share Button for this Product
                    string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id, fbBiz.GetAppPagePath(app_id));
                    string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id, CustTabNAme);
                    string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    string RecommendButton = GetRecommendButtonForMobile(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    //string TwitterButton = GetTwitterShareURL(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                    // Get the HTML to be shown
                    if (!oAppProduct.ProductCategory.Equals("WebHutColl."))
                    {

                        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.ReccWidgetAdded.Equals(TRUE))
                        {
                            if (canv.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                            {
                                addCaption = addSHARE.Replace("ReButton", InviteButton);
                            }
                            else
                            {
                                addCaption = addSHARE.Replace("ReButton", RecommendButton);
                            }
                        }
                        else
                        {
                            addCaption = addSHARE.Replace("ReButton", "");
                        }

                        addLead = addCaption.Replace("Lead", "");
                        addLIKE = addLead.Replace("Like", LikePlugin);
                        addPOST = addLIKE.Replace("Caption", oAppProduct.AppCaption);
                        addTwitter = addPOST.Replace("TwButton", "");

                        litHTML.Text = addTwitter;
                    }
                    else
                    {
                        headRow.Style.Remove("background-color");
                        mainRow.Style.Remove("background-color");
                        //render Webhut template

                        SiteID = fbBiz.GetSiteIDForConfig(Convert.ToString(ADID));
                        SessionData.Config = new AppConfiguration();
                        SessionData.Config.SSiteID = SiteID;
                        int TemplateID = fbBiz.GetTemplateIDForConfig(Convert.ToString(ADID));

                        pageToLoad = "index.html";
                        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\">", "");

                            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\" />", "");
                            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";

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

                            SessionData.PrefData.TemplateID1 = TemplateID;
                        }
                        else if (TemplateID == 14)
                        {
                            style = "/css/realestate_styles.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("facebookIDStyleSheets") 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;

                        litHTML.Text = imagesReplaced;

                        if (TemplateID == 13)
                        {
                            litHTML.Text = litHTML.Text.Replace("<link href=\"CSS/FabrikStyle.css\" rel=\"stylesheet\" type=\"text/css\">", "");
                        }
                        else if (TemplateID == 11)
                        {
                            litHTML.Text = litHTML.Text.Replace("<link href=\"CSS/CouponsStyle.css\" rel=\"stylesheet\" type=\"text/css\" />", "");
                        }
                    }
                }
            }
            else
            {
                if (ISPageLiked)
                {
                    SessionData.Config = new AppConfiguration();
                    SessionData.Config.DID = fbBiz.GetConfigDEED(app_id);
                    //check if configuration is still good- that means not EXPIRED
                    if (!fbBiz.IsConfigurationExpired(SessionData.Config.DID))
                    {
                        //populate the AppProduct encapsulation based on app that is loaded
                        AppProduct oAppProduct = new AppProduct();

                        oAppProduct = fbBiz.GetActiveAppProduct(osonetpie, SessionData.Config.DID);
                        // Get the HTML to be shown

                        string HTML = oAppProduct.ProductHTML;

                        //Get Custom Tab name
                        string CustTabNAme = fbBiz.GetCustomTabName(app_id);

                        //Get Share Button for this Product
                        string CommentBox = GetCommentPlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id, fbBiz.GetAppPagePath(app_id));
                        string ShareButton = GetShareButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id, CustTabNAme);
                        string InviteButton = GetInviteButton(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                        string RecommendButton = GetRecommendButtonForMobile(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                        string LikePlugin = GetLikePlugin(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, app_id);
                        //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["AppID"].ToString());
                        //string PrintButton = GetPrint(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["AppID"].ToString());
                        //string EmailButton = GetEmail(oAppProduct.DID, oAppProduct.ProductName, oAppProduct.ProductLogo, oAppProduct.ProductShortDesc, QSVars["AppID"].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.ReccWidgetAdded.Equals(TRUE))
                        {
                            if (canv.IsConfigForSweepstakes(oAppProduct.AppConfigDID))
                            {
                                addCaption = addSHARE.Replace("ReButton", InviteButton);
                            }
                            else
                            {
                                addCaption = addSHARE.Replace("ReButton", RecommendButton);
                            }
                        }
                        else
                        {
                            addCaption = addSHARE.Replace("ReButton", "");
                        }

                        addLead = addCaption.Replace("Lead", "");
                        addLIKE = addLead.Replace("Like", LikePlugin);
                        addPOST = addLIKE.Replace("Caption", oAppProduct.AppCaption);
                        addTwitter = addPOST.Replace("TwButton", "");
                        litHTML.Text = addTwitter;
                    }
                    else
                    {
                        litHTML.Text = "Oops! Looks like your aplication expired. Please buy credits to continue.";
                    }
                }
                else
                {
                    if ((Request.QueryString.Count == 1 && Request.QueryString["app_id"] != null) || (!string.IsNullOrEmpty(access_tok)))
                    {
                        //string pagePath = fbBiz.GetAppPath(Request["app_id"].ToString());
                        //Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.parent.location.href='" + pagePath + "'", true);
                    }
                    else
                    {
                        litHTML.Text = " <div class=\"fb-like\" data-href=\"https://www.testsonetreach.com/MobileRedirect.aspx?app_id=295889527140091\" data-send=\"false\" data-width=\"400\" data-show-faces=\"true\"></div>";
                    }
                }
            }
        }
예제 #14
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            SonetPie osonetpie = new SonetPie();

            osonetpie.QSvarsString = GetQsVarsCollection();
            osonetpie.AbsolutePath = AbsolutePagePath;
            string _sNotifierDID = new AppNotifier().GetNewDIDWithPrefix();
            if (QSVars.Contains("NDID"))
                QSVars["NDID"] = _sNotifierDID;
            else
                QSVars.Add("NDID", _sNotifierDID);
            //Load app settings

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

            oAppProduct = ofbBiz.GetAppProductDetails(osonetpie, QSVars["PDID"].ToString());
            SendCouponEmail();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true);
            ofbBiz.RaiseAppNotifier(oDCAppUser, "EMAIL", Convert.ToString(QSVars["UDID"]), Convert.ToString(QSVars["PDID"]), Convert.ToString(QSVars["NDID"]));
        }
예제 #15
0
        public AppProduct GetAppProductDetails()
        {
            try
            {
                DatabaseHandler oDBH = new DatabaseHandler();

                DataTable oAppCustDataTableOne = oDBH.FillData_SP("GetAppProductDetails").Tables[0];

                /*NOW FETCH PRODUCT DETAIL*/

                string sqlQuery = "select top 1 DID,AppConfigDID,ProductCategory,ProductName,ProductLogo,ProductShortDesc,ProductDesc,ProductHTML,ProductStatus,ShareWidgetAdded,LikeWidgetAdded,ReccWidgetAdded,CommentsWidgetAdded,InquiryWidgetAdded,LikeGatewayAdded,AppCanvasHeight,AppCanvasWidth,AppCaption,TwitterWidgetAdded,ProductBannerImage,ProductBannerURL from AppProduct with (nolock) where DID='" + oAppCustDataTableOne.Rows[0]["DID"].ToString() + "'";

                DataTable oAppCustDataTable = oDBH.FillData(sqlQuery).Tables[0];
                if (oAppCustDataTable != null)
                {
                    AppProduct _oAppProduct = new AppProduct();
                    _oAppProduct.DID = oAppCustDataTable.Rows[0]["DID"].ToString();
                    _oAppProduct.AppConfigDID = oAppCustDataTable.Rows[0]["AppConfigDID"].ToString();
                    _oAppProduct.ProductCategory = oAppCustDataTable.Rows[0]["ProductCategory"].ToString();
                    _oAppProduct.ProductName = oAppCustDataTable.Rows[0]["ProductName"].ToString();
                    _oAppProduct.ProductLogo = HttpUtility.HtmlDecode(oAppCustDataTable.Rows[0]["ProductLogo"].ToString());
                    _oAppProduct.ProductShortDesc = oAppCustDataTable.Rows[0]["ProductShortDesc"].ToString();
                    _oAppProduct.ProductDesc = HttpUtility.HtmlDecode(oAppCustDataTable.Rows[0]["ProductDesc"].ToString());
                    _oAppProduct.ProductHTML = HttpUtility.HtmlDecode(oAppCustDataTable.Rows[0]["ProductHTML"].ToString());
                    _oAppProduct.ProductStatus = oAppCustDataTable.Rows[0]["ProductStatus"].ToString();
                    _oAppProduct.ShareWidgetAdded = oAppCustDataTable.Rows[0]["ShareWidgetAdded"].ToString();
                    _oAppProduct.ReccWidgetAdded = oAppCustDataTable.Rows[0]["ReccWidgetAdded"].ToString();
                    _oAppProduct.InquiryWidgetAdded = oAppCustDataTable.Rows[0]["InquiryWidgetAdded"].ToString();
                    _oAppProduct.CommentsWidgetAdded = oAppCustDataTable.Rows[0]["CommentsWidgetAdded"].ToString();
                    _oAppProduct.LikeWidgetAdded = oAppCustDataTable.Rows[0]["LikeWidgetAdded"].ToString();
                    _oAppProduct.CanvasHeight = oAppCustDataTable.Rows[0]["AppCanvasHeight"].ToString();
                    _oAppProduct.CanvasWidth = oAppCustDataTable.Rows[0]["AppCanvasWidth"].ToString();
                    _oAppProduct.AppCaption = oAppCustDataTable.Rows[0]["AppCaption"].ToString();
                    _oAppProduct.TwitterWidgetAdded = oAppCustDataTable.Rows[0]["TwitterWidgetAdded"].ToString();
                    _oAppProduct.SHeaderBannerImg = oAppCustDataTable.Rows[0]["ProductBannerImage"].ToString();
                    _oAppProduct.SHeaderBannerURL = oAppCustDataTable.Rows[0]["ProductBannerURL"].ToString();
                    return _oAppProduct;
                }
                else { return null; }
            }
            catch (Exception ex)
            {
                //Log4NetUtility.ErrorDebug(this.GetType().FullName, "Error in GetConfigData(string _AppId)", ex);
                throw ex;
            }
        }
예제 #16
0
        protected override void OnPreRender(EventArgs e)
        {
            try
            {
                base.OnPreRender(e);
                DigiMa.Common.FaceBook oFBUtility = new DigiMa.Common.FaceBook();
                if (!IsPostBack)
                {
                    //Initialize API Core

                    //Call Getfriends call
                    DataTable oFriendsTable = new DataTable("FriendsTable");
                    DataColumn osoNETID = new DataColumn("soNETID");
                    oFriendsTable.Columns.Add(osoNETID);
                    DataColumn oImage = new DataColumn("Image");
                    oFriendsTable.Columns.Add(oImage);
                    DataColumn oName = new DataColumn("Name");
                    oFriendsTable.Columns.Add(oName);
                    DataColumn oLocation = new DataColumn("Location");
                    oFriendsTable.Columns.Add(oLocation);
                    DataColumn oGender = new DataColumn("Gender");
                    oFriendsTable.Columns.Add(oGender);
                    oFriendsTable = oFBUtility.GetFriendsDetail(Convert.ToString(QSVars["user_id"]), Convert.ToString(QSVars["oauth_token"]));

                    if (oFriendsTable != null)
                    {
                        //Get All Locations

                        var distinctLocations = (from row in oFriendsTable.AsEnumerable()
                                                 select row.Field<string>("Location")).Distinct();

                        foreach (string val in distinctLocations)
                        {
                            if (val != null)
                            {
                                ddlLocation.Items.Add(new ListItem(val, val));
                            }
                        }
                        Cache["FriendsDataTable"] = oFriendsTable;

                        //Bind DataSource of repeator control
                        rptAllFriends.DataSource = oFriendsTable;
                        rptAllFriends.DataBind();
                    }
                }

                //Initialize KOKO

                QSVars.Add("NTYP", "POST");
                osonetpie.QSvarsString = GetQsVarsCollection();
                osonetpie.AbsolutePath = AbsolutePagePath;

                //Call Service to load app settings

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

                //Bind Post content at runtime
                if (_oDCAppProduct.DID.Equals("AP006KV63YSPT0ZDHTMD") || _oDCAppProduct.DID.Equals("AP001HC61GZN1739G4V2"))
                {

                }
                else if (_oDCAppProduct.DID.Equals("AP000CH69W22X9KDGZTT") || _oDCAppProduct.DID.Equals("AP001CS762FRSC4BPCV3") || _oDCAppProduct.DID.Equals("AP005S976CL8C85Y2HV5") || _oDCAppProduct.DID.Equals("AP002PX605GMMMG9MQ59"))
                {

                }
                else
                {

                }

                //Perform Post to wall friends & Store notifierDID stat
                if (this.IsPostBack && _oDCAppProduct != null && AppCustomer != null && AppConfig != null)
                {

                }
            }
            catch (Exception ex)
            {
                commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), Convert.ToString(QSVars["UDID"]));
            }
        }
예제 #17
0
 public bool InsertFinalHTML(AppProduct oAppProduct)
 {
     CanvasDALC cabc = new CanvasDALC();
     return cabc.InsertFinalHTML(oAppProduct);
 }
예제 #18
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;
        }