protected void PostIt(object sender, EventArgs e) { object appSeshCountry; object appSeshState; object appSeshCity; object appSeshZip; object appSeshRadius; HttpCookie cookie = Request.Cookies["BrowserDate"]; DateTime isn = DateTime.Now; if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn)) isn = DateTime.Now; DateTime isNow = isn; Data dat = new Data(isn); string state = ""; AuthorizePayPal d = new AuthorizePayPal(); if (AgreeCheckBox.Checked) { bool chargeCard = false; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString()); conn.Open(); //Add case for if Paypal is filled in... //Authorize Credit Card decimal price = 0.00M; bool goOn = false; string message = ""; string transactionID = ""; if (FeaturePanel.Visible && TotalLabel.Text.Trim() != "") { if (decimal.TryParse(TotalLabel.Text.Trim(), out price)) { if (price != 0.00M) { if (PaymentPanel.Visible) { if (FirstNameTextBox.Text.Trim() == "" || LastNameTextBoxtBox.Text.Trim() == "" || BillingStreetAddressTextBox.Text.Trim() == "" || BillingCityTextBox.Text.Trim() == "" || BillingZipCodeTextBox.Text.Trim() == "" || BillingStateTextBox.Text.Trim() == "" || CardNumberTextBox.Text.Trim() == "" || CSVTextBox.Text.Trim() == "") { goOn = false; Session["Featured"] = false; message = "Please fill in all of the billing information."; } else { goOn = false; Session["Featured"] = false; string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString(); com.paypal.sdk.util.NVPCodec status = d.DoPayment("Authorization", TotalLabel.Text, CardTypeDropDown.SelectedValue, CardNumberTextBox.Text.Trim(), ExpirationMonth.SelectedItem.Text, ExpirationYear.SelectedItem.Text, CSVTextBox.Text.Trim(), FirstNameTextBox.Text.Trim(), LastNameTextBoxtBox.Text.Trim(), BillingStreetAddressTextBox.Text.Trim(), BillingCityTextBox.Text, BillingStateTextBox.Text, country, BillingZipCodeTextBox.Text.Trim(), dat.GetIP()); message = status.ToString(); string successORFailure = status["ACK"]; switch (successORFailure.ToLower()) { case "failure": goOn = false; Session["Featured"] = false; message = status["L_LONGMESSAGE0"]; break; case "successwithwarning": goOn = false; Session["Featured"] = false; message = status["L_SHORTMESSAGE0"]; if (message == "Transaction approved but with invalid CSC format.") message = "Your CVC/CSV format for this card is not valid."; break; case "success": transactionID = status["TRANSACTIONID"]; Session["TransID"] = transactionID; goOn = true; chargeCard = true; Session["Featured"] = true; break; default: goOn = false; Session["Featured"] = false; message = "There was an internal problem. Please contact support at: [email protected]. Please include as much detail as possible about what you are trying to do."; foreach (string key in status.Keys) { message += "key: " + key.ToString() + ", value: " + status[key].ToString() + "<br/>"; } break; } } } else { goOn = true; Session["Featured"] = true; } } else { if (SearchTermsListBox.Items.Count > 0 && price == 0.00M) { goOn = false; Session["Featured"] = false; message = "You have entered search terms, but, have not included any dates."; } else { goOn = true; Session["Featured"] = false; } } } else { goOn = true; Session["Featured"] = false; } } else { goOn = true; Session["Featured"] = false; } if (goOn) { bool isEdit = false; DateTime LastFetUpdate = DateTime.Now; if (Request.QueryString["edit"] != null) { isEdit = bool.Parse(Request.QueryString["edit"].ToString()); } string mediaCat = "0"; if (PictureCheckList.Items.Count > 0) mediaCat = "1"; string command = ""; DataSet dsEvent; bool wasFeatured = false; DataView dvRenu = new DataView(); if (isEdit) { dsEvent = dat.GetData("SELECT * FROM Ads WHERE Ad_ID=" + adID.Text); wasFeatured = bool.Parse(dsEvent.Tables[0].Rows[0]["Featured"].ToString()); LastFetUpdate = DateTime.Parse(dsEvent.Tables[0].Rows[0]["LastFetUpdate"].ToString()); //numViews = int.Parse(dsEvent.Tables[0].Rows[0]["NumViews"].ToString()); string rad = ""; //if (RadiusPanel.Visible) // rad = ", Radius=@radius "; dvRenu = dat.GetDataDV("SELECT * FROM Ads WHERE Ad_ID=" + adID.Text); command = "UPDATE Ads SET LastFetUpdate=@fetUpdate, DatesOfAd=@dates, Template=@template, hasSongs=@songs, User_ID=@userID, FeaturedSummary=@featuredSummary , " + "Description=@description, Featured=@featured, Header=@header, CountShown=@countShown, mediaCategory=" + mediaCat + ", " + "FeaturedPicture=@featuredPicture, FeaturedPictureName=@featuredPictureName, CatCountry=@catCountry, " + "CatState=@catState, CatCity=@catCity WHERE Ad_ID=" + adID.Text; } else { string rad = ""; string radEnd = ""; //if (RadiusPanel.Visible) //{ // rad = ", Radius "; // radEnd = ", @radius "; //} command = "INSERT INTO Ads (LastFetUpdate, DatesOfAd, Template, hasSongs, User_ID, FeaturedSummary ,Description, Header, " + "CountShown, Featured, mediaCategory, FeaturedPicture, FeaturedPictureName, CatCountry, CatState, CatCity, " + " DateAdded) " + " VALUES('" + DateTime.Now.ToString() + "', @dates, @template, @songs, @userID, @featuredSummary, @description, @header, @countShown, " + "@featured, " + mediaCat + ", @featuredPicture, @featuredPictureName, @catCountry, @catState, @catCity, '" + DateTime.Now.ToString() + "')"; } SqlCommand cmd = new SqlCommand(command, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@description", SqlDbType.NVarChar).Value = DescriptionTextBox.Content; cmd.Parameters.Add("@userID", SqlDbType.Int).Value = int.Parse(Session["User"].ToString()); string fetDays = ""; bool newDates = false; foreach (ListItem item in FeatureDatesListBox.Items) { fetDays += ";" + item.Text + ";"; if (item.Value != "Disabled") newDates = true; } if (wasFeatured) { if (newDates) cmd.Parameters.Add("@fetUpdate", SqlDbType.DateTime).Value = DateTime.Now; else cmd.Parameters.Add("@fetUpdate", SqlDbType.DateTime).Value = LastFetUpdate; cmd.Parameters.Add("@featured", SqlDbType.Bit).Value = true; if (FeaturePanel.Visible) { cmd.Parameters.Add("@dates", SqlDbType.NVarChar).Value = fetDays; } else cmd.Parameters.Add("@dates", SqlDbType.NVarChar).Value = dvRenu[0]["DatesOfAd"].ToString(); } else { cmd.Parameters.Add("@fetUpdate", SqlDbType.DateTime).Value = DateTime.Now; cmd.Parameters.Add("@featured", SqlDbType.Bit).Value = FeaturePanel.Visible; if (FeaturePanel.Visible) { cmd.Parameters.Add("@dates", SqlDbType.NVarChar).Value = fetDays; } else { cmd.Parameters.Add("@dates", SqlDbType.NVarChar).Value = DBNull.Value; } } if (FeaturePanel.Visible) { if (BannerAdCheckBox.Checked) { cmd.Parameters.Add("@template", SqlDbType.Int).Value = TemplateRadioList.SelectedValue; } else { cmd.Parameters.Add("@template", SqlDbType.Int).Value = 1; } } else { if (wasFeatured) cmd.Parameters.Add("@template", SqlDbType.Int).Value = dvRenu[0]["Template"].ToString(); else cmd.Parameters.Add("@template", SqlDbType.Int).Value = DBNull.Value; } cmd.Parameters.Add("@songs", SqlDbType.Bit).Value = false; if (FeaturePanel.Visible) cmd.Parameters.Add("@featuredSummary", SqlDbType.NVarChar).Value = SummaryTextBox.InnerHtml; else { if (wasFeatured) cmd.Parameters.Add("@featuredSummary", SqlDbType.NVarChar).Value = dvRenu[0]["FeaturedSummary"].ToString(); else cmd.Parameters.Add("@featuredSummary", SqlDbType.NVarChar).Value = DBNull.Value; } cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = AdNameTextBox.Text; cmd.Parameters.Add("@countShown", SqlDbType.Int).Value = 0; if (FeaturePanel.Visible) if (AdPictureCheckList.Items.Count > 0 && AdMediaPanel.Visible) { cmd.Parameters.Add("@featuredPicture", SqlDbType.NVarChar).Value = AdPictureCheckList.Items[0].Value; cmd.Parameters.Add("@featuredPictureName", SqlDbType.NVarChar).Value = AdPictureCheckList.Items[0].Text; } else { cmd.Parameters.Add("@featuredPicture", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@featuredPictureName", SqlDbType.NVarChar).Value = DBNull.Value; } else { if (wasFeatured) { cmd.Parameters.Add("@featuredPicture", SqlDbType.NVarChar).Value = dvRenu[0]["FeaturedPicture"].ToString(); cmd.Parameters.Add("@featuredPictureName", SqlDbType.NVarChar).Value = dvRenu[0]["FeaturedPictureName"].ToString(); } else { cmd.Parameters.Add("@featuredPicture", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@featuredPictureName", SqlDbType.NVarChar).Value = DBNull.Value; } } if (CountryDropDown.SelectedIndex != -1) { appSeshCountry = CountryDropDown.SelectedValue; cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = CountryDropDown.SelectedValue; if (StateDropDownPanel.Visible) { if (StateDropDown.SelectedIndex != -1) state = StateDropDown.SelectedItem.Text; } else state = StateTextBox.Text; appSeshState = state; if (state != "") cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = state; else cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value; string city = ""; if (CityDropDownPanel.Visible) city = MajorCityDrop.SelectedItem.Text; else city = CityTextBox.Text; appSeshCity = city; cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = city; } else { cmd.Parameters.Add("@catCountry", SqlDbType.Int).Value = DBNull.Value; cmd.Parameters.Add("@catState", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@catCity", SqlDbType.NVarChar).Value = DBNull.Value; } //Media Categories: NONE: 0, Slider: 1. bool isSlider = false; if (PictureCheckList.Items.Count > 0) isSlider = true; cmd.ExecuteNonQuery(); cmd = new SqlCommand("SELECT @@IDENTITY AS ID", conn); SqlDataAdapter da2 = new SqlDataAdapter(cmd); DataSet ds3 = new DataSet(); da2.Fill(ds3); string ID = ds3.Tables[0].Rows[0]["ID"].ToString(); if (isEdit) ID = Request.QueryString["ID"].ToString(); #region Take care of search terms if (FeaturePanel.Visible) { string terms = ""; foreach (ListItem item in SearchTermsListBox.Items) { terms += ";" + item.Text + ";"; } foreach (ListItem item in FeatureDatesListBox.Items) { if (item.Value != "Disabled") dat.Execute("INSERT INTO AdSearchTerms (AdID, SearchTerms, SearchDate) VALUES(" + ID + ", '" + terms.Replace("'", "''") + "', '" + item.Text + "')"); } } #endregion string theID = ID; if (isEdit) { theID = adID.Text; } //if (MusicCheckBox.Checked) //{ // if (isEdit) // { // dat.Execute("DELETE FROM Ad_Song_Mapping WHERE AdID="+theID); // } // for (int i = 0; i < SongCheckList.Items.Count; i++) // { // cmd = new SqlCommand("INSERT INTO Ad_Song_Mapping (AdID, SongName, SongTitle) "+ // "VALUES(@eventID, @songName, @songTitle)", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = int.Parse(theID); // cmd.Parameters.Add("@songName", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Value.ToString(); // cmd.Parameters.Add("@songTitle", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Text; // cmd.ExecuteNonQuery(); // dat.Execute("UPDATE Ads SET hasSongs=1 WHERE Ad_ID="+theID); // } //} if (isEdit) { dat.Execute("DELETE FROM Ad_Slider_Mapping WHERE AdID=" + theID); } if (MainAttractionCheck.Checked) { if (isSlider) { char[] delim2 = { '\\' }; string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\"); if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\" + theID); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID)) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID); } } } } string YouTubeStr = ""; char[] delim3 = { '.' }; for (int i = 0; i < PictureCheckList.Items.Count; i++) { int length = fileArray[i].Split(delim2).Length; string[] tokens = PictureCheckList.Items[i].Value.ToString().Split(delim3); if (tokens.Length >= 2) { if (tokens[1].ToUpper() == "JPG" || tokens[1].ToUpper() == "JPEG" || tokens[1].ToUpper() == "GIF" || tokens[1].ToUpper() == "PNG") { if (!System.IO.File.Exists(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID + "\\" + PictureCheckList.Items[i].Value)) { System.IO.File.Copy(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + PictureCheckList.Items[i].Value, MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + "\\AdSlider\\" + theID + "\\" + PictureCheckList.Items[i].Value); } cmd = new SqlCommand("INSERT INTO Ad_Slider_Mapping (AdID, PictureName, RealPictureName) " + "VALUES (@eventID, @picName, @realName)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = theID; cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } } else { YouTubeStr += PictureCheckList.Items[i].Value + ";"; } } //if (YouTubeStr != "") //{ dat.Execute("UPDATE Ads SET YouTubeVideo='" + YouTubeStr + "' WHERE Ad_ID=" + theID); //} } } else { } if (isEdit) { dat.Execute("DELETE FROM Ad_Category_Mapping WHERE AdID=" + theID); } CreateCategories(theID); string adFeatured = ""; string adFeaturedEmail = ""; DataSet dsUser = dat.GetData("SELECT Email, UserName FROM USERS WHERE User_ID=" + Session["User"].ToString()); try { bool showMessage = false; if (chargeCard) { Encryption encrypt = new Encryption(); //Charge Card string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString(); com.paypal.sdk.util.NVPCodec status = d.DoCaptureCode(transactionID, price.ToString(), "B" + theID + isn.ToString(), "Capture Transaction for Featuring Bulletin '" + dat.MakeNiceNameFull(AdNameTextBox.Text) + "'"); //message = status.ToString(); string successORFailure = status["ACK"]; switch (successORFailure.ToLower()) { case "failure": MessagePanel.Visible = true; YourMessagesLabel.Text += status["L_LONGMESSAGE0"]; //MessagePanel.Visible = true; //foreach (string key in status.Keys) //{ // YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>"; //} break; case "success": showMessage = true; break; default: MessagePanel.Visible = true; foreach (string key in status.Keys) { YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>"; } break; } } else { showMessage = true; } if (showMessage) { string emailBody = "Dear " + dsUser.Tables[0].Rows[0]["UserName"].ToString() + ", <br/><br/> you have successfully posted the bulletin \"" + AdNameTextBox.Text + "\". <br/><br/> You can find this bulletin <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(AdNameTextBox.Text) + "_" + theID + "_Ad\">here</a>. " + adFeaturedEmail + "<br/><br/> To rate your experience posting this bulletin <a href=\"http://hippohappenings.com/RateExperience.aspx?Type=A&ID=" + theID + "\">please include your feedback here.</a>" + "<br/><br/><br/>Have a HippoHappening Day!<br/><br/>"; if (isEdit) { emailBody = "Dear " + dsUser.Tables[0].Rows[0]["UserName"].ToString() + ", <br/><br/> you have successfully edited the bulletin \"" + AdNameTextBox.Text + "\". <br/><br/> You can find this bulletin <a href=\"http://hippohappenings.com/" + dat.MakeNiceName(AdNameTextBox.Text) + "_" + theID + "_Ad\">here</a>. " + adFeaturedEmail + "<br/><br/> To rate your experience editing this bulletin <a href=\"http://hippohappenings.com/RateExperience.aspx?Type=A&ID=" + theID + "\">please include your feedback here.</a>" + "<br/><br/><br/>Have a HippoHappening Day!<br/><br/>"; } if (!Request.IsLocal) { dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(), System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), dsUser.Tables[0].Rows[0]["Email"].ToString(), emailBody, "You have successfully posted the bulletin: " + AdNameTextBox.Text); } conn.Close(); Session["Message"] = "Your bulletin has been posted successfully!<br/> Here are your next steps: <br/>"; if (isEdit) { Session["Message"] = "Your bulletin has been edited successfully!<br/> Here are your next steps: <br/>"; } //Clear cache so that the PlayerList.xml can be grabbed by the browser again. ClearCache(); Session["Message"] += "<br/>" + "Go to <a class=\"AddLink\" onclick=\"Search('" + dat.MakeNiceName(AdNameTextBox.Text) + "_" + theID + "_Ad');\">your bulletin's</a> home page." + adFeatured + "<br/><br/> -<a class=\"AddLink\" onclick=\"Search('RateExperience.aspx?Type=A&ID=" + theID + "');\" >Rate </a>your user experience posting this bulletin.<br/>"; //MessageLiteral.Text = "<script type=\"text/javascript\">alert('" + message + "');</script>"; Encryption encrypt = new Encryption(); MessageRadWindow.NavigateUrl = "Message.aspx?message=" + encrypt.encrypt(Session["Message"].ToString() + "<br/><br/><div align=\"center\">" + "<div style=\"width: 50px;\" onclick=\"Search('home')\">" + "<div class=\"topDiv\" style=\"clear: both;\">" + " <img style=\"float: left;\" src=\"NewImages/ButtonLeft.png\" height=\"27px\" /> " + " <div class=\"NavyLink\" style=\"font-size: 12px; text-decoration: none; padding-top: 5px;padding-left: 6px; padding-right: 6px;height: 27px;float: left;background: url('NewImages/ButtonPixel.png'); background-repeat: repeat-x;\">" + " OK " + "</div>" + " <img style=\"float: left;\" src=\"NewImages/ButtonRight.png\" height=\"27px\" /> " + "</div>" + "</div>" + "</div><br/>"); MessageRadWindow.Visible = true; MessageRadWindowManager.VisibleOnPageLoad = true; Session["categorySession"] = null; } } catch (Exception ex) { MessagePanel.Visible = true; YourMessagesLabel.Text += ex.ToString(); } } else { MessagePanel.Visible = true; YourMessagesLabel.Text = message; } } else { MessagePanel.Visible = true; YourMessagesLabel.Text += "You must agree to the terms and conditions."; } }
protected void PostIt(object sender, EventArgs e) { MessagePanel.Visible = false; YourMessagesLabel.Text = ""; string problem = ""; bool hasEditChanged = false; bool chargeCard = false; AuthorizePayPal d = new AuthorizePayPal(); HttpCookie cookie = Request.Cookies["BrowserDate"]; DateTime isn = DateTime.Now; if (!DateTime.TryParse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"), out isn)) isn = DateTime.Now; DateTime isNow = isn; Data dat = new Data(isn); string email = ""; try { if (OnwardsIT()) { //Add case for if Paypal is filled in... //Authorize Credit Card bool goOn = false; string message = ""; decimal price = 0.00M; string transactionID = ""; if (AgreeCheckBox.Checked) { if (TotalLabel.Text.Trim() != "") { if (decimal.TryParse(TotalLabel.Text.Trim(), out price)) { if (price != 0.00M) { if (FirstNameTextBox.Text.Trim() == "" || LastNameTextBoxtBox.Text.Trim() == "" || BillingStreetAddressTextBox.Text.Trim() == "" || BillingCityTextBox.Text.Trim() == "" || BillingZipCodeTextBox.Text.Trim() == "" || BillingStateTextBox.Text.Trim() == "" || CardNumberTextBox.Text.Trim() == "" || CSVTextBox.Text.Trim() == "") { goOn = false; Session["Featured"] = false; message = "Please fill in all of the billing information."; } else { goOn = false; Session["Featured"] = false; string country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString(); com.paypal.sdk.util.NVPCodec status = d.DoPayment("Authorization", TotalLabel.Text, CardTypeDropDown.SelectedValue, CardNumberTextBox.Text.Trim(), ExpirationMonth.SelectedItem.Text, ExpirationYear.SelectedItem.Text, CSVTextBox.Text.Trim(), FirstNameTextBox.Text.Trim(), LastNameTextBoxtBox.Text.Trim(), BillingStreetAddressTextBox.Text.Trim(), BillingCityTextBox.Text, BillingStateTextBox.Text, country, BillingZipCodeTextBox.Text.Trim(), dat.GetIP()); message = status.ToString(); string successORFailure = status["ACK"]; switch (successORFailure.ToLower()) { case "failure": goOn = false; Session["Featured"] = false; message = status["L_LONGMESSAGE0"]; break; case "successwithwarning": goOn = false; Session["Featured"] = false; message = status["L_SHORTMESSAGE0"]; if (message == "Transaction approved but with invalid CSC format.") message = "Your CVC/CSV format for this card is not valid."; break; case "success": chargeCard = true; transactionID = status["TRANSACTIONID"]; Session["TransID"] = transactionID; goOn = true; Session["Featured"] = true; break; default: goOn = false; Session["Featured"] = false; message = "There was an internal problem. Please contact support at: [email protected]. Please include as much detail as possible about what you are trying to do."; foreach (string key in status.Keys) { message += "key: " + key.ToString() + ", value: " + status[key].ToString() + "<br/>"; } break; } } } else { goOn = true; Session["Featrued"] = false; } } else { goOn = true; Session["Featured"] = false; } } else { goOn = true; Session["Featured"] = false; } if (goOn) { string textEmail = ""; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString()); conn.Open(); string mediaCat = "0"; if (PictureCheckList.Items.Count > 0) mediaCat = "1"; bool isOwner = false; string ownerID = ""; bool ownerUpForGrabs = false; bool wasFeatured = false; bool isEditing = false; if (isEdit.Text != "") { isEditing = bool.Parse(isEdit.Text); ownerUpForGrabs = dat.IsOwnerUpForGrabs(Request.QueryString["ID"].ToString(), ref ownerID, ref isOwner, false); } bool hadSongs = false; DataSet dsEvent = new DataSet(); DataView dvEvent = new DataView(); string theCat = "NULL"; if (isEditing) { dsEvent = dat.GetData("SELECT * FROM Events WHERE ID=" + eventID.Text); dvEvent = dat.GetDataDV("SELECT * FROM Events WHERE ID=" + eventID.Text); wasFeatured = bool.Parse(dsEvent.Tables[0].Rows[0]["Featured"].ToString()); hadSongs = bool.Parse(dsEvent.Tables[0].Rows[0]["hasSongs"].ToString()); if (dsEvent.Tables[0].Rows[0]["MediaCategory"].ToString() != mediaCat) { theCat = mediaCat; hasEditChanged = true; } } string addAdressBeg = ""; string addAddressEnd = ""; string addAddressUpdate = ""; string privInsertBeg = ", Private "; string privInsertEnd = ", 'False' "; string privUpdate = ", Private = 'False' "; if (LocaleRadioButtonList.SelectedValue == "1") { addAdressBeg = ", Address "; addAddressEnd = ", @address"; addAddressUpdate = ", Address = @address "; privInsertBeg = ", Private "; privInsertEnd = ", 'True' "; privUpdate = ", Private = 'True' "; } string command = ""; if (isEditing) { if (isOwner || ownerUpForGrabs) { string sngs = ""; if (!hadSongs) sngs = "hasSongs=@songs,"; command = "UPDATE Events SET DaysFeatured=@daysFet, " + addAddressUpdate + privUpdate + "Featured=@fet, MinPrice=@min, MaxPrice=@max, Owner=@owner, [Content]=@content, Header=@header, " + "Venue=@venue,SponsorPresenter=@sponsor, " + sngs + " mediaCategory=" + mediaCat + ", " + "ShortDescription=@shortDescription, Country=@country, State=@state, " + "Zip=@zip, City=@city, LastEditOn=@dateP WHERE ID=" + Request.QueryString["ID"].ToString(); } else { command = "INSERT INTO EventRevisions (DaysFeatured," + addAdressBeg + privInsertBeg + "Featured,MinPrice, MaxPrice, EventID, [Content], " + "Header, Venue, modifierID, " + "ShortDescription, Country, State, Zip, City, DATE)" + " VALUES(@daysFet, " + addAddressEnd + privInsertEnd + "@fet,@min, @max, " + eventID.Text + ", @content,@header, @venue, @userName, @shortDescription" + ", @country, @state, @zip, @city, '" + isn.ToString() + "')"; dsEvent = dat.GetData("SELECT * FROM Events WHERE ID=" + eventID.Text); } } else { command = "INSERT INTO Events (DaysFeatured" + addAdressBeg + privInsertBeg + ", Featured,MinPrice, MaxPrice, Owner, [Content], " + "Header, Venue, EventGoersCount, SponsorPresenter, hasSongs, mediaCategory, UserName, " + "ShortDescription, Country, State, Zip, City, StarRating, PostedOn, LastEditOn)" + " VALUES(@daysFet" + addAddressEnd + privInsertEnd + ", @fet, @min, @max, @owner, @content, @header, @venue, " + " @eventGoers, @sponsor, @songs, " + mediaCat + ", @userName, @shortDescription" + ", @country, @state, @zip, @city, 0, @dateP, @dateP)"; } SqlCommand cmd = new SqlCommand(command, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@dateP", SqlDbType.DateTime).Value = DateTime.Now; string fetDays = ""; foreach (ListItem item in FeatureDatesListBox.Items) { fetDays += ";" + item.Text + ";"; } if (wasFeatured) { cmd.Parameters.Add("@fet", SqlDbType.Bit).Value = true; if (FeaturePanel.Visible) { cmd.Parameters.Add("@daysFet", SqlDbType.NVarChar).Value = fetDays; } else cmd.Parameters.Add("@daysFet", SqlDbType.NVarChar).Value = dvEvent[0]["DaysFeatured"].ToString(); } else { cmd.Parameters.Add("@fet", SqlDbType.Bit).Value = FeaturePanel.Visible; if (FeaturePanel.Visible) { cmd.Parameters.Add("@daysFet", SqlDbType.NVarChar).Value = fetDays; } else { cmd.Parameters.Add("@daysFet", SqlDbType.NVarChar).Value = DBNull.Value; } } if (MinTextBox.Text.Trim() != "") { cmd.Parameters.Add("@min", SqlDbType.Decimal).Value = decimal.Parse(MinTextBox.Text.Trim()); } else { cmd.Parameters.Add("@min", SqlDbType.Decimal).Value = DBNull.Value; } if (MaxTextBox.Text.Trim() != "") { cmd.Parameters.Add("@max", SqlDbType.Decimal).Value = decimal.Parse(MaxTextBox.Text.Trim()); } else { cmd.Parameters.Add("@max", SqlDbType.Decimal).Value = DBNull.Value; } if (isEditing && !isOwner) { if (ownerUpForGrabs) { if (OwnerCheckBox.Checked) { hasEditChanged = true; cmd.Parameters.Add("@owner", SqlDbType.Int).Value = Session["User"].ToString(); dat.Execute("INSERT INTO EventOwnerHistory (EventID, OwnerID, DateCreatedOwnership) " + "VALUES(" + eventID.Text + ", " + Session["User"].ToString() + ", '" + isn.ToString() + "')"); } else { if (ownerUpForGrabs) { cmd.Parameters.Add("@owner", SqlDbType.Int).Value = DBNull.Value; } } } else { } if (dsEvent.Tables[0].Rows[0]["Content"].ToString() != DescriptionTextBox.Content) { cmd.Parameters.Add("@content", SqlDbType.NVarChar).Value = DescriptionTextBox.Content; hasEditChanged = true; } else { if (ownerUpForGrabs) { cmd.Parameters.Add("@content", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["Content"].ToString(); } else { cmd.Parameters.Add("@content", SqlDbType.NVarChar).Value = DBNull.Value; } } if (dsEvent.Tables[0].Rows[0]["Header"].ToString() != EventNameTextBox.Text) { cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = EventNameTextBox.Text; hasEditChanged = true; } else { if (ownerUpForGrabs) { hasEditChanged = true; cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["Header"].ToString(); } else { cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = DBNull.Value; } } string shortDesc = DescriptionTextBox.Text; if (shortDesc.Length > 150) shortDesc = shortDesc.Substring(0, 150); if (dsEvent.Tables[0].Rows[0]["ShortDescription"].ToString() != shortDesc) { cmd.Parameters.Add("@shortDescription", SqlDbType.NVarChar).Value = shortDesc; hasEditChanged = true; } else { if (ownerUpForGrabs) { cmd.Parameters.Add("@shortDescription", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["ShortDescription"].ToString(); hasEditChanged = true; } else { cmd.Parameters.Add("@shortDescription", SqlDbType.NVarChar).Value = DBNull.Value; } } //users that are not the owner are not allowed to delete songs or other media //therefore, users can only change the state of 'hasSongs' to 'true', never to 'false' if (ownerUpForGrabs && MusicCheckBox.Checked) { cmd.Parameters.Add("@songs", SqlDbType.Bit).Value = MusicCheckBox.Checked; hasEditChanged = true; } else { cmd.Parameters.Add("@songs", SqlDbType.Bit).Value = dsEvent.Tables[0].Rows[0]["hasSongs"].ToString(); } cmd.Parameters.Add("@sponsor", SqlDbType.NVarChar).Value = DBNull.Value; } else { string shortDesc = DescriptionTextBox.Text; if (shortDesc.Length > 150) shortDesc = shortDesc.Substring(0, 150); hasEditChanged = true; cmd.Parameters.Add("@content", SqlDbType.NVarChar).Value = DescriptionTextBox.Content; cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = EventNameTextBox.Text; cmd.Parameters.Add("@shortDescription", SqlDbType.NVarChar).Value = shortDesc; cmd.Parameters.Add("@songs", SqlDbType.Bit).Value = MusicCheckBox.Checked; if (!isEditing) { cmd.Parameters.Add("@rating", SqlDbType.Int).Value = 0; cmd.Parameters.Add("@userName", SqlDbType.NVarChar).Value = Session["UserName"].ToString(); cmd.Parameters.Add("@eventGoers", SqlDbType.Int).Value = 0; if (OwnerCheckBox.Checked) { cmd.Parameters.Add("@owner", SqlDbType.Int).Value = Session["User"].ToString(); } else { cmd.Parameters.Add("@owner", SqlDbType.Int).Value = DBNull.Value; } } else { if (isOwner) { if (OwnerCheckBox.Checked) cmd.Parameters.Add("@owner", SqlDbType.NVarChar).Value = Session["User"].ToString(); else cmd.Parameters.Add("@owner", SqlDbType.NVarChar).Value = DBNull.Value; } } cmd.Parameters.Add("@sponsor", SqlDbType.NVarChar).Value = DBNull.Value; } #region Create/Assign Venue string country = ""; string state1 = ""; string venue = ""; bool isNewVenue = false; int venueID = 0; if (LocaleRadioButtonList.SelectedValue == "0") { //Need to check if the user is creating a new venue. //First If statement is if a user chose existing venue from dropdown //The Else statement if for the new venue. venueID = int.Parse(Session["NewVenue"].ToString()); DataSet dsVenue = dat.GetData("SELECT * FROM Venues WHERE ID=" + venueID.ToString()); venue = dsVenue.Tables[0].Rows[0]["Name"].ToString(); if (isEditing && !isOwner) { if (dsEvent.Tables[0].Rows[0]["Venue"].ToString() != venueID.ToString()) { hasEditChanged = true; cmd.Parameters.Add("@venue", SqlDbType.Int).Value = venueID; if (dsEvent.Tables[0].Rows[0]["Country"].ToString() != dsVenue.Tables[0].Rows[0]["Country"].ToString()) cmd.Parameters.Add("@country", SqlDbType.Int).Value = dsVenue.Tables[0].Rows[0]["Country"].ToString(); else { if (ownerUpForGrabs) { cmd.Parameters.Add("@country", SqlDbType.Int).Value = dsEvent.Tables[0].Rows[0]["Country"].ToString(); } else { cmd.Parameters.Add("@country", SqlDbType.Int).Value = DBNull.Value; } } if (dsEvent.Tables[0].Rows[0]["State"].ToString() != dsVenue.Tables[0].Rows[0]["State"].ToString()) cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["State"].ToString(); else { if (ownerUpForGrabs) { cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["State"].ToString(); } else { cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = DBNull.Value; } } if (dsEvent.Tables[0].Rows[0]["City"].ToString() != dsVenue.Tables[0].Rows[0]["City"].ToString()) cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["City"].ToString(); else { if (ownerUpForGrabs) { cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["City"].ToString(); } else { cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = DBNull.Value; } } if (dsEvent.Tables[0].Rows[0]["Zip"].ToString() != dsVenue.Tables[0].Rows[0]["Zip"].ToString()) cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["Zip"].ToString(); else { if (ownerUpForGrabs) { cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["Zip"].ToString(); } else { cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = DBNull.Value; } } } else { if (ownerUpForGrabs) { cmd.Parameters.Add("@venue", SqlDbType.Int).Value = dsEvent.Tables[0].Rows[0]["Venue"].ToString(); cmd.Parameters.Add("@country", SqlDbType.Int).Value = dsEvent.Tables[0].Rows[0]["Country"].ToString(); cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["State"].ToString(); cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["City"].ToString(); cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = dsEvent.Tables[0].Rows[0]["Zip"].ToString(); } else { cmd.Parameters.Add("@venue", SqlDbType.Int).Value = DBNull.Value; cmd.Parameters.Add("@country", SqlDbType.Int).Value = DBNull.Value; cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = DBNull.Value; } } } else { cmd.Parameters.Add("@venue", SqlDbType.Int).Value = venueID; cmd.Parameters.Add("@country", SqlDbType.Int).Value = dsVenue.Tables[0].Rows[0]["Country"].ToString(); cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["State"].ToString(); cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["City"].ToString(); cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = dsVenue.Tables[0].Rows[0]["Zip"].ToString(); } country = dsVenue.Tables[0].Rows[0]["Country"].ToString(); state1 = dsVenue.Tables[0].Rows[0]["State"].ToString(); } else { venue = dat.stripHTML(addressTextBox.Text.Trim()); string privState = ""; if (privateStateDropDown.Visible) privState = privateStateDropDown.SelectedItem.Text; else privState = dat.stripHTML(privateStateTextBox.Text.Trim()); cmd.Parameters.Add("@venue", SqlDbType.NVarChar).Value = DBNull.Value; cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value = dat.stripHTML(addressTextBox.Text.Trim()); cmd.Parameters.Add("@country", SqlDbType.Int).Value = privateCountryDropDown.SelectedValue; cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = privState; cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = dat.stripHTML(cityTextBox.Text.Trim()); cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = dat.stripHTML(ZipTextBox.Text.Trim()); country = privateCountryDropDown.SelectedValue; state1 = privState; } #endregion if (isEditing) { cmd.ExecuteNonQuery(); } if (!isEditing || isOwner) { cmd.ExecuteNonQuery(); } bool songsChanged = false; bool mediaChanged = false; bool occuranceChanged = false; cmd = new SqlCommand("SELECT @@IDENTITY AS ID", conn); SqlDataAdapter da2 = new SqlDataAdapter(cmd); DataSet ds3 = new DataSet(); da2.Fill(ds3); string revisionID = ""; if (isEditing && !isOwner && !ownerUpForGrabs) { revisionID = ds3.Tables[0].Rows[0]["ID"].ToString(); } string ID = ds3.Tables[0].Rows[0]["ID"].ToString(); if (!isEditing) { if (OwnerCheckBox.Checked) { dat.Execute("INSERT INTO EventOwnerHistory (EventID, OwnerID, DateCreatedOwnership) " + "VALUES(" + ID + ", " + Session["User"].ToString() + ", '" + isn.ToString() + "')"); } } string firstStartDate = DateSelectionsListBox.Items[0].Text; email += "<br/><br/><a href=\"http://HippoHappenings.com/" + dat.MakeNiceName(EventNameTextBox.Text) + "_" + ID + "_Event\">" + EventNameTextBox.Text + "</a><br/><br/>" + venue + "<br/><br/>First Dates: " + firstStartDate + "<br/><br/>" + DescriptionTextBox.Content; textEmail = ". Name: " + EventNameTextBox.Text + ". Venue: " + venue + ". First Date: " + firstStartDate + ". Link: http://HippoHappenings.com/" + dat.MakeNiceName(EventNameTextBox.Text) + "_" + ID + "_Event"; string temporaryID = ""; if (isEditing) { temporaryID = eventID.Text; } else { temporaryID = ID; } string categories = CreateCategories(temporaryID, isOwner, isEditing, revisionID, ownerUpForGrabs); if (isEditing) ID = Request.QueryString["ID"].ToString(); //string temp = categories; //if (categories != "") // temp += " OR "; //temp += "UV.VenueID=" + venueID; #region Take Care of Media if (MusicCheckBox.Checked || hadSongs) { for (int i = 0; i < SongCheckList.Items.Count; i++) { if (isEditing) { if (SongCheckList.Items[i].Enabled) { if (revisionID != "" && !isOwner && !ownerUpForGrabs) { cmd = new SqlCommand("INSERT INTO EventRevisions_Song_Mapping (RevisionID, EventID, SongName) " + "VALUES(" + revisionID + ",@eventID, @songName)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = int.Parse(eventID.Text); cmd.Parameters.Add("@songName", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Value.ToString(); cmd.ExecuteNonQuery(); } songsChanged = true; dat.Execute("UPDATE Events SET hasSongs='True' WHERE ID=" + eventID.Text); if (i == 0) dat.Execute("DELETE FROM Event_Song_Mapping WHERE EventID=" + eventID.Text); cmd = new SqlCommand("INSERT INTO Event_Song_Mapping (EventID, SongName, SongTitle) " + "VALUES(@eventID, @songName, @songTitle)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = int.Parse(eventID.Text); cmd.Parameters.Add("@songName", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Value.ToString(); cmd.Parameters.Add("@songTitle", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } } else { dat.Execute("UPDATE Events SET hasSongs='True' WHERE ID=" + ID); cmd = new SqlCommand("INSERT INTO Event_Song_Mapping (EventID, SongName, SongTitle) " + "VALUES(@eventID, @songName, @songTitle)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = int.Parse(ID); cmd.Parameters.Add("@songName", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Value.ToString(); cmd.Parameters.Add("@songTitle", SqlDbType.NVarChar).Value = SongCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } } } //Media Categories: NONE: 0, Picture: 1, Video: 2, YouTubeVideo: 3, Slider: 4 bool isSlider = false; if (PictureCheckList.Items.Count > 0) isSlider = true; string tempID = ID; if (isEditing) { tempID = eventID.Text; } if (isSlider) { char[] delim2 = { '\\' }; string[] fileArray = System.IO.Directory.GetFiles(MapPath(".") + "\\UserFiles\\" + Session["EffectiveUserName"].ToString() + "\\Slider\\"); if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\"); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\Events\\")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\"); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\"); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\Events\\" + tempID)) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID); System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\"); } else { if (!System.IO.Directory.Exists(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\")) { System.IO.Directory.CreateDirectory(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\"); } } } } string YouTubeStr = ""; char[] delim3 = { '.' }; bool isPathAbsolute = false; for (int i = 0; i < PictureCheckList.Items.Count; i++) { //int length = fileArray[i].Split(delim2).Length; if (PictureCheckList.Items[i].Value == "ImgPathAbsolute") isPathAbsolute = true; else isPathAbsolute = false; if (isPathAbsolute) { cmd = new SqlCommand("INSERT INTO Event_Slider_Mapping (EventID, PictureName, RealPictureName, ImgPathAbsolute) " + "VALUES(@eventID, @picName, @realName, 'True')", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Text; cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } else { string[] tokens = PictureCheckList.Items[i].Value.ToString().Split(delim3); if (tokens.Length >= 2) { if (tokens[1].ToUpper() == "JPG" || tokens[1].ToUpper() == "JPEG" || tokens[1].ToUpper() == "GIF" || tokens[1].ToUpper() == "PNG") { if (!System.IO.File.Exists(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\" + PictureCheckList.Items[i].Value)) { System.IO.File.Copy(MapPath(".") + "\\UserFiles\\" + Session["EffectiveUserName"].ToString() + "\\Slider\\" + PictureCheckList.Items[i].Value, MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\" + PictureCheckList.Items[i].Value); } if (isEditing) { if (revisionID != "" && !isOwner && !ownerUpForGrabs) { if (PictureCheckList.Items[i].Enabled) { cmd = new SqlCommand("INSERT INTO EventRevisions_Slider_Mapping (RevisionID, EventID, " + "PictureName) VALUES(" + revisionID + ",@eventID, @picName)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; cmd.ExecuteNonQuery(); } } mediaChanged = true; if (i == 0) dat.Execute("DELETE FROM Event_Slider_Mapping WHERE EventID=" + eventID.Text); dat.Execute("UPDATE Events SET mediaCategory=" + mediaCat + " WHERE ID=" + tempID); cmd = new SqlCommand("INSERT INTO Event_Slider_Mapping (EventID, PictureName, RealPictureName) " + "VALUES(@eventID, @picName, @realName)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } else { cmd = new SqlCommand("INSERT INTO Event_Slider_Mapping (EventID, PictureName, RealPicturename) " + "VALUES(@eventID, @picName, @realName)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; cmd.Parameters.Add("@realName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Text; cmd.ExecuteNonQuery(); } } //WE NO LONGER ALLOW Videos to be uploaded to the site itself. Only YouTube videos allowed. //else if (tokens[1].ToUpper() == "WMV") //{ // if (!System.IO.File.Exists(MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\" + PictureCheckList.Items[i].Value)) // { // System.IO.File.Copy(MapPath(".") + "\\UserFiles\\" + Session["UserName"].ToString() + // "\\Slider\\" + PictureCheckList.Items[i].Value, // MapPath(".") + "\\UserFiles\\Events\\" + tempID + "\\Slider\\" + PictureCheckList.Items[i].Value); // } // if (isEditing) // { // if (PictureCheckList.Items[i].Enabled) // { // cmd = new SqlCommand("INSERT INTO EventRevisions_Slider_Mapping (modifierID, EventID, PictureName) VALUES("+Session["User"].ToString()+",@eventID, @picName)", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; // cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; // cmd.ExecuteNonQuery(); // mediaChanged = true; // cmd = new SqlCommand("INSERT INTO Event_Slider_Mapping (EventID, PictureName) VALUES(@eventID, @picName)", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; // cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; // cmd.ExecuteNonQuery(); // } // } // else // { // cmd = new SqlCommand("INSERT INTO Event_Slider_Mapping (EventID, PictureName) VALUES(@eventID, @picName)", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; // cmd.Parameters.Add("@picName", SqlDbType.NVarChar).Value = PictureCheckList.Items[i].Value; // cmd.ExecuteNonQuery(); // } //} } else { mediaChanged = true; YouTubeStr += PictureCheckList.Items[i].Value + ";"; } } } if (YouTubeStr != "") if (isEditing) { if (dsEvent.Tables[0].Rows[0]["YouTubeVideo"].ToString() != YouTubeStr && !isOwner && !ownerUpForGrabs) { dat.Execute("INSERT INTO EventRevisions_YouTube (EventID, YouTubeStr, RevisionID) " + "VALUES(" + ID + ", '" + YouTubeStr + "', " + revisionID + ")"); } dat.Execute("UPDATE Events SET mediaCategory=" + mediaCat + ", YouTubeVideo='" + YouTubeStr + "' WHERE ID=" + tempID); } else { dat.Execute("UPDATE Events SET mediaCategory=" + mediaCat + ", YouTubeVideo='" + YouTubeStr + "' WHERE ID=" + ID); } } #endregion #region Take Care of Event Occurance DataSet dsEOccur = dat.GetData("SELECT * FROM Event_Occurance WHERE EventID=" + tempID); DataView dvEOccur = new DataView(dsEOccur.Tables[0], "", "", DataViewRowState.CurrentRows); //if (isEditing && (!isOwner || ownerUpForGrabs)) //{ // dvEOccur.RowFilter = "DateTimeStart = '" + StartDateTimePicker.DbSelectedDate.ToString() + "' AND " + // "DateTimeEnd = '" + EndDateTimePicker.DbSelectedDate.ToString() + "'"; // if (dvEOccur.Count == 0) // { // occuranceChanged = true; // hasEditChanged = true; // cmd = new SqlCommand("INSERT INTO EventRevisions_Occurance (EventID, DateTimeStart, DateTimeEnd, RevisionID, DATE) " + // "VALUES(@eventID, @dateStart, @dateEnd, " + temporaryID + ", '"+DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).ToString()+"')", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; // cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = StartDateTimePicker.DbSelectedDate.ToString(); // if (EndDateTimePicker.DbSelectedDate != null) // cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = EndDateTimePicker.DbSelectedDate.ToString(); // else // cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = DBNull.Value; // cmd.ExecuteNonQuery(); // } //} //else //{ // dat.Execute("DELETE FROM Event_Occurance WHERE EventID="+temporaryID); // cmd = new SqlCommand("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) VALUES(@eventID, @dateStart, @dateEnd)", conn); // cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; // cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = StartDateTimePicker.DbSelectedDate.ToString(); // if (EndDateTimePicker.DbSelectedDate != null) // cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = EndDateTimePicker.DbSelectedDate.ToString(); // else // cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = DBNull.Value; // cmd.ExecuteNonQuery(); //} //DateTime a = DateTime.Parse(EndDateTimePicker.DbSelectedDate.ToString()); //TimeSpan b = a.Subtract(DateTime.Parse(StartDateTimePicker.DbSelectedDate.ToString())); string[] delimStr = { " -- " }; dat.Execute("DELETE FROM Event_Occurance WHERE EventID=" + tempID); for (int i = 0; i < DateSelectionsListBox.Items.Count; i++) { if (isEditing) { string[] tokensStr = DateSelectionsListBox.Items[i].Text.Split(delimStr, StringSplitOptions.RemoveEmptyEntries); //if (dvEOccur.Count == 0) //{ occuranceChanged = true; hasEditChanged = true; if (!ownerUpForGrabs && !isOwner) { cmd = new SqlCommand("INSERT INTO EventRevisions_Occurance (EventID, DateTimeStart, DateTimeEnd, RevisionID, DATE)" + "VALUES(@eventID, @dateStart, @dateEnd, " + temporaryID + ", '" + isn.ToString() + "')", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = tokensStr[0]; cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = tokensStr[1]; cmd.ExecuteNonQuery(); } else { cmd = new SqlCommand("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) VALUES(@eventID, @dateStart, @dateEnd)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = tokensStr[0]; cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = tokensStr[1]; cmd.ExecuteNonQuery(); } //} } else { string[] tokensStr = DateSelectionsListBox.Items[i].Text.Split(delimStr, StringSplitOptions.RemoveEmptyEntries); cmd = new SqlCommand("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) VALUES(@eventID, @dateStart, @dateEnd)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = tempID; cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = tokensStr[0]; cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = tokensStr[1]; cmd.ExecuteNonQuery(); } } #endregion conn.Close(); #region Take care of search terms if (FeaturePanel.Visible) { string terms = ""; foreach (ListItem item in SearchTermsListBox.Items) { terms += ";" + item.Text + ";"; } foreach (ListItem item in FeatureDatesListBox.Items) { if (item.Value != "Disabled") dat.Execute("INSERT INTO EventSearchTerms (EventID, SearchTerms, SearchDate) VALUES(" + ID + ", '" + terms.Replace("'", "''") + "', '" + item.Text + "')"); } } #endregion try { if (chargeCard) { Encryption encrypt = new Encryption(); //Charge Card though Capture country = dat.GetDataDV("SELECT country_2_code FROM Countries WHERE country_id=" + BillingCountry.SelectedValue)[0]["country_2_code"].ToString(); com.paypal.sdk.util.NVPCodec status = d.DoCaptureCode(transactionID, price.ToString(), "E" + temporaryID + isn.ToString(), "Capture Transaction for Featuring Event '" + dat.MakeNiceNameFull(EventNameTextBox.Text) + "'"); //message = status.ToString(); string successORFailure = status["ACK"]; switch (successORFailure.ToLower()) { case "failure": MessagePanel.Visible = true; YourMessagesLabel.Text = status["L_LONGMESSAGE0"]; //MessagePanel.Visible = true; //foreach (string key in status.Keys) //{ // YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>"; //} break; case "success": //MessagePanel.Visible = true; //foreach (string key in status.Keys) //{ // YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>"; //} TakeCareOfPostEmail(isEditing, isOwner, isNewVenue, ownerUpForGrabs, temporaryID, venueID.ToString(), tempID, revisionID, ownerID); break; default: MessagePanel.Visible = true; foreach (string key in status.Keys) { YourMessagesLabel.Text += "key: '" + key + "', value: '" + status[key] + "' <br/>"; } break; } } else { //MessagePanel.Visible = true; //YourMessagesLabel.Text = "no charge here"; TakeCareOfPostEmail(isEditing, isOwner, isNewVenue, ownerUpForGrabs, temporaryID, venueID.ToString(), tempID, revisionID, ownerID); } } catch (Exception ex) { MessagePanel.Visible = true; YourMessagesLabel.Text = "problem: " + problem + ex.ToString(); } } else { MessagePanel.Visible = true; YourMessagesLabel.Text = "" + message; } } else { MessagePanel.Visible = true; YourMessagesLabel.Text = "You must agree to the terms and conditions."; } } } catch (Exception ex) { MessagePanel.Visible = true; YourMessagesLabel.Text = "problem: " + problem + ex.ToString() + ", command: "; } }