本文整理汇总了C#中Data.CleanExcelString方法的典型用法代码示例。如果您正苦于以下问题:C# Data.CleanExcelString方法的具体用法?C# Data.CleanExcelString怎么用?C# Data.CleanExcelString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.CleanExcelString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostItEventsByHand
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 [email protected]", 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();
//.........这里部分代码省略.........
示例2: GetAllEventLiteral
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);
}
//.........这里部分代码省略.........
示例3: GetEventLiteral
//.........这里部分代码省略.........
}
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" + "\\');\\\">" +
示例4: GetEventLiteral
//.........这里部分代码省略.........
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
{