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(); } //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 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 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 btnPublish_Click(object sender, EventArgs e) { try { //SessionData.Config = new AppConfiguration(); if (SessionData.PrefData.TaskTwo1.Equals(MICROSITE)) { CopyToMicrosites(SessionData.UserAction.SiteID1, txtSubDomainName.Text.Trim()); } if (SessionData.PrefData.TaskTwo1.Equals(YOUTUBE)) { //ask for uploading video and save in Userfiles if (fileYoutubeVideo.HasFile) { string filename = fileYoutubeVideo.FileName; string path = Server.MapPath("./Youtube/" + SessionData.UserAction.SiteID1); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string strFinalFileName = Path.GetFileName(fileYoutubeVideo.FileName); long FileLength = fileYoutubeVideo.PostedFile.ContentLength; fileYoutubeVideo.PostedFile.SaveAs(path + "/" + filename); if (UploadToYoutube(filename)) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"Youtube video uploaded !\")", true); SessionData.UserAction.TaskComplete = YOUTUBE; } } } SessionData.Product = new AppProduct(); SessionData.Product.DID = GetNewDIDWithPrefix(); //Prepare file system directory to store Images string pathToCreate = "~/Images/" + SessionData.Product.DID; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } //Fetch Template Data dsTemplateData = canv.GetTempData(Convert.ToInt32(templateID)); //REVISIT hdnTrmplateID.Value = templateID; hdnPDID.Value = SessionData.Product.DID; hdnfield.Value = CDID; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } //Caption //if (!string.IsNullOrEmpty(txtHeaderText.Text)) //{ // SessionData.Product.AppCaption = txtHeaderText.Text; //} SessionData.Product.ProductCategory = WH_CREATED; //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 = new AppConfiguration(); AppConfiguration oAppAvaila = new AppConfiguration(); oAppAvaila = fbBiz.GetAvailableConfig(CDID); SessionData.Config = oAppAvaila; SessionData.Config.DID = GetNewDID("AN"); //Custom Tab Name if (!txtCustomTabNamePromoVid.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromoVid.Text.Trim(); SessionData.UserAction.CustomTabName1 = txtCustomTabNamePromoVid.Text.Trim(); } SessionData.Config.STemplatePage = TEMPLATE_PAGE; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "alert(\"You can only create 3 Campaigns with a TRIAL account !\")", true); } FaceBook ofacebook = new FaceBook(); AppUser oAppUser = new AppUser(); SessionData.Config.SSiteID = SiteID; SessionData.Config.STemplateID = SessionData.PrefData.TemplateID1; 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)) { //Now fill up the Config and get Product data. SessionData.Config.SCampaignType = Video; if (fbBiz.SetNewConfigDetails(SessionData.Config, SessionData.Config.SCustomtTabName, Video)) { //Update expiry date fbBiz.UpdateConfigExpiryForWH(SessionData.Config.DID); ////********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 = ""; 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); } if (SessionData.Config.SAppPageTabSelected == null) { StringBuilder oSBPageSElector = new StringBuilder(); oSBPageSElector.Append("window.open('http://www.facebook.com/dialog/permissions.request?app_id="); oSBPageSElector.Append(SessionData.Config.AppID + "&redirect_uri=" + ActiveURL + SessionData.Config.AppID + "&response_type=code&perms=user_birthday,user_location,email,manage_pages\','name','height=140,width=790,menubar=0,toolbar=0,statusbar=0,scrollbars=0,resizable=0');"); litLogin.Text = oSBPageSElector.ToString(); } } catch (Exception ex) { //commonUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); throw ex; } }
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 btnStep2Complete_Click(object sender, EventArgs e) { try { SessionData.Product = new AppProduct(); SessionData.Product.DID = GetNewDIDWithPrefix(); //Prepare file system directory to store Images string pathToCreate = "~/Images/" + SessionData.Product.DID; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } //Logo Image if (filePromoVideoLogo.HasFile) { if (filePromoVideoLogo.PostedFile.ContentType == "image/jpeg" || filePromoVideoLogo.PostedFile.ContentType == "image/png" || filePromoVideoLogo.PostedFile.ContentType == "image/jpg" || filePromoVideoLogo.PostedFile.ContentType == "image/pjpeg") { if (filePromoVideoLogo.FileBytes.Length < ONE_MB) { string filenamePromo2Logo = Path.GetFileName(filePromoVideoLogo.FileName); Bitmap sourceImage = new Bitmap(filePromoVideoLogo.PostedFile.InputStream); SaveImageFile(sourceImage, Server.MapPath(pathToCreate + "/Logo" + filenamePromo2Logo), 111, 74); hdnFooterLogo.Value = filenamePromo2Logo; SessionData.Product.ProductLogo = filenamePromo2Logo; } else { } } else { } } //Fetch Template Data dsTemplateData = canv.GetTempData(Convert.ToInt32(templateID)); //REVISIT hdnTrmplateID.Value = templateID; hdnPDID.Value = SessionData.Product.DID; hdnfield.Value = CDID; if (!Directory.Exists(Server.MapPath(pathToCreate))) { Directory.CreateDirectory(Server.MapPath(pathToCreate)); } //Custom Tab Name if (!txtCustomTabNamePromoVid.Text.Trim().Equals(string.Empty)) { SessionData.Config.SCustomtTabName = txtCustomTabNamePromoVid.Text.Trim(); } //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; } //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); //Add Inquiry Data if (!(string.IsNullOrEmpty(txtInquiryEmail.Text.Trim()))) { SessionData.Config.SInquiryEmail = txtInquiryEmail.Text.Trim(); } SessionData.Config.STemplatePage = TEMPLATE_PAGE; 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); } } 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("Widgets"); fbookShow.Style.Add("display", "block"); hdnTabStatus.Value = STEP_TWO_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); } }