protected void PostItEventsByHand(DataRowView row) { HttpCookie cookie = Request.Cookies["BrowserDate"]; string problem = ""; try { if (row["Content"].ToString().Trim() != "" && row["Header"].ToString().Trim() != "") { StatusPanel.Text += "got inside"; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); string email = ""; string textEmail = ""; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString()); conn.Open(); //this means there is no pictures or videos DataSet dsEvent = new DataSet(); string theCat = "NULL"; string command = ""; command = "INSERT INTO Events (Owner, [Content], " + "Header, Venue, EventGoersCount, SponsorPresenter, hasSongs, mediaCategory, UserName, " + "ShortDescription, Country, State, Zip, City, StarRating, PostedOn)" + " VALUES(@owner, @content, @header, @venue, " + " 0, @sponsor, 0, 0, @userName, @shortDescription" + ", @country, @state, @zip, @city, 0, @dateP)"; SqlCommand cmd = new SqlCommand(command, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@dateP", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")); cmd.Parameters.Add("@content", SqlDbType.NVarChar).Value = row["Content"].ToString(); cmd.Parameters.Add("@header", SqlDbType.NVarChar).Value = dat.CleanExcelString(row["Header"].ToString()); cmd.Parameters.Add("@shortDescription", SqlDbType.NVarChar).Value = row["ShortDescription"].ToString(); cmd.Parameters.Add("@userName", SqlDbType.NVarChar).Value = row["UserName"].ToString(); cmd.Parameters.Add("@owner", SqlDbType.Int).Value = DBNull.Value; cmd.Parameters.Add("@sponsor", SqlDbType.NVarChar).Value = DBNull.Value; #region Create/Assign Venue string venue = ""; bool isNewVenue = false; int venueID = 0; string country = ""; string state1 = ""; //User created a new venue. Must save it. string city = ""; string zip = ""; string state = ""; bool goNext = true; if (row["VenueID"] != null) { if (row["VenueID"].ToString().Trim() != "") { venueID = int.Parse(row["VenueID"].ToString()); isNewVenue = false; goNext = false; DataView dvA = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + row["VenueID"].ToString()); country = dvA[0]["Country"].ToString(); city = dvA[0]["City"].ToString(); zip = dvA[0]["Zip"].ToString(); state = dvA[0]["State"].ToString(); } } SqlCommand cmd2; //SqlCommand cmd2 = new SqlCommand("SELECT * FROM Venues WHERE Name=@name", conn); //cmd2.Parameters.Add("@name", SqlDbType.NVarChar).Value = venue; //SqlDataAdapter da = new SqlDataAdapter(cmd2); //DataSet ds = new DataSet(); //da.Fill(ds); //bool goNext = false; //if (ds.Tables.Count > 0) // if (ds.Tables[0].Rows.Count > 0) // cmd.Parameters.Add("@venue", SqlDbType.Int).Value = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); // else // goNext = true; //else // goNext = true; if (goNext) { cmd2 = new SqlCommand("INSERT INTO Venues (Content, Name, Address, Country, State, City, Zip, " + "MediaCategory, CreatedByUser, Edit, Rating) VALUES (@content, @vName, @address, @country, @state, @city, @zip, 0, @user, 'True', 0)", conn); cmd2.Parameters.Add("@vName", SqlDbType.NVarChar).Value = row["VenueName"].ToString(); cmd2.Parameters.Add("@user", SqlDbType.Int).Value = row["UserID"].ToString(); cmd2.Parameters.Add("@country", SqlDbType.Int).Value = row["Country"].ToString(); cmd2.Parameters.Add("@city", SqlDbType.NVarChar).Value = row["City"].ToString(); cmd2.Parameters.Add("@zip", SqlDbType.NVarChar).Value = row["Zip"].ToString(); cmd2.Parameters.Add("@content", SqlDbType.NVarChar).Value = row["VenueContent"].ToString(); state = row["State"].ToString(); string locationStr = ""; string apt = ""; if (row["AptNumber"].ToString().Trim() != "") apt = row["SuiteApt"].ToString() + " " + row["AptNumber"].ToString(); locationStr = row["StreetNumber"].ToString() + ";" + row["StreetName"].ToString().Trim().ToLower() + ";" + row["StreetTitle"].ToString() + ";" + apt; cmd2.Parameters.Add("@state", SqlDbType.NVarChar).Value = state; cmd2.Parameters.Add("@address", SqlDbType.NVarChar).Value = locationStr; cmd2.ExecuteNonQuery(); cmd2 = new SqlCommand("SELECT @@IDENTITY AS AID", conn); SqlDataAdapter da1 = new SqlDataAdapter(cmd2); DataSet ds2 = new DataSet(); da1.Fill(ds2); venueID = int.Parse(ds2.Tables[0].Rows[0]["AID"].ToString()); country = row["Country"].ToString(); city = row["City"].ToString(); zip = row["Zip"].ToString(); } cmd.Parameters.Add("@venue", SqlDbType.Int).Value = venueID; cmd.Parameters.Add("@country", SqlDbType.Int).Value = country; cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = state; cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = city; cmd.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zip; #endregion 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(); string temporaryID = ID; CreateCategories(temporaryID, row["Categories"].ToString()); StatusPanel.Text += "inserted event and veue;"; #region Take Care of Event Occurance StatusPanel.Text += ";startime:" + row["StartDateTime"].ToString(); cmd = new SqlCommand("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) VALUES(@eventID, @dateStart, @dateEnd)", conn); cmd.Parameters.Add("@eventID", SqlDbType.Int).Value = temporaryID; cmd.Parameters.Add("@dateStart", SqlDbType.DateTime).Value = row["StartDateTime"].ToString(); cmd.Parameters.Add("@dateEnd", SqlDbType.DateTime).Value = row["EndDateTime"].ToString(); cmd.ExecuteNonQuery(); #endregion conn.Close(); } } catch (Exception ex) { StatusPanelPanel.Visible = true; StatusPanel.Text = ex.ToString(); } }
protected int GetAllEventLiteral(DataView dv, Data dat) { Hashtable normalEventHash = new Hashtable(); DataView dvEvents = dv; int i = 0; string theLiteral = "<script type=\"text/javascript\">function initializeAll(){var address;"; int thecount = dvEvents.Count; string oneStringRecord = ""; int normalRecordCount = 0; int countOfAllUniqueVenues = 0; try { string address = ""; string venue = ""; bool isFirstElement = true; string country = "US"; Hashtable venueMapping = new Hashtable(); Hashtable venuesNumMapping = new Hashtable(); DataView dvRecords = new DataView(); DataTable dt = new DataTable(); DataColumn dc2 = new DataColumn("Address"); dt.Columns.Add(dc2); dc2 = new DataColumn("Letter"); dt.Columns.Add(dc2); foreach (DataRowView row in dvEvents) { if (!bool.Parse(row["isGroup"].ToString())) { if (!normalEventHash.Contains(row["EID"].ToString())) { normalEventHash.Add(row["EID"].ToString(), normalRecordCount.ToString()); address = ""; DataView dvE = dat.GetDataDV("SELECT * FROM Events WHERE ID=" + row["EID"].ToString()); DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dvE[0]["Venue"].ToString()); DataView dvCountry = dat.GetDataDV("SELECT * FROM countries WHERE country_id=" + dvE[0]["Country"].ToString()); country = dvCountry[0]["country_2_code"].ToString(); if (country.ToLower() == "us") { try { address = dat.GetAddress(dvV[0]["Address"].ToString(), false); } catch (Exception ex1) { address = ""; } } else { address = dat.GetAddress(dvV[0]["Address"].ToString(), true); } if (dvE[0]["Country"].ToString().ToLower() == "uk") { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { countOfAllUniqueVenues++; if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; " + "showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>', 1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); } } } else { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { countOfAllUniqueVenues++; if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); } } } isFirstElement = false; normalRecordCount++; venue = address; } } else { countOfAllUniqueVenues++; bool isVenue = false; address = ""; DataView dvE = dat.GetDataDV("SELECT * FROM GroupEvents GE, GroupEvent_Occurance GEO WHERE GE.ID=" + row["EID"].ToString() + " AND GEO.GroupEventID=GE.ID AND GEO.ID=" + row["ReoccurrID"].ToString()); country = dat.GetDataDV("SELECT * FROM Countries C, GroupEvent_Occurance GEO WHERE GEO.ID=" + row["ReoccurrID"].ToString() + " AND C.country_id=GEO.Country ")[0]["country_2_code"].ToString(); DataView dvV = new DataView(); if (dvE[0]["VenueID"] != null) { if (dvE[0]["VenueID"].ToString().Trim() != "") { dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dvE[0]["VenueID"].ToString()); address = dat.GetAddress(dvV[0]["Address"].ToString(), dvV[0]["Country"].ToString() != "223").Trim(); isVenue = true; } } if (!isVenue) { if (dvE[0]["Country"].ToString() == "223") { address = dvE[0]["StreetNumber"].ToString() + " " + dvE[0]["StreetName"].ToString() + " " + dvE[0]["StreetDrop"].ToString(); } else { address = dvE[0]["Location"].ToString(); } } address = address.Trim() + " " + dvE[0]["City"].ToString() + " " + dvE[0]["State"].ToString() + " " + dvE[0]["Zip"].ToString() + " " + country; if (venueMapping.ContainsKey(address)) { venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { if (!isFirstElement) { i++; if (isVenue) venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); else venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('', 1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { if (isVenue) venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); else venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('', 1, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } } isFirstElement = false; normalRecordCount++; venue = address; } } dvRecords = new DataView(dt, "", "Letter ASC", DataViewRowState.CurrentRows); oneStringRecord = theLiteral; int theCount = 0; foreach (DataRowView rowster in dvRecords) { if (theCount == 0) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); if (theCount == dvRecords.Count - 1) { oneStringRecord += " }}</script>".Replace(" ", " ").Replace(" ", " "); } } else if (theCount == dvRecords.Count - 1) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false); }}</script>".Replace(" ", " ").Replace(" ", " "); } else { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); } theCount++; } } catch (Exception ex) { ErrorLabel.Text = ex.ToString(); } ScriptLiteral.Text = oneStringRecord; return countOfAllUniqueVenues; }
protected string[] GetEventLiteral(DataView dvEvents, Data dat, int numOfRecordsPerPage) { string message = ""; int startIndex = 0; //int pageNum = int.Parse(Request.QueryString["page"].ToString()); //int endIndex = numOfRecordsPerPage - 1; //startIndex = numOfRecordsPerPage * pageNum; //if (endIndex > dvEvents.Count - 1) // endIndex = dvEvents.Count - 1; //int thecount = numOfRecordsPerPage; //if (endIndex != numOfRecordsPerPage - 1) // thecount = endIndex - startIndex; int numberInArray = dvEvents.Count / numOfRecordsPerPage; if (dvEvents.Count % numOfRecordsPerPage != 0) numberInArray++; string oneStringRecord = ""; int normalRecordCount = 0; int countInArray = 0; string[] theArray = new string[numberInArray]; TopLiteral.Text = ""; string temp = ""; try { Hashtable normalEventHash = new Hashtable(); int i = 0; string funcCount = ""; string theLiteral = "<script type=\"text/javascript\">function initialize" + (countInArray + 1).ToString() + "(){ initMap(); " + " if(map != null && map != undefined) " + " { var address;"; string address = ""; string venue = ""; bool isFirstElement = true; string country = "US"; Hashtable venueMapping = new Hashtable(); Hashtable venuesNumMapping = new Hashtable(); DataView dvRecords = new DataView(); DataTable dt = new DataTable(); DataColumn dc2 = new DataColumn("Address"); dt.Columns.Add(dc2); dc2 = new DataColumn("Letter"); dt.Columns.Add(dc2); int lastUsedCount = 0; dvEvents.Sort = "colOrder ASC"; foreach(DataRowView row in dvEvents) { temp = ""; if (normalRecordCount % numOfRecordsPerPage == 0) { if (normalRecordCount != 0 && normalRecordCount != lastUsedCount) { lastUsedCount = normalRecordCount; //ErrorLabel.Text += "on script insert normal rec count: " + normalRecordCount.ToString(); dvRecords = new DataView(dt, "", "Letter ASC", DataViewRowState.CurrentRows); theLiteral = "<script type=\"text/javascript\">\n\rfunction initialize" + (countInArray + 1).ToString() + "(){initMap(); if(map != null && map != undefined)\n\r " + " { \n\rvar address;\n\r"; oneStringRecord = theLiteral; int rowCount = 0; foreach (DataRowView rowster in dvRecords) { if (rowCount == 0) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', true);".Replace(" ", " ").Replace(" ", " "); if (rowCount == dvRecords.Count - 1) { oneStringRecord += " }}</script>".Replace(" ", " ").Replace(" ", " "); } } else if (rowCount == dvRecords.Count - 1) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false); }}</script>".Replace(" ", " ").Replace(" ", " "); } else { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); } rowCount++; } TopLiteral.Text += oneStringRecord; theArray[countInArray] = oneStringRecord; dt.Rows.Clear(); countInArray++; venueMapping.Clear(); venuesNumMapping.Clear(); } venue = ""; isFirstElement = true; i = 0; } address = ""; DataView dvV = new DataView(); if (row["VID"].ToString() != "NONE") { dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + row["VID"].ToString()); } else { dvV = dat.GetDataDV("SELECT * FROM Events WHERE ID=" + row["EID"].ToString()); } DataView dvCountry = dat.GetDataDV("SELECT * FROM countries WHERE country_id=" + dvV[0]["Country"].ToString()); country = dvCountry[0]["country_2_code"].ToString(); if (country.ToLower() == "us") { try { if (row["VID"].ToString() != "NONE") { address = dat.GetAddress(dvV[0]["Address"].ToString(), false); } else { address = dvV[0]["Address"].ToString(); } } catch (Exception ex1) { address = ""; } } else { if (row["VID"].ToString() != "NONE") { address = dat.GetAddress(dvV[0]["Address"].ToString(), true); } else { address = dvV[0]["Address"].ToString(); } } if (!normalEventHash.Contains(row["EID"].ToString())) { normalEventHash.Add(row["EID"].ToString(), normalRecordCount.ToString()); if (dvV[0]["Country"].ToString().ToLower() == "222") { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { row["SearchNum"] = venuesNumMapping[address].ToString(); if (row["Type"].ToString() == "E") { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" style=\\\" float: left; cursor: pointer;\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" style=\\\" float: left; cursor: pointer;\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } } else { if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); if (row["Type"].ToString() == "E") { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; " + "\n\rshowAddressUS('<span class=\\\"Green12Link2UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>', 0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } else { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; " + "\n\rshowAddressUS('<span class=\\\"Green12Link2UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>', 0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); row["SearchNum"] = dat.GetImage(i.ToString()); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; if (row["Type"].ToString() == "E") { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } else { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } } } } else { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { row["SearchNum"] = venuesNumMapping[address].ToString(); temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; if (row["Type"].ToString() == "E") { venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } } else { if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; if (row["Type"].ToString() == "E") { string tmp = "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " "); if (row["VID"].ToString() == "NONE") { tmp += "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\">" + dvV[0]["Address"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { tmp += "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } venueMapping.Add(address, tmp); } else { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); row["SearchNum"] = dat.GetImage(i.ToString()); } else { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); if (row["Type"].ToString() == "E") { string tmp = "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'"; if (row["VID"].ToString() == "NONE") { tmp += " \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" >" + dvV[0]["Address"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { tmp += " \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } venueMapping.Add(address, tmp); } else { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } } } } isFirstElement = false; normalRecordCount++; venue = address; } else { if (venueMapping.ContainsKey(address)) { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; row["SearchNum"] = venuesNumMapping[address].ToString(); if (row["Type"].ToString() == "E") { venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { venueMapping[address] += "<br/><div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } } else { temp = row["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " "); if (temp.Length > 50) temp = temp.Substring(0, 50) + "..."; if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); if (row["Type"].ToString() == "E") { string tmp = "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " "); if (row["VID"].ToString() == "NONE") { tmp += "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\">" + dvV[0]["Address"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { tmp += "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } venueMapping.Add(address, tmp); } else { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); row["SearchNum"] = dat.GetImage(i.ToString()); } else { row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); if (row["Type"].ToString() == "E") { string tmp = "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'"; if (row["VID"].ToString() == "NONE") { tmp += " \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" >" + dvV[0]["Address"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } else { tmp += " \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["EID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"; } venueMapping.Add(address, tmp); } else { venueMapping.Add(address, "\n\raddress = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; \n\rshowAddressUS('<span class=\\\"Green12LinkNFUD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div class=\\\"NavyLink12UD\\\" onclick=\\\"GoToThis(\\'" + "../" + dat.MakeNiceName(row["Header"].ToString()) + "_" + row["VID"].ToString() + "_Venue" + "\\');\\\">" + dat.CleanExcelString(temp) + "</div>"); } } } isFirstElement = false; normalRecordCount++; venue = address; } } //if (thecount % numOfRecordsPerPage != 0) //{ dvRecords = new DataView(dt, "", "Letter ASC", DataViewRowState.CurrentRows); theLiteral = "<script type=\"text/javascript\">\n\rfunction initialize" + (countInArray + 1).ToString() + "(){initMap(); if(map != null && map != undefined) " + " { \n\rvar address;"; oneStringRecord = theLiteral; int theCount = 0; foreach (DataRowView rowster in dvRecords) { if (theCount == 0) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', true);".Replace(" ", " ").Replace(" ", " "); if (theCount == dvRecords.Count - 1) { oneStringRecord += " }}</script>".Replace(" ", " ").Replace(" ", " "); } } else if (theCount == dvRecords.Count - 1) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false); }}</script>".Replace(" ", " ").Replace(" ", " "); } else { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); } theCount++; } TopLiteral.Text += oneStringRecord; theArray[countInArray] = oneStringRecord; //} } catch (Exception ex) { ErrorLabel.Text += ex.ToString() + message; } return theArray; }
protected string[] GetEventLiteral(DataView dvEvents, Data dat, int numOfRecordsPerPage) { int thecount = dvEvents.Count; int numberInArray = thecount / numOfRecordsPerPage; if (thecount % numOfRecordsPerPage != 0) numberInArray++; string oneStringRecord = ""; int normalRecordCount = 0; int countInArray = 0; string[] theArray = new string[numberInArray]; try { Hashtable normalEventHash = new Hashtable(); int i = 0; string funcCount = ""; string theLiteral = "<script type=\"text/javascript\">function initialize"+ (countInArray+1).ToString()+"(){ "+ " if(map != null && map != undefined) " + " { var address;"; string address = ""; string venue = ""; bool isFirstElement = true; string country = "US"; Hashtable venueMapping = new Hashtable(); Hashtable venuesNumMapping = new Hashtable(); DataView dvRecords = new DataView(); DataTable dt = new DataTable(); DataColumn dc2 = new DataColumn("Address"); dt.Columns.Add(dc2); dc2 = new DataColumn("Letter"); dt.Columns.Add(dc2); int lastUsedCount = 0; foreach (DataRowView row in dvEvents) { if (normalRecordCount % numOfRecordsPerPage == 0) { if (normalRecordCount != 0 && normalRecordCount != lastUsedCount) { lastUsedCount = normalRecordCount; //ErrorLabel.Text += "on script insert normal rec count: " + normalRecordCount.ToString(); dvRecords = new DataView(dt, "", "Letter ASC", DataViewRowState.CurrentRows); theLiteral = "<script type=\"text/javascript\">function initialize" + (countInArray + 1).ToString() + "(){if(map != null && map != undefined) " + " { var address;"; oneStringRecord = theLiteral; int rowCount = 0; foreach (DataRowView rowster in dvRecords) { if (rowCount == 0) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', true);".Replace(" ", " ").Replace(" ", " "); if (rowCount == dvRecords.Count - 1) { oneStringRecord += " }}</script>".Replace(" ", " ").Replace(" ", " "); } } else if (rowCount == dvRecords.Count - 1) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false); }}</script>".Replace(" ", " ").Replace(" ", " "); } else { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); } rowCount++; } TopLiteral.Text += oneStringRecord; theArray[countInArray] = oneStringRecord; dt.Rows.Clear(); countInArray++; venueMapping.Clear(); venuesNumMapping.Clear(); } venue = ""; isFirstElement = true; i = 0; } if (!bool.Parse(row["isGroup"].ToString())) { if (!normalEventHash.Contains(row["EID"].ToString())) { normalEventHash.Add(row["EID"].ToString(), normalRecordCount.ToString()); row["CalendarNum"] = dat.GetCalendarLetter(normalRecordCount); address = ""; DataView dvE = dat.GetDataDV("SELECT * FROM Events WHERE ID=" + row["EID"].ToString()); DataView dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dvE[0]["Venue"].ToString()); DataView dvCountry = dat.GetDataDV("SELECT * FROM countries WHERE country_id=" + dvE[0]["Country"].ToString()); country = dvCountry[0]["country_2_code"].ToString(); if (country.ToLower() == "us") { try { address = dat.GetAddress(dvV[0]["Address"].ToString(), false); } catch (Exception ex1) { address = ""; } } else { address = dat.GetAddress(dvV[0]["Address"].ToString(), true); } if (dvE[0]["Country"].ToString().ToLower() == "uk") { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { row["SearchNum"] = venuesNumMapping[address].ToString(); venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; " + "showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>', 0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); row["SearchNum"] = dat.GetImage(i.ToString()); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + ", " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); } } } else { //VenueName.Text + "@&" + if (venueMapping.ContainsKey(address)) { row["SearchNum"] = venuesNumMapping[address].ToString(); venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { if (!isFirstElement) { i++; venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + " cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); row["SearchNum"] = dat.GetImage(i.ToString()); } else { row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["City"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["State"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + dvV[0]["Zip"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + " " + country.Replace("'", " ").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Header"].ToString()) + "_" + dvE[0]["ID"].ToString() + "_Event" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Header"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); } } } isFirstElement = false; normalRecordCount++; venue = address; } else { row["CalendarNum"] = dat.GetCalendarLetter(int.Parse(normalEventHash[row["EID"].ToString()].ToString())); } } else { bool isVenue = false; address = ""; row["CalendarNum"] = dat.GetCalendarLetter(normalRecordCount); DataView dvE = dat.GetDataDV("SELECT * FROM GroupEvents GE, GroupEvent_Occurance GEO WHERE GE.ID=" + row["EID"].ToString() + " AND GEO.GroupEventID=GE.ID AND GEO.ID=" + row["ReoccurrID"].ToString()); country = dat.GetDataDV("SELECT * FROM Countries C, GroupEvent_Occurance GEO WHERE GEO.ID=" + row["ReoccurrID"].ToString() + " AND C.country_id=GEO.Country ")[0]["country_2_code"].ToString(); DataView dvV = new DataView(); if (dvE[0]["VenueID"] != null) { if (dvE[0]["VenueID"].ToString().Trim() != "") { dvV = dat.GetDataDV("SELECT * FROM Venues WHERE ID=" + dvE[0]["VenueID"].ToString()); address = dat.GetAddress(dvV[0]["Address"].ToString(), dvV[0]["Country"].ToString() != "223").Trim(); isVenue = true; } } if (!isVenue) { if (dvE[0]["Country"].ToString() == "223") { address = dvE[0]["StreetNumber"].ToString() + " " + dvE[0]["StreetName"].ToString() + " " + dvE[0]["StreetDrop"].ToString(); } else { address = dvE[0]["Location"].ToString(); } } address = address.Trim() + " " + dvE[0]["City"].ToString() + " " + dvE[0]["State"].ToString() + " " + dvE[0]["Zip"].ToString() + " " + country; if (venueMapping.ContainsKey(address)) { row["SearchNum"] = venuesNumMapping[address]; venueMapping[address] += ",<br/><div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"; } else { if (!isFirstElement) { i++; if (isVenue) venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); else venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('', 0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); row["SearchNum"] = dat.GetImage(i.ToString()); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } else { row["SearchNum"] = dat.GetImage(i.ToString()); if (isVenue) venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "'; showAddressUS('<span style=\\\"color: #98cb2a; font-weight: bold;text-decoration: underline; " + "cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvV[0]["Name"].ToString()) + "_" + dvV[0]["ID"].ToString() + "_Venue" + "\\');\\\">" + dvV[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ") + "</span>',0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); else venueMapping.Add(address, "address = '" + address.Trim().Replace("'", "''").Replace("(", " ").Replace(")", " ") + "';showAddressUS('', 0, address, 0, address, 1, " + i.ToString() + ", '" + "<div style=\\\"color: #1fb6e7; font-weight: bold; text-decoration: underline; float: left; cursor: pointer;\\\" onclick=\\\"CloseWindow(\\'" + "../" + dat.MakeNiceName(dvE[0]["Name"].ToString()) + "_" + row["ReoccurrID"].ToString() + "_" + dvE[0]["ID"].ToString() + "_GroupEvent" + "\\');\\\">" + dat.CleanExcelString(dvE[0]["Name"].ToString().Replace("'", " ").Replace("(", " ").Replace(")", " ")) + "</div>"); venuesNumMapping.Add(address, dat.GetImage(i.ToString())); row["SearchNum"] = dat.GetImage(i.ToString()); DataRow r = dt.NewRow(); r["Address"] = address; r["Letter"] = dat.GetImage(i.ToString()); dt.Rows.Add(r); } } isFirstElement = false; normalRecordCount++; venue = address; } } //if (thecount % numOfRecordsPerPage != 0) //{ dvRecords = new DataView(dt, "", "Letter ASC", DataViewRowState.CurrentRows); theLiteral = "<script type=\"text/javascript\">function initialize" + (countInArray + 1).ToString() + "(){if(map != null && map != undefined) " + " { var address;"; oneStringRecord = theLiteral; int theCount = 0; foreach (DataRowView rowster in dvRecords) { if (theCount == 0) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', true);".Replace(" ", " ").Replace(" ", " "); if (theCount == dvRecords.Count - 1) { oneStringRecord += " }}</script>".Replace(" ", " ").Replace(" ", " "); } } else if (theCount == dvRecords.Count - 1) { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false); }}</script>".Replace(" ", " ").Replace(" ", " "); } else { oneStringRecord += venueMapping[rowster["Address"].ToString()].ToString() + "', false);".Replace(" ", " ").Replace(" ", " "); } theCount++; } TopLiteral.Text += oneStringRecord; theArray[countInArray] = oneStringRecord; //} } catch (Exception ex) { ErrorLabel.Text += ex.ToString() + "; countInArray: " + countInArray + "; theArray.Length: " + theArray.Length + "; eventsCount: " + thecount.ToString() + "; normalRecordCount: " + normalRecordCount.ToString(); } return theArray; }