protected void btnCreate_Click(object sender, EventArgs e) { int count=0; //get the id of chosen element from Dropdwonlist //ASSUMPTION //id we get is 6 //fetch PReference data for id 6 CanvasBizProcess canvBiz = new CanvasBizProcess(); SessionData.PrefData = new PreferenceData(); SessionData.PrefData = canvBiz.GetPReferenceDataForUserPreference("6"); //REMOVE HARDCODE if (SessionData.PrefData.TaskOne1.Equals("F")) { //make user chose templates , edit templates and publish to Facebook SessionData.PrefData.CurrentTask1 = "F"; Response.Redirect("SiteCreation.aspx?CDID=" + SessionData.Customer.CustomerID + "&TID=6", false); } else if(SessionData.PrefData.TaskOne1.Equals("Y")) { //only Youtube } }
protected void Page_Load(object sender, EventArgs e) { string ADID = Convert.ToString(Request["ADID"]); CanvasBizProcess canvBiz = new CanvasBizProcess(); //Check if Winners are declared. If then show else insert if (!canvBiz.IsSweepWinnerDeclared(ADID) == true) { //Get Winners depending on no of winners chosen string WinnerCount = canvBiz.GetSweepWinnersCount(ADID); DataSet dtSweepWinners = new DataSet(); dtSweepWinners = canvBiz.GetSweepWinners(Convert.ToInt32(WinnerCount), ADID); rptSweepWinners.DataSource = dtSweepWinners; rptSweepWinners.DataBind(); } else { //Get Random winners on basis of WinnerCount DataSet dtSweepWinners = new DataSet(); dtSweepWinners = canvBiz.ShowSweepstakesWinner(ADID); rptSweepWinners.DataSource = dtSweepWinners; rptSweepWinners.DataBind(); } }
protected void ChangePasswordUser_click(object sender, EventArgs e) { try { canvBiz = new CanvasBizProcess(); if (Request.QueryString["fp"] != null && !string.IsNullOrEmpty(Request["id"])) { if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null) { string cid = Request["id"].ToString(); id = HttpUtility.UrlDecode(CommonUtility.Decrypt(Request["id"].ToString())); int status = canvBiz.ChangePasswordUser(id, txtpasswordnew.Text.TrimStart(' ').TrimEnd(' ')); string script = string.Empty; if (status != 0) { canvBiz.UpdatefpStatus(id, 0); script = "alert('Password Changed Successfully ... ');" + "location.href='Home.aspx?rp=1';"; this.ClientScript.RegisterStartupScript(typeof(Page), "RedirectArticle", script, true); } } } } catch (Exception ex) { CommonUtility objCommon = new CommonUtility(); objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { canvBiz = new CanvasBizProcess(); if (Request.QueryString["fp"] != null && Request.QueryString["fp"].Contains("1")) { if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null) { // Check if user is using the same link again to reset his password id = HttpUtility.UrlDecode(CommonUtility.Decrypt(Request["id"].ToString())); int fpStatus = canvBiz.ConfirmResetPassword(id.TrimStart(' ').TrimEnd(' ')); if (fpStatus == 1) { newFrm.Attributes.Add("style", "display:block"); //lblLoginuser.Visible = true; //lblLoginuser.Text = "Reset Your Password by logging with the temporary password sent to your email"; } else { newFrm.Attributes.Add("style", "display:none"); lblLoginuser.Visible = true; lblLoginuser.Text = "This link is expired."; } } else { newFrm.Attributes.Add("style", "display:none"); lblLoginuser.Visible = true; lblLoginuser.Text = "Oops!! Something went wrong...."; } } else { newFrm.Attributes.Add("style", "display:none"); lblLoginuser.Visible = true; lblLoginuser.Text = "Oops!! Something went wrong...."; } } } catch (Exception ex) { CommonUtility objCommon = new CommonUtility(); objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { //check if user has already entered FacebookBizProcess fbBiz = new FacebookBizProcess(); if (!fbBiz.CheckIfSweepstakeAlreadyEntered(ADID, sonetID)) { //Save these details to SubmitForm table SweepStakesEntryInfo sweepEntry = new SweepStakesEntryInfo(); sweepEntry.AppConfigDID1 = ADID; sweepEntry.SoNetID1 = sonetID; sweepEntry.FirstName1 = txtFirstName.Text.Trim().Replace("'", "''"); sweepEntry.LastName1 = txtLastName.Text.Trim().Replace("'", "''"); sweepEntry.Address1 = txtAddress.Text.Trim().Replace("'", "''"); sweepEntry.Country1 = ddlCountry.SelectedValue; sweepEntry.City1 = txtCity.Text.Trim().Replace("'", "''"); sweepEntry.ZipCode1 = txtZip.Text.Trim().Replace("'", "''"); sweepEntry.Email1 = txtEmail.Text.Trim().Replace("'", "''"); sweepEntry.Gender1 = ddlGender.SelectedValue; if (datepickerEntryForm.Value == "") { sweepEntry.DOB1 = System.DBNull.Value.ToString(); } else { sweepEntry.DOB1 = SQLSafeDates(datepickerEntryForm.Value); } sweepEntry.Telephone1 = txtTelePhone.Text.Trim().Replace("'", "''"); sweepEntry.Mobile1 = txtMobile.Text.Trim().Replace("'", "''"); sweepEntry.UserType = System.DBNull.Value.ToString(); sweepEntry.Remarks = txtRemarks.Text.Trim().Replace("'", "''"); //CallBiz Method using (CanvasBizProcess canvBiz = new CanvasBizProcess()) { spanError.InnerHtml = ""; canvBiz.SaveSweepStakesEntryInfo(sweepEntry); Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close()", true); } } else { spanError.InnerHtml = "You have already entered this Sweepstakes contest!"; } } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), ""); } }
protected void Page_Load(object sender, EventArgs e) { //get the content to show if (Request["Typ"] != null) { contentType = Request["Typ"].ToString(); } if (Request["Loader"] != null) { appconfigDID = Request["Loader"].ToString(); } CanvasBizProcess canvBiz = new CanvasBizProcess(); string dataToShow= canvBiz.FetchSweepStakeUtilData(appconfigDID, contentType); if (dataToShow == "") { litFBData.Text = "No Data to Show !"; } else { litFBData.Text = dataToShow; } }
protected void btnStep2Complete_Click(object sender, EventArgs e) { //Prepare file system directory to store Images string pathToCreate = "~/Images/" + SessionData.Product.DID; hdnPDID.Value = SessionData.Product.DID; hdnfield.Value = CDID; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } //Logo Image if (filePromo2Logo.HasFile) { if (filePromo2Logo.PostedFile.ContentType == "image/jpeg" || filePromo2Logo.PostedFile.ContentType == "image/png" || filePromo2Logo.PostedFile.ContentType == "image/jpg" || filePromo2Logo.PostedFile.ContentType == "image/pjpeg") { if (filePromo2Logo.FileBytes.Length < ONE_MB) { string filenamePromo2Logo = Path.GetFileName(filePromo2Logo.FileName); if (chkSweepImage.Checked) { Bitmap sourceImage = new Bitmap(filePromo2Logo.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Logo" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } else { filePromo2Logo.PostedFile.SaveAs(Server.MapPath("~/Images/" + SessionData.Product.DID + "/Logo" + filenamePromo2Logo)); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } } else { span1.InnerHtml = "File size should not be greater than 1 MB"; } } } //Header Banner Image if (imgBanner.HasFile) { if (imgBanner.PostedFile.ContentType == "image/jpeg" || imgBanner.PostedFile.ContentType == "image/png" || imgBanner.PostedFile.ContentType == "image/jpg" || imgBanner.PostedFile.ContentType == "image/pjpeg") { if (imgBanner.FileBytes.Length < ONE_MB) { string imgBannerPromo2 = Path.GetFileName(imgBanner.FileName); Bitmap sourceImage = new Bitmap(imgBanner.PostedFile.InputStream); if (SessionData.Product.CanvasHeight == string.Empty) { SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Banner" + imgBannerPromo2), Convert.ToInt32(SessionData.Product.CanvasWidth), 700); } else if (SessionData.Product.CanvasWidth == string.Empty) { SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Banner" + imgBannerPromo2), 500, Convert.ToInt32(SessionData.Product.CanvasHeight)); } else if (SessionData.Product.CanvasHeight == string.Empty && SessionData.Product.CanvasWidth == string.Empty) { SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Banner" + imgBannerPromo2), 500, 700); } else { SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Banner" + imgBannerPromo2), 500, 100); } hdnBanner.Value = imgBannerPromo2; //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } } } //Caption if (!string.IsNullOrEmpty(txtHeaderText.Text)) { SessionData.Product.AppCaption = txtHeaderText.Text; } //Check How many winners are seletced if (ddlSelectWinner.SelectedItem.Value.Equals("1")) { SweepWinners = 1; } else if (ddlSelectWinner.SelectedItem.Value.Equals("2")) { SweepWinners = 2; } FacebookBizProcess fbBiz = new FacebookBizProcess(); SessionData.Config = fbBiz.GetAvailableConfig(CDID); //Save the sweepstakes data sweep.SSweepAboutUs = null; sweep.SSweepConfigDID = SessionData.Config.DID; sweep.SSweepStartDate = SQLSafeDates(datepickerStart.Value, true); sweep.SSweepEndDate = SQLSafeDates(HiddenField1.Value, false); sweep.SSweepTerms = txtTandC.Text.Trim().Replace("'", "''"); sweep.SSweepPrivacy = txtPrivacy.Text.Trim().Replace("'", "''"); sweep.SSweeprules = txtOffRules.Text.Trim().Replace("'", "''"); sweep.SPRizeDetails = txtPrizeDetails.Text.Trim().Replace("'", "''"); sweep.SCouponReedem = null; sweep.SCouponCode = null; sweep.SCouponDesc = null; sweep.SSweepExpiryDate = SQLSafeDates(datepickerExpiry.Value, false); sweep.SEligibility = txtEligibility.Text.Trim().Replace("'", "''"); sweep.SSweepWinners = SweepWinners; //Save this Data if (sweep.SSweepTerms.Length < MAX_DB_LEN && sweep.SSweepPrivacy.Length < MAX_DB_LEN && sweep.SSweeprules.Length < MAX_DB_LEN) { using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.SaveCouponData(sweep); } } //Now enable Facebook tab HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("Widgets"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_TWO_COMPLETE; }
protected void Button1_Click(object sender, EventArgs e) { CanvasBizProcess canvBiz = new CanvasBizProcess(); try { if (txtEmailid.Text.Contains(">") || txtEmailid.Text.Contains("<") || txtEmailid.Text.Contains("'") || txtEmailid.Text.Contains("--") || txtEmailid.Text.Contains("%")) { txtEmailid.Text = ""; } else { string temppass = "******"; AppCustomer oAppCustomer = new AppCustomer(); oAppCustomer.CustomerID = oAppCustomer.GetNewDIDWithPrefix(); oAppCustomer.SCompanyName = txtOrganization.Text.Trim(); oAppCustomer.SCustomerCountry = Convert.ToInt32(ddlCountry.SelectedValue); oAppCustomer.SCustomerEmail = txtEmailid.Text.Trim(); oAppCustomer.SCustomerPWD = temppass; oAppCustomer.SCustomerStatus = "1"; //Remove hardcoding oAppCustomer.SCustomerUserName = txtFullName.Text.Trim(); oAppCustomer.SfpStatus = "0"; oAppCustomer.SAddress = txtAddress.Text.Trim(); //Check if Privacy policy check-box is checked if (flag) { if (checkTC.Checked == true) { canvBiz.InsertNewCustomer(oAppCustomer); int mailstatus = MailTrigger(txtEmailid.Text); if (mailstatus == 1) { string script = "alert('A verification Email has been sent to you.');" + "location.href='Home.aspx?';"; this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true); } } else { string script = "alert('Kindly accept the T&C and Privacy Policy')"; this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true); CodeNumberTextBox.Text = ""; this.Session["CaptchaImageText"] = GenerateRandomCode(); } } else { CodeNumberTextBox.Text = ""; errorlblsecurity.Style.Add("display", "block"); StringBuilder sErrorMsg = new StringBuilder(); sErrorMsg.Append("The Characters Don't Match.</br>"); sErrorMsg.Append("Please Try Again."); errorlblsecurity.Text = sErrorMsg.ToString(); CodeNumberTextBox.Focus(); this.Session["CaptchaImageText"] = GenerateRandomCode(); } } } catch (Exception ex) { objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
private int MailTrigger(string txtEmailid) { try { canvBiz = new CanvasBizProcess(); string uid = canvBiz.GetCustId(txtEmailid); AppCustomer oAppCustomer = new AppCustomer(); oAppCustomer = canvBiz.GetCustomerInfo(txtEmailid, uid, false); MailMessage mail = new MailMessage(); //string adminid = txtmailid; string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"]; string admpass = "******";// ConfigurationManager.AppSettings["userpassword"]; System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass); mail.From = new MailAddress(adminid);//TODO: Put actual sender email address mail.To.Add(new MailAddress(txtEmailid)); mail.Subject = "Welcome to SonetReach!"; // Mail Subject mail.IsBodyHtml = true; mail.Priority = MailPriority.High; //Mail Priority StringBuilder strBody = new StringBuilder(); strBody.Append("<div><center><table border=\"2px black\" width=\"800px\" style=\"height:200px;\">"); strBody.Append("<tr><td style=\"background-color: #8BCD98; height: 40px; width: 400px;\">"); strBody.Append("<center><span style=\"color: #0D6DA0; font-family: Verdana; font-size: large;\">"); strBody.Append("SONETREACH"); strBody.Append("</span></center></td></tr><tr><td>"); strBody.Append("<span style=\"font-family: Verdana;\">"); strBody.Append("<br/>"); strBody.Append("Hello"); strBody.Append("<br>"); strBody.Append("<br>"); strBody.Append("Thank you for registering with SONETREACH .To complete registration, Please follow this link.<br /><br/>"); strBody.Append("https://www.testsonetreach.com/Confirmation.aspx?nu=1&id=" + HttpUtility.UrlEncode(CommonUtility.Encrypt(uid)) + ""); strBody.Append("<br><br>"); strBody.Append("User Name: "); strBody.Append(txtEmailid); strBody.Append("<br><br><br>"); strBody.Append("Thanks,"); strBody.Append("<br><br>"); strBody.Append("DigiMa Team"); strBody.Append("</span></td></tr></tr></table></center></div>"); mail.Body = strBody.ToString(); SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25); mSMTPClient.EnableSsl = false; mSMTPClient.UseDefaultCredentials = true; mSMTPClient.Credentials = auth; mSMTPClient.Port = 25; // PORT NUMBER mSMTPClient.Host = "smtpauth.net4india.com"; mSMTPClient.Send(mail); return 1; } catch (Exception ex) { objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } return 0; //for failure if try is not executed }
private void Getcountrytobind() { CanvasBizProcess canvBiz = new CanvasBizProcess(); DataSet dsCountryList = canvBiz.GetCountryList(); ddlCountry.DataSource = dsCountryList; ddlCountry.DataTextField = "countryname"; ddlCountry.DataValueField = "countryid"; ddlCountry.DataBind(); ddlCountry.Items.Insert(0, new ListItem("Select Country", "")); ViewState["countrylist"] = dsCountryList; }
protected void txtEmailID_TextChanged(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtEmailid.Text.ToString())) { CanvasBizProcess canvBiz = new CanvasBizProcess(); canvBiz = new CanvasBizProcess(); if (txtEmailid.Text.Contains(">") || txtEmailid.Text.Contains("<") || txtEmailid.Text.Contains("'") || txtEmailid.Text.Contains("--") || txtEmailid.Text.Contains("%")) { txtEmailid.Text = ""; } else { int result = canvBiz.CheckUserEmail(txtEmailid.Text.TrimStart(' ').TrimEnd(' ')); if (result == 0) { txtOrganization.Focus(); } else { string alertScript = "alert('This e-mail ID already exists!');"; ScriptManager.RegisterStartupScript(this, GetType(), "Key", alertScript, true); txtEmailid.Focus(); txtEmailid.Text = ""; } } } } catch (Exception ex) { objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
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); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data FacebookBizProcess fbBiz = new FacebookBizProcess(); string createdHTML = fbBiz.GetProductHTML(SessionData.Product.DID); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Custom Tab Name if (!txtCustomTabNamePromo2.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromo2.Text.Trim(); } //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } else { SessionData.Product.ShareWidgetAdded = "N"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } else { SessionData.Product.InquiryWidgetAdded = "N"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } else { SessionData.Product.ReccWidgetAdded = "N"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } else { SessionData.Product.CommentsWidgetAdded = "N"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } else { SessionData.Product.LikeWidgetAdded = "N"; } if (chkTweeter.Checked) { SessionData.Product.TwitterWidgetAdded = "Y"; } else { SessionData.Product.TwitterWidgetAdded = "N"; } //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.HasFile) { if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < 1048576) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); if (chkPromo2.Checked) { Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; } else { filePromo2LikeGateWayImage.PostedFile.SaveAs(Server.MapPath("~/Images/" + SessionData.Product.DID + "/Logo" + filenamePromo2Logo)); hdnFooterLogo.Value = filenamePromo2Logo; } //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } } if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID)) //check if user is allowed to create Promos etc under his current plan ***************************************************************** { //Add Inquiry Data if (!(string.IsNullOrEmpty(txtInquiryEmail.Text.Trim()))) { SessionData.Config.SInquiryEmail = txtInquiryEmail.Text.Trim(); } //Add TemplatePage Data SessionData.Config.STemplatePage = TEMPLATE_PAGE; string pathToCreate = "~/Images/" + SessionData.Product.DID; //Replace New Header Image and anchor tag if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) //New image was chosen, then do normal replace, else, bring new image //SessionData.Product.SHeaderBannerURL != txtBannerURL.Text { HeaderBannerURLReplaced = createdHTML.Replace(SessionData.Product.SHeaderBannerURL, txtBannerURL.Text); } else { HeaderBannerURLReplaced = createdHTML.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + SessionData.Product.SHeaderBannerURL + " target=\"_blank\" >"); // Replace Banner URL } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace(SessionData.Product.SHeaderBannerImg, hdnBanner.Value); } else { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SHeaderBannerImg + "\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } //Fill up Preview Data if (hdnFileContentHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderReplaced = HeaderBannerReplaced.Replace(SessionData.Product.SProductContentImage, hdnFooter.Value); } else { //if (Convert.ToInt32(SessionData.Product.CanvasWidth) != Convert.ToInt32(hdnWidthStatus.Value)) //{ // //resize existing image by adding width and height to <img> // HeaderReplaced = createdHTML.Replace("<img id=\"imgHeader\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Head" + SessionData.Product.SProductContentImage + "\" />", "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Head" + SessionData.Product.SProductContentImage + "\" alt=\"\" width=\"" + SessionData.Product.CanvasWidth + "\" height=\"" + SessionData.Product.CanvasHeight + "\"/>"); //} //else //dont add anything //{ // HeaderReplaced = createdHTML.Replace("<img id=\"imgHeader\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SProductHeaderImage + "\" />", "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Head" + hdnHeader.Value + "\" alt=\"\" />"); //} HeaderReplaced = HeaderBannerReplaced.Replace("<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SProductHeaderImage + "\" alt=\"\" style=\"width: 500px; height: 700px;\" />", "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Header" + hdnHeader.Value + "\" alt=\"\" alt=\"\" style=\"width: 500px; height: 700px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } SessionData.Product.ProductLogo = "https://www.sonetreach.com/Images/" + SessionData.Product.DID + "/Logo" + SessionData.Product.ProductLogo; if (hdnFileContentHasFile.Value.Equals(HASFILE)) { SessionData.Product.SProductContentImage = hdnFooter.Value; } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) { SessionData.Product.SHeaderBannerImg = hdnBanner.Value; } // Add Banner URL if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) { SessionData.Product.SHeaderBannerURL = txtBannerURL.Text.Trim(); } using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdatePreviewHTML(HeaderReplaced, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; if (!(SessionData.Config == null)) { //Apply Campaign Dates to Config if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(datepickerEnd.Value, true); } //Now fill up the Config and get Product data. if (fbBiz.UpdateConfigDetails(SessionData.Config, PROMOTIONS, SessionData.Config.SCustomtTabName)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, SessionData.Customer.CustomerID); fbBiz.UpdateProductDetails(SessionData.Product); } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data dsTemplateData = canv.GetTempData(Convert.ToInt32(templateID)); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Custom Tab Name if (!txtCustomTabNamePromo2.Text.Trim().Equals(string.Empty)) { SessionData.Product.SCustomeTabName = txtCustomTabNamePromo2.Text.Trim(); } else { spanErrorCustTabNamePromo2.InnerHtml = "Custom Tab Name is required!"; errCount++; } //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < 1048576) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); if (chkPromo2.Checked) { Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } else { filePromo2LikeGateWayImage.PostedFile.SaveAs(Server.MapPath("~/Images/" + SessionData.Product.DID + "/Logo" + filenamePromo2Logo)); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } FacebookBizProcess fbBiz = new FacebookBizProcess(); if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID)) //check if user is allowed to create Promos etc under his current plan ***************************************************************** { SessionData.Config = fbBiz.GetAvailableConfig(CDID); //Add Inquiry Data if (!(string.IsNullOrEmpty(txtInquiryEmail.Text.Trim()))) { SessionData.Config.SInquiryEmail = txtInquiryEmail.Text.Trim(); } //Add TemplatePage Data SessionData.Config.STemplatePage = TEMPLATE_PAGE; //Fill up Preview Data string tempData = dsTemplateData.Tables[0].Rows[0]["thtml"].ToString(); string HeaderReplaced = tempData.Replace("<img id=\"imgHeader\" alt=\"\" src=\"\" />", "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Header" + hdnHeader.Value + "\" alt=\"\" />"); string ContentReplaced = HeaderReplaced.Replace("<img id=\"imgContentMain\" alt=\"\" src=\"\" />", "<img id=\"imgContentMain\" src=\"Images/" + SessionData.Product.DID + "/" + "Content" + hdnContent.Value + "\" alt=\"\" />"); string FinalHTML = ContentReplaced.Replace("<img id=\"imgFooter\" alt=\"\" src=\"\" />", "<img id=\"imgFooter\" src=\"Images/" + SessionData.Product.DID + "/" + "Footer" + hdnFooter.Value + "\" alt=\"\" />"); SessionData.Product.ProductLogo = "https://www.testsonetreach.com/Images/" + SessionData.Product.DID + "/Logo" + SessionData.Product.ProductLogo; SessionData.Product.SProductHeaderImage = "Header" + hdnHeader.Value; SessionData.Product.SProductContentImage = "Content" + hdnContent.Value; SessionData.Product.SProductFooterImage = "Footer" + hdnFooter.Value; using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { spnErrorPromo2Head.InnerHtml = ""; canvasBiz.InsertPreviewHTML(FinalHTML, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; if (!(SessionData.Config == null)) { //Apply Campaign Dates to Config if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(HiddenField1.Value, true); } //Now fill up the Config and get Product data. if (fbBiz.SetNewConfigDetails(SessionData.Config,SessionData.Product.SCustomeTabName,PROMOTIONS)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, CDID); fbBiz.SetNewProductDetails(SessionData.Product); SessionData.Product = fbBiz.GetAppProductDetails(); // Now Enable the Facebook Tab } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data FacebookBizProcess fbBiz = new FacebookBizProcess(); string createdHTML = fbBiz.GetProductHTML(SessionData.Product.DID); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Custom Tab Name if (!txtCustomTabNamePromo2.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromo2.Text.Trim(); } else { //spanErrorCustTabNamePromo2.InnerHtml = "Custom Tab Name is required!"; // Added RequiredfirldValidator to avoid Post **7/4/2012** errCount++; } //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } else { SessionData.Product.ShareWidgetAdded = "N"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } else { SessionData.Product.InquiryWidgetAdded = "N"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } else { SessionData.Product.ReccWidgetAdded = "N"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } else { SessionData.Product.CommentsWidgetAdded = "N"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } else { SessionData.Product.LikeWidgetAdded = "N"; } if (chkTweeter.Checked) { SessionData.Product.TwitterWidgetAdded = "Y"; } else { SessionData.Product.TwitterWidgetAdded = "N"; } //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < 1048576) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } //Start Date, Expiry Date if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID)) //check if user is allowed to create Promos etc under his current plan ***************************************************************** { //Add Inquiry Data if (!(string.IsNullOrEmpty(txtInquiryEmail.Text.Trim()))) { SessionData.Config.SInquiryEmail = txtInquiryEmail.Text.Trim(); } //Add TemplatePage Data SessionData.Config.STemplatePage = TEMPLATE_PAGE; string pathToCreate = "~/Images/" + SessionData.Product.DID; //Replace New Header Image and anchor tag if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerURLReplaced = createdHTML.Replace(SessionData.Product.SHeaderBannerURL, txtBannerURL.Text); } else { HeaderBannerURLReplaced = createdHTML.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + SessionData.Product.SHeaderBannerURL + " target=\"_blank\" >"); // Replace Banner URL } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace(SessionData.Product.SHeaderBannerImg, hdnBanner.Value); } else { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SHeaderBannerImg + "\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } //Fill up Preview Data if (hdnFileContentHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderReplaced = HeaderBannerReplaced.Replace(SessionData.Product.SProductContentImage, hdnHeaderBanner.Value); } else { HeaderReplaced = HeaderBannerReplaced.Replace("<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SProductContentImage + "\" alt=\"\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Header" + hdnHeader.Value + "\" alt=\"\" alt=\"\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } //fetch Sweepstakes data to create html, till now we have only replaced HeaderImage SweepStakesData oOldSweepObj = new SweepStakesData(); oOldSweepObj = fbBiz.GetSweepDataForEditing(SessionData.Product.AppConfigDID); if (!oOldSweepObj.SPRizeDetails.Equals(txtPrizeDetails.Text.Trim())) { DetailsReplaced = HeaderReplaced.Replace(oOldSweepObj.SPRizeDetails, txtPrizeDetails.Text.Trim()); } else { DetailsReplaced = HeaderReplaced; } if (!oOldSweepObj.SEligibility.Equals(txtEligibility.Text.Trim())) { //replace Eligibility details EligibilityReplaced = DetailsReplaced.Replace(oOldSweepObj.SEligibility, txtEligibility.Text.Trim().Replace("'", "''")); } else { EligibilityReplaced = DetailsReplaced; } ////format dates string startedDate = SQLSafeDates(datepickerStart.Value, true); string endDate = SQLSafeDates(datepickerEnd.Value, true); string validDate = SQLSafeDates(datepickerExpiry.Value, true); if (!string.IsNullOrEmpty(startedDate)) { DateTime sd = DateTime.Parse(startedDate); SdateReplaced = sd.ToString("d/M/yyyy"); } if (!string.IsNullOrEmpty(endDate)) { DateTime sd = DateTime.Parse(endDate); EdateReplaced = sd.ToString("d/M/yyyy"); } if (!string.IsNullOrEmpty(validDate)) { DateTime sd = DateTime.Parse(validDate); ExdateReplaced = sd.ToString("d/M/yyyy"); } //replace start and End dates // string StartDateReplaced = EligibilityReplaced.Replace("<span id=\"spanStartDate\">", "<span id=\"spanStartDate\">" + startedDate); // string EndDateReplaced = StartDateReplaced.Replace("<span id=\"spanEndDate\">", "<span id=\"spanEndDate\">" + endDate); string startdt = oOldSweepObj.SSweepStartDate; string endt = oOldSweepObj.SSweepEndDate; string expirydt = oOldSweepObj.SSweepExpiryDate; if (!string.IsNullOrEmpty(startdt)) { DateTime sd = DateTime.Parse(startdt); Sdate = sd.ToString("d/M/yyyy"); } if (!string.IsNullOrEmpty(endt)) { DateTime sd = DateTime.Parse(endt); Edate = sd.ToString("d/M/yyyy"); } if (!string.IsNullOrEmpty(expirydt)) { DateTime sd = DateTime.Parse(expirydt); Exdate = sd.ToString("d/M/yyyy"); } //replace Start date if (!Sdate.Equals(datepickerStart.Value)) { StartDateReplaced = EligibilityReplaced.Replace(Sdate, SdateReplaced); } else { StartDateReplaced = EligibilityReplaced; } //replace End date if (!Edate.Equals(HiddenField1.Value)) { ValidTillDateReplaced = StartDateReplaced.Replace(Edate, EdateReplaced); } else { ValidTillDateReplaced = StartDateReplaced; } //replace Winner date if (!Exdate.Equals(datepickerExpiry.Value)) { ExpiryDate = ValidTillDateReplaced.Replace(Exdate, ExdateReplaced); } else { ExpiryDate = ValidTillDateReplaced; } if (!oOldSweepObj.SSweepWinners.Equals(ddlSelectWinner.SelectedItem.Value)) { if (ddlSelectWinner.SelectedItem.Value.Equals("1")) { SweepWinners = 1; } else if (ddlSelectWinner.SelectedItem.Value.Equals("2")) { SweepWinners = 2; } } SessionData.Product.ProductLogo = "https://www.sonetreach.com/Images/" + SessionData.Product.DID + "/Logo" + SessionData.Product.ProductLogo; if (hdnFileContentHasFile.Value.Equals(HASFILE)) { SessionData.Product.SProductContentImage = "Content" + hdnContent.Value; } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) { SessionData.Product.SHeaderBannerImg = hdnBanner.Value; } // Add Banner URL if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) { SessionData.Product.SHeaderBannerURL = txtBannerURL.Text.Trim(); } using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdatePreviewHTML(ExpiryDate, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; //CanvasBizProcess cbiz = new CanvasBizProcess(); //string Id = cbiz.GetCustId(Request["CustomerName"]); //string Cdid = cbiz.GetAppConfigDid(Id); //SessionData.Config.DID = Cdid; CDID = SessionData.Customer.CustomerID; //Save the sweepstakes data sweep.SSweepAboutUs = null; sweep.SSweepConfigDID = SessionData.Config.DID; sweep.SSweepStartDate = SQLSafeDates(datepickerStart.Value, true); sweep.SSweepEndDate = SQLSafeDates(datepickerEnd.Value, true); sweep.SSweepTerms = txtTandC.Text.Trim().Replace("'", "''"); sweep.SSweepPrivacy = txtPrivacy.Text.Trim().Replace("'", "''"); sweep.SSweeprules = txtOffRules.Text.Trim().Replace("'", "''"); sweep.SPRizeDetails = txtPrizeDetails.Text.Trim().Replace("'", "''"); sweep.SCouponReedem = null; sweep.SCouponCode = null; sweep.SCouponDesc = null; sweep.SSweepExpiryDate = SQLSafeDates(datepickerExpiry.Value, true); sweep.SEligibility = txtEligibility.Text.Trim().Replace("'", "''"); sweep.SSweepWinners = SweepWinners; //Save this Data if (sweep.SSweepTerms.Length < 7999 && sweep.SSweepPrivacy.Length < 7999 && sweep.SSweeprules.Length < 7999) { using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdateSweepStakesData(sweep); } } if (!(SessionData.Config == null)) { //Apply Campaign Dates to Config if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(datepickerExpiry.Value, true); } //Now fill up the Config and get Product data. if (fbBiz.UpdateConfigDetails(SessionData.Config, SWEEPSTAKES, SessionData.Config.SCustomtTabName)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** CanvasBizProcess cbiz = new CanvasBizProcess(); //string Id = cbiz.GetCustId(Request["CustomerName"]); //string Cdid = cbiz.GetAppConfigDid(Id); //SessionData.Config.DID = Cdid; CDID = SessionData.Customer.CustomerID; SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, CDID); SessionData.Product.SCouponImgPath = "<img id=\"imgHeader\" src=\"Images/" + SessionData.Product.DID + "/" + "Head" + hdnHeaderBanner.Value + "\" alt=\"\" style=\"width: 250px; height: 250px;\" />"; fbBiz.UpdateProductDetails(SessionData.Product); } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void submibmail_Click(object sender, EventArgs e) { canvBiz = new CanvasBizProcess(); AppCustomer oAppCustomer = new AppCustomer(); string uid = canvBiz.GetCustId(txtmailid.Text.TrimStart(' ').TrimEnd(' ')); try { if (txtmailid.Text.Contains(">") || txtmailid.Text.Contains("<") || txtmailid.Text.Contains("'") || txtmailid.Text.Contains("--") || txtmailid.Text.Contains("%")) { txtmailid.Text = ""; } else { if (flag) { string NewTempPass = GenerateNewPassword(8); string temppass = _oEncryptionUtilities.getEncryptedCode(NewTempPass); int chkavalible = canvBiz.VerifyEmailInsertNewPassword(txtmailid.Text.TrimStart(' ').TrimEnd(' '), temppass); if (chkavalible == 1) { int mailstatus = MailTrigger(txtmailid.Text); if (mailstatus == 1) { string script = "alert('Password Sent To Email.');" + "location.href='Home.aspx?';"; this.ClientScript.RegisterStartupScript(typeof(Page), "Redirect", script, true); CanvasBizProcess canvasBiz = new CanvasBizProcess(); //UPdate fpStatus to 1 as user has requested reset password canvasBiz.UpdatefpStatus(uid, 1); //canvBiz.UpdateTempPwd(txtmailid.Text, temppass); } } else { maillbl.Visible = true; maillbl.Text = " Invalid Email Id /Please Check Email Id Again."; CodeNumberTextBox.Text = ""; this.Session["CaptchaImageText"] = GenerateRandomCode(); errorlblsecurity.Text = string.Empty; } } else { errorlblsecurity.Style.Add("display", "block"); errorlblsecurity.Text = "The Characters Doesn't Match. Please Try Again."; CodeNumberTextBox.Text = ""; errorlblsecurity.Focus(); } } } catch (Exception ex) { DigiMa.Common.CommonUtility objCommon = new CommonUtility(); objCommon.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), ""); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (SessionData.Customer.CustomerID.Equals(string.Empty)) { Response.Redirect("Home.aspx"); } else { //load Customer grid for Analytics canvBiz = new CanvasBizProcess(); grdAnalytics.DataSource = canvBiz.FetchConfigDataForLoggedInUser(SessionData.Customer.CustomerID); grdAnalytics.DataBind(); } } }
private int MailTriggerToSonetREachAdmin(string txtEmailid) { try { canvBiz = new CanvasBizProcess(); string uid = canvBiz.GetCustId(txtEmailid); AppCustomer oAppCustomer = new AppCustomer(); oAppCustomer = canvBiz.GetCustomerInfo(txtEmailid, uid, false); MailMessage mail = new MailMessage(); //string adminid = txtmailid; string adminid = "*****@*****.**";//ConfigurationManager.AppSettings["usermailid"]; string admpass = "******";// ConfigurationManager.AppSettings["userpassword"]; System.Net.NetworkCredential auth = new System.Net.NetworkCredential(adminid, admpass); mail.From = new MailAddress(adminid);//TODO: Put actual sender email address mail.To.Add(new MailAddress("*****@*****.**")); mail.Subject = "New Registration"; // Mail Subject mail.IsBodyHtml = true; mail.Priority = MailPriority.High; //Mail Priority mail.Body = txtEmailid + " has just registered with SonetReach !"; SmtpClient mSMTPClient = new SmtpClient("smtpauth.net4india.com", 25); mSMTPClient.EnableSsl = false; mSMTPClient.UseDefaultCredentials = true; mSMTPClient.Credentials = auth; mSMTPClient.Port = 25; // PORT NUMBER mSMTPClient.Host = "smtpauth.net4india.com"; mSMTPClient.Send(mail); return 1; } catch (Exception ex) { objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } return 0; //for failure if try is not executed }
protected void Page_Load(object sender, EventArgs e) { CanvasBizProcess ocanbiz = new CanvasBizProcess(); TwitterBizProcess Twbiz = new TwitterBizProcess(); Twitter otittwr = new Twitter(); string oauthverifier = Request.QueryString["oauth_verifier"].ToString(); string oauthtoken = (Request.QueryString["oauth_token"].ToString()); string userid = otittwr.CreateCachedAccessToken(oauthtoken, oauthverifier); //string ADID = SessionData.Product.AppConfigDID; //string app_id = SessionData.Config.AppID; string ADID = Request.QueryString["ADID"]; string app_id = Request.QueryString["app_id"]; String SMType = "TW"; //First Check whether User Exsist oDCAppUser = ocanbiz.GetTwitterTokens(ADID, SMType, userid); if (oDCAppUser != null) { string token = oDCAppUser.Token; string tokensecret = oDCAppUser.TokenSecret; if (otittwr.CheckAppAuthorized(token, tokensecret) == true) { UpdateStatus(token, tokensecret); ClientScript.RegisterStartupScript(typeof(Page), "RedirectArticle", "alert('Tweeted Successfully ! ! ! ');", true); ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close('Test.aspx');", true); //Tweet(); //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( '" + URL + "', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true); //this.ClientScript.RegisterStartupScript(this.GetType(), "navigate", "window.location = $('#aTwitterBtn').attr('href');", true); //this.ClientScript.RegisterStartupScript(this.GetType(),"navigate","window.onload = function() {window.location.hash='#message';}", // true); } } else { AppUser oAppuser = new AppUser(); oAppuser.AppConfigDID = ADID; oAppuser.EmailID = "NULL"; oAppuser.SonetID = userid; oAppuser.SonetSRC = "FBSRC"; oAppuser.UserStatus = "Active"; oAppuser.SMType = "TW"; oAppuser.Token = SessionData.TwitterData.TokenKey; oAppuser.TokenSecret = SessionData.TwitterData.TokenSecretKey; oAppuser = otittwr.GetUserDetail(userid, oAppuser); //Insert in AppUser when Brand Tweets the Campaign if (!Twbiz.IsUserCreatedForTwitter(oAppuser.SonetID, oAppuser.AppConfigDID)) { if (Twbiz.SetAppUserAuthorize(oAppuser, ADID)) oDCAppUser = oAppuser; } UpdateStatus(SessionData.TwitterData.TokenKey, SessionData.TwitterData.TokenSecretKey); //Close this page since all info is available. ClientScript.RegisterStartupScript(typeof(Page), "RedirectArticle", "alert('Tweeted Successfully ! ! ! ');", true); ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close('Test.aspx');", true); } }
public void sitecreation() { try { string prefernceId = preferenceDropDown.SelectedValue; //get the id of chosen element from Dropdwonlist //ASSUMPTION //id we get is 6 //fetch PReference data for id 6 CanvasBizProcess canvBiz = new CanvasBizProcess(); SessionData.PrefData = new PreferenceData(); SessionData.PrefData = canvBiz.GetPReferenceDataForUserPreference(prefernceId); //REMOVE HARDCODE SessionData.PrefData.PrefID1 = prefernceId; if (SessionData.PrefData.TaskOne1.Equals("F")) { //make user chose templates , edit templates and publish to Facebook SessionData.PrefData.CurrentTask1 = "F"; // Response.Redirect("SiteCreation.aspx?CDID=" + SessionData.Customer.CustomerID + "&TID="+prefernceId, false); } else if (SessionData.PrefData.TaskOne1.Equals("Y")) { //only Youtube SessionData.PrefData.CurrentTask1 = "Y"; //Response.Redirect("SiteCreation.aspx?CDID=" + SessionData.Customer.CustomerID + "&TID=" + prefernceId, false); } int TemplateID = int.Parse(hdnCurrentTemplateId.Value.ToString().Trim()); //int TemplateID = 11; //HARDCODED REMOVE SessionData.UserAction = oUserDetails; if (oUserDetails.TemplateId == 0) oUserDetails.TemplateId = TemplateID;// UserDataDetails.Add("TemplateId", TemplateID); else if (oUserDetails.TemplateId != TemplateID) oUserDetails.TemplateId = TemplateID; string sCustomerId, Query; sCustomerId = SessionData.Customer.CustomerID; string strConnection = System.Configuration.ConfigurationSettings.AppSettings["SoConn"]; //if (string.IsNullOrEmpty(oUserDetails.CustomerId)) // sCustomerId = oUserDetails.CustomerId.ToString(); SessionData.UserAction.CustomerId = SessionData.Customer.CustomerID; int CustomerId; Query = "Insert into Sites values(" + "'" + SessionData.Customer.CustomerID + "','" + txtSiteName.Text.Trim() + "','P','',null,''," + oUserDetails.TemplateId + ",'index.html'," + "'" + SessionData.Customer.CustomerID + "','','','')"; string sSiteId = SqlHelper.ExecuteScalar(strConnection, CommandType.Text, Query + ";Select @@Identity").ToString(); CreateSitePhysically(oUserDetails.TemplateId.ToString(), sSiteId); Query = "update Sites set FolderPath='SiteImages/'+'" + sSiteId + "',FolderPathTool='Sites/Tool/'+'" + sSiteId + "',FolderPathFinal='Sites/Final/'+'" + sSiteId + "' where SiteId=" + sSiteId; SqlHelper.ExecuteNonQuery(strConnection, CommandType.Text, Query); SessionData.PrefData.TemplateID1 = Convert.ToInt32(hdnCurrentTemplateId.Value); //if (TemplateID == 12) //{ Response.Redirect("PageEditor.aspx?SiteId=" + sSiteId, false); //} //else //{ // Response.Redirect("PageEditorVar.aspx?SiteId=" + sSiteId); //} } catch (Exception ex) { } }
protected void login_Click(object sender, EventArgs e) { try { if (HttpContext.Current.Session != null) { string pwdencoded; canvBiz = new CanvasBizProcess(); string un = txtemail.Text; string pwd = txtpassword.Text; EncryptionUtilities _oEncryptionUtilities = new EncryptionUtilities(); if (txtemail.Text.Contains(">") || txtemail.Text.Contains("<") || txtemail.Text.Contains("'") || txtemail.Text.Contains("--") || txtemail.Text.Contains("%") || txtpassword.Text.Contains(">") || txtpassword.Text.Contains("<") || txtpassword.Text.Contains("'") || txtpassword.Text.Contains("--") || txtpassword.Text.Contains("%")) { txtpassword.Text = ""; txtemail.Text = ""; loginBox.Style.Add("display", "block"); trError.Visible = true; } else { string password = txtpassword.Text; string userName = txtemail.Text; string encrypwd = string.Empty; string cid = canvBiz.GetCustId(userName.TrimStart(' ').TrimEnd(' ')); Dictionary<string, string> lgnDetails = canvBiz.DoLogin(userName.TrimStart(' ').TrimEnd(' '), password.TrimStart(' ').TrimEnd(' ')); if (!lgnDetails["pass"].ToString().Equals("ERROR") && !cid.ToString().Equals("ERROR")) { pwdencoded = lgnDetails["pass"].ToString(); encrypwd = _oEncryptionUtilities.getEncryptedCode(password); if (pwdencoded.Equals(encrypwd)) { //Login SUCCESS, Now get customer details and assign to Session SessionData.Customer = new AppCustomer(); SessionData.Customer = canvBiz.GetCustomerInfo(userName, cid, true); if ((Request.QueryString["fp"] != null && !string.IsNullOrEmpty(Request["id"])) || (Request.QueryString["nu"] != null && !string.IsNullOrEmpty(Request["id"]))) { if (Request.QueryString["fp"] != null) { if (Request.QueryString["fp"].Contains("1") && Request.QueryString["id"] != null) { } } else if (Request.QueryString["nu"].Contains("1") && Request.QueryString["id"] != null) { } else { } } else { //Login is a SUCCESS so Enable content DIV //*******************Now remove Login button, Add LOGOUT, WELCOME******************* //lblLoginuser.Visible = false; Response.Redirect("LandingPage.aspx?CDID=" + SessionData.Customer.CustomerID, false); } } else { loginBox.Style.Add("display", "block"); trError.Visible = true; } } else { loginBox.Style.Add("display", "block"); trError.Visible = true; if ((txtemail.Text == string.Empty) && (txtpassword.Text == string.Empty)) { lblError.Text = "Please provide both Username and Password to login"; } } } } else { Response.Redirect("home.aspx"); } } catch (Exception ex) { //objCommonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data dsTemplateData = canv.GetTempData(Convert.ToInt32(templateID)); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } if (chkTweeter.Checked) { SessionData.Product.TwitterWidgetAdded = "Y"; } //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.HasFile) { if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < ONE_MB) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } } //Start Date, Expiry Date FacebookBizProcess fbBiz = new FacebookBizProcess(); if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID)) //check if user is allowed to create Promos etc under his current plan ***************************************************************** { SessionData.Config = fbBiz.GetAvailableConfig(CDID); //Save the sweepstakes data sweep.SSweepAboutUs = null; sweep.SSweepConfigDID = SessionData.Config.DID; sweep.SSweepStartDate = SQLSafeDates(datepickerStart.Value, true); sweep.SSweepEndDate = SQLSafeDates(HiddenField1.Value, false); sweep.SSweepTerms = txtTandC.Text.Trim().Replace("'", "''"); sweep.SSweepPrivacy = txtPrivacy.Text.Trim().Replace("'", "''"); sweep.SSweeprules = txtOffRules.Text.Trim().Replace("'", "''"); sweep.SPRizeDetails = txtPrizeDetails.Text.Trim().Replace("'", "''"); sweep.SCouponReedem = txtReedem.Text.Trim().Replace("'", "''"); sweep.SCouponCode = txtCoupCode.Text.Trim().Replace("'", "''"); sweep.SCouponDesc = txtCoupDesc.Text.Trim().Replace("'", "''"); sweep.SSweepExpiryDate = SQLSafeDates(datepickerExpiry.Value, false); sweep.SEligibility = txtEligibility.Text.Trim().Replace("'", "''"); //Save this Data if (sweep.SSweepTerms.Length < MAX_DB_LEN && sweep.SSweepPrivacy.Length < MAX_DB_LEN && sweep.SSweeprules.Length < MAX_DB_LEN) { using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.SaveCouponData(sweep); } } //Custom Tab Name if (!txtCustomTabNamePromo2.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromo2.Text.Trim(); } //Add Inquiry Data if (!(string.IsNullOrEmpty(txtInquiryEmail.Text.Trim()))) { SessionData.Config.SInquiryEmail = txtInquiryEmail.Text.Trim(); } //Apply Campaign Dates to Config if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(datepickerEnd.Value, true); } //Add TemplatePage Data SessionData.Config.STemplatePage = TEMPLATE_PAGE; using (CanvasBizProcess canvBiz = new CanvasBizProcess()) { couponHTML = canvBiz.GetTempData(Convert.ToInt32(templateID)).Tables[0].Rows[0]["thtml"].ToString(); } //Fill up Preview Data string FinalHTML = GetConvertedHTML(couponHTML); SessionData.Product.ProductLogo = "https://www.sonetreach.com/Images/" + SessionData.Product.DID + "/Logo" + SessionData.Product.ProductLogo; using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.InsertPreviewHTML(FinalHTML, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; if (!(SessionData.Config == null)) { SessionData.Config.SCampaignType = Coupon; //Now fill up the Config and get Product data. if (fbBiz.SetNewConfigDetails(SessionData.Config, SessionData.Config.SCustomtTabName,Coupon)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, CDID); SessionData.Product.SProductContentImage = hdnHeaderBanner.Value; SessionData.Product.SHeaderBannerURL = txtBannerURL.Text; SessionData.Product.SHeaderBannerImg = hdnBanner.Value; fbBiz.SetNewProductDetails(SessionData.Product); SessionData.Product = fbBiz.GetAppProductDetails(); } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data FacebookBizProcess fbBiz = new FacebookBizProcess(); string createdHTML = fbBiz.GetProductHTML(SessionData.Product.DID); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Custom Tab Name if (!txtCustomTabNamePromo2.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromo2.Text.Trim(); } //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } else { SessionData.Product.ShareWidgetAdded = "N"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } else { SessionData.Product.InquiryWidgetAdded = "N"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } else { SessionData.Product.ReccWidgetAdded = "N"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } else { SessionData.Product.CommentsWidgetAdded = "N"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } else { SessionData.Product.LikeWidgetAdded = "N"; } if (chkTweeter.Checked) { SessionData.Product.TwitterWidgetAdded = "Y"; } else { SessionData.Product.TwitterWidgetAdded = "N"; } oVidShareData = fbBiz.GetVideoShareData(SessionData.Config.DID); //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.HasFile) { if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < 1048576) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } } if (fbBiz.IsAppCreationAllowed(SessionData.Customer.CustomerID)) { FaceBook ofacebook = new FaceBook(); AppUser oAppUser = new AppUser(); if ((Regex.IsMatch(txtVideoURL.Text.Trim(), @"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?")) && (txtVideoURL.Text.Trim().Contains("youtube"))) { iframecontent = ofacebook.GetEmbedURL(txtVideoURL.Text.Trim(), oAppUser); iframecontentOld = ofacebook.GetEmbedURL(oVidShareData.SVideoShareURL, oAppUser); string fixedURL = FixVideoURL(iframecontent); string fixedUrlOld = FixVideoURL(iframecontentOld); //Now update VideoShareData fbBiz.UpdateVideoShareData(SessionData.Config.DID, txtVideoURL.Text.Trim(), fixedURL, txtDescription.Text.Trim()); if (!iframecontent.Equals(string.Empty)) { string[] newEmbedURL = iframecontent.Split(' '); string finalURL = newEmbedURL[3].Remove(0, 4); string[] oldEmbedURL = iframecontentOld.Split(' '); string oldfinalURL = oldEmbedURL[3].Remove(0, 4); if (!txtVideoURL.Text.Contains("autoplay")) { if (!txtVideoURL.Text.Contains("?")) { if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) //New image was chosen, then do normal replace, else, bring new image //SessionData.Product.SHeaderBannerURL != txtBannerURL.Text { HeaderBannerURLReplaced = createdHTML.Replace(SessionData.Product.SHeaderBannerURL, txtBannerURL.Text); } else { HeaderBannerURLReplaced = createdHTML.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + SessionData.Product.SHeaderBannerURL + " target=\"_blank\" >"); // Replace Banner URL } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace(SessionData.Product.SHeaderBannerImg, hdnBanner.Value); } else { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SHeaderBannerImg + "\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } string ParamAdded = HeaderBannerReplaced.Replace(oldfinalURL, finalURL); string ObjectAdded = ParamAdded.Replace(fixedUrlOld, fixedURL); string DescriptionAdded = ObjectAdded.Replace(oVidShareData.SVideoShareDesc, txtDescription.Text.Trim().Replace("'", "''")); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdatePreviewHTML(DescriptionAdded, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } else { if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) //New image was chosen, then do normal replace, else, bring new image //SessionData.Product.SHeaderBannerURL != txtBannerURL.Text { HeaderBannerURLReplaced = createdHTML.Replace(SessionData.Product.SHeaderBannerURL, txtBannerURL.Text); } else { HeaderBannerURLReplaced = createdHTML.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + SessionData.Product.SHeaderBannerURL + " target=\"_blank\" >"); // Replace Banner URL } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace(SessionData.Product.SHeaderBannerImg, hdnBanner.Value); } else { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SHeaderBannerImg + "\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } string ParamAdded = HeaderBannerReplaced.Replace(oldfinalURL, finalURL); string ObjectAdded = ParamAdded.Replace(fixedUrlOld, fixedURL); string DescriptionAdded = ObjectAdded.Replace(oVidShareData.SVideoShareDesc, txtDescription.Text.Trim().Replace("'", "''")); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdatePreviewHTML(DescriptionAdded, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } } else { if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerURLReplaced = createdHTML.Replace(SessionData.Product.SHeaderBannerURL, txtBannerURL.Text); } else { HeaderBannerURLReplaced = createdHTML.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + SessionData.Product.SHeaderBannerURL + " target=\"_blank\" >"); // Replace Banner URL } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) //New image was chosen, then do normal replace, else, bring new image { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace(SessionData.Product.SHeaderBannerImg, hdnBanner.Value); } else { HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + SessionData.Product.SHeaderBannerImg + "\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\" />"); //check if canvas settings have changed, if so, need to resize existing image } string ParamAdded = HeaderBannerReplaced.Replace(oldfinalURL, finalURL); string ObjectAdded = ParamAdded.Replace(fixedUrlOld, fixedURL); string DescriptionAdded = ObjectAdded.Replace(oVidShareData.SVideoShareDesc, txtDescription.Text.Trim().Replace("'", "''")); //make all videos play automatically string autoPlayed = DescriptionAdded.Replace("autoplay=0", "autoplay=0"); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.UpdatePreviewHTML(autoPlayed, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } } else { } } else { } if (hdnFileBannerHasFile.Value.Equals(HASFILE)) { SessionData.Product.SHeaderBannerImg = hdnBanner.Value; } // Add Banner URL if (!(string.IsNullOrEmpty(txtBannerURL.Text.Trim()))) { SessionData.Product.SHeaderBannerURL = txtBannerURL.Text.Trim(); } if (!(SessionData.Config == null)) { if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(datepickerEnd.Value, true); } //Now fill up the Config and get Product data. if (fbBiz.UpdateConfigDetails(SessionData.Config, PROMOTIONS, SessionData.Config.SCustomtTabName)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, SessionData.Customer.CustomerID); fbBiz.UpdateProductDetails(SessionData.Product); } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }
protected void btnStep3Complete_Click(object sender, EventArgs e) { try { //Fetch Template Data dsTemplateData = canv.GetTempData(Convert.ToInt32(templateID)); //REVISIT hdnTrmplateID.Value = templateID; //Save Widgets info and Cust Tab name, then move to FB tab //Custom Tab Name if (!txtCustomTabNamePromoVid.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromoVid.Text.Trim(); } //Widgets if (chkShareButton.Checked) { SessionData.Product.ShareWidgetAdded = "Y"; } if (chkInquiry.Checked) { SessionData.Product.InquiryWidgetAdded = "Y"; } if (chkRecc.Checked) { SessionData.Product.ReccWidgetAdded = "Y"; } if (chkComment.Checked) { SessionData.Product.CommentsWidgetAdded = "Y"; } if (chkLike.Checked) { SessionData.Product.LikeWidgetAdded = "Y"; } if (chkTweeter.Checked) { SessionData.Product.TwitterWidgetAdded = "Y"; } //Like Gateway if (chkLikeGateway.Checked) { SessionData.Product.LikeGatewayAdded = "Y"; //Save LikeGateway Image if (filePromo2LikeGateWayImage.HasFile) { if (filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpeg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/png" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/jpg" || filePromo2LikeGateWayImage.PostedFile.ContentType == "image/pjpeg") { if (filePromo2LikeGateWayImage.FileBytes.Length < ONE_MB) { string filenamePromo2Logo = Path.GetFileName(filePromo2LikeGateWayImage.FileName); Bitmap sourceImage = new Bitmap(filePromo2LikeGateWayImage.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/LikeGateway" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; //NOW SAVE TO PRODUCT TABLE------> PRODUCTFOOTER } else { spnErrorfileLikeGateWayImage.InnerHtml = "File size should not be greater than 1 MB"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } else { spnErrorfileLikeGateWayImage.InnerHtml = "Upload status: Only JPEG, PNG files are accepted!"; spnErrorfileLikeGateWayImage.Style.Add("color", "Red"); errCount++; } } } FacebookBizProcess fbBiz = new FacebookBizProcess(); FaceBook ofacebook = new FaceBook(); AppUser oAppUser = new AppUser(); if ((Regex.IsMatch(txtVideoURL.Text.Trim(), @"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?")) && (txtVideoURL.Text.Trim().Contains("youtube"))) { iframecontent = ofacebook.GetEmbedURL(txtVideoURL.Text.Trim(), oAppUser); string fixedURL = FixVideoURL(iframecontent); //Now save the Video details fbBiz.InsertVideoShareData(SessionData.Config.DID, txtVideoURL.Text.Trim(), fixedURL, txtDescription.Text.Trim()); if (!iframecontent.Equals(string.Empty)) { string[] newEmbedURL = iframecontent.Split(' '); string finalURL = newEmbedURL[3].Remove(0, 4); if (!txtVideoURL.Text.Contains("autoplay")) { if (!txtVideoURL.Text.Contains("?")) { string tempData6 = dsTemplateData.Tables[0].Rows[0]["thtml"].ToString(); //Fill up Preview Data string HeaderBannerURLReplaced = tempData6.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + txtBannerURL.Text + " target=\"_blank\" >"); // Replace Banner URL string HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\"/>"); // Replace Banner Image string ParamAdded = HeaderBannerReplaced.Replace("<paramss>", "<param name=\"movie\" value=\"" + finalURL + "?autoplay=0\">"); string ObjectAdded = ParamAdded.Replace("<iframe>", fixedURL); string DescriptionAdded = ObjectAdded.Replace("</span>", txtDescription.Text.Trim().Replace("'", "''") + "</span>"); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.InsertPreviewHTML(DescriptionAdded, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } else { string tempData6 = dsTemplateData.Tables[0].Rows[0]["thtml"].ToString(); //Fill up Preview Data string HeaderBannerURLReplaced = tempData6.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + txtBannerURL.Text + " target=\"_blank\" >"); // Replace Banner URL string HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\"/>"); // Replace Banner Image string ParamAdded = HeaderBannerReplaced.Replace("<paramss>", "<param name=\"movie\" value=" + "\"" + finalURL + "&autoplay=0\">"); string ObjectAdded = ParamAdded.Replace("<iframe>", fixedURL); string DescriptionAdded = ObjectAdded.Replace("NIOTPESRIC", txtDescription.Text.Trim().Replace("'", "''")); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.InsertPreviewHTML(DescriptionAdded, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } } else { string tempData6 = dsTemplateData.Tables[0].Rows[0]["thtml"].ToString(); //Fill up Preview Data string HeaderBannerURLReplaced = tempData6.Replace(" <a id=\"aHeadBanner\" href=\"\" target=\"_blank\">", "<a id=\"aHeadBanner\" href=" + txtBannerURL.Text + " target=\"_blank\" >"); // Replace Banner URL string HeaderBannerReplaced = HeaderBannerURLReplaced.Replace("<img id=\"imgBanner\" alt=\"\" src=\"\" style=\"width: 500px; height: 100px;\" />", "<img id=\"imgBanner\" alt=\"\" src=\"Images/" + SessionData.Product.DID + "/" + "Banner" + hdnBanner.Value + "\" style=\"width: 500px; height: 100px;\"/>"); // Replace Banner Image string ParamAdded = HeaderBannerReplaced.Replace("<paramss>", "<param name=\"movie\" value=\"" + finalURL + "\">"); string ObjectAdded = ParamAdded.Replace("<iframe>", iframecontent); string DescriptionAdded = ObjectAdded.Replace("NIOTPESRIC", txtDescription.Text.Trim().Replace("'", "''")); //make all videos play automatically string autoPlayed = DescriptionAdded.Replace("autoplay=0", "autoplay=0"); using (CanvasBizProcess canvasBiz = new CanvasBizProcess()) { canvasBiz.InsertPreviewHTML(autoPlayed, SessionData.Customer.CustomerID, SessionData.Product.DID); } varCount++; } } else { } } else { } // Set Header Banner URL and Header Image in Product SessionData.Product.SHeaderBannerURL = txtBannerURL.Text; SessionData.Product.SHeaderBannerImg = hdnBanner.Value; SessionData.Product.ProductLogo = "https://www.sonetreach.com/Images/" + SessionData.Product.DID + "/Logo" + SessionData.Product.ProductLogo; SessionData.Product.SProductContentImage = "Body" + hdnContent.Value; if (!(SessionData.Config == null)) { //Apply Campaign Dates to Config if (datepickerStart.Value != "") { SessionData.Config.SAppStartDT = SQLSafeDates(datepickerStart.Value, true); SessionData.Config.AppExpiryDT = SQLSafeDates(datepickerEnd.Value, true); } //Now fill up the Config and get Product data. SessionData.Config.SCampaignType = Video; if (fbBiz.SetNewConfigDetails(SessionData.Config, SessionData.Config.SCustomtTabName,Video)) { ////********If user comes here we know we should set up a Product Info, So, create a row in AppProduct and assign these values to SessionData******** SessionData.Product.AppConfigDID = SessionData.Config.DID; SessionData.Product.ProductName = SessionData.Config.AppName; SessionData.Product.ProductHTML = canv.FetchFinalHTML(SessionData.Product.DID, CDID); fbBiz.SetNewProductDetails(SessionData.Product); SessionData.Product = fbBiz.GetAppProductDetails(); // Now Enable the Facebook Tab } } else { //No configs allowed Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Config Not Available. Please Contact HELPDESK.\")", true); } HtmlGenericControl fbookShow = new HtmlGenericControl(); fbookShow = (HtmlGenericControl)MainList.FindControl("FacebookDet"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_THREE_COMPLETE; } catch (Exception ex) { commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }