本文整理汇总了C#中Data.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Data.Execute方法的具体用法?C# Data.Execute怎么用?C# Data.Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteEventAction
protected void DeleteEventAction(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (Request.QueryString["O"] != null)
{
if (Request.QueryString["U"] != null)
{
dat.Execute("DELETE FROM User_GroupEvent_Calendar WHERE UserID=" + Session["User"].ToString() +
" AND GroupEventID=" + Request.QueryString["ID"].ToString() + " AND ReoccurrID=" +
Request.QueryString["O"].ToString());
}
else
{
dat.Execute("DELETE FROM GroupEvent_Members WHERE UserID=" + Session["User"].ToString() +
" AND GroupEventID=" + Request.QueryString["ID"].ToString() + " AND ReoccurrID=" +
Request.QueryString["O"].ToString());
}
}
else
{
dat.Execute("DELETE FROM User_Calendar WHERE UserID=" + Session["User"].ToString() +
" AND EventID=" + Request.QueryString["ID"].ToString());
}
RemovePanel.Visible = false;
ThankYouPanel.Visible = true;
}
示例2: RemoveMember
protected void RemoveMember(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
if (cookie == null)
{
cookie = new HttpCookie("BrowserDate");
cookie.Value = DateTime.Now.ToString();
cookie.Expires = DateTime.Now.AddDays(22);
Response.Cookies.Add(cookie);
}
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("DELETE FROM User_Friends WHERE UserID=" + Session["User"].ToString() +
" AND FriendID =" + Request.QueryString["ID"].ToString());
dat.Execute("DELETE FROM User_Friends WHERE UserID=" + Request.QueryString["ID"].ToString() +
" AND FriendID =" + Session["User"].ToString());
dat.Execute("DELETE FROM UserFriendPrefs WHERE UserID=" + Session["User"].ToString() +
" AND FriendID =" + Request.QueryString["ID"].ToString());
dat.Execute("DELETE FROM UserFriendPrefs WHERE UserID=" + Request.QueryString["ID"].ToString() +
" AND FriendID =" + Session["User"].ToString());
RemovePanel.Visible = false;
ThankYouPanel.Visible = true;
}
示例3: CheckAndInsert
protected void CheckAndInsert(string header, string description, string date, string images, string VenueID, string categories, string URL)
{
Data dat = new Data(DateTime.Now);
//Check whether event exists in database
DateTime dStart = DateTime.Parse(date);
DataView dvEvent = dat.GetDataDV("SELECT * FROM Events E, Event_Occurance EO WHERE E.Venue=" + VenueID +
" AND E.Header='" + header + "' AND E.ID=EO.EventID AND EO.DateTimeStart = CONVERT(DATETIME, '" + dStart.ToString() + "')");
//Insert if does not exist
if (dvEvent.Count == 0)
{
DataView dvVenue = dat.GetDataDV("SELECT country, city, state, zip, address FROM Venues WHERE ID=" + VenueID);
string country = dvVenue[0]["country"].ToString();
string city = dvVenue[0]["city"].ToString();
string state = dvVenue[0]["state"].ToString();
string zip = dvVenue[0]["zip"].ToString();
string address = dvVenue[0]["address"].ToString();
string mediaCat = "0";
if (images != "")
mediaCat = "1";
if (description.Length > 500)
description = description.Substring(0, 500) + "... " + URL;
dvEvent = dat.GetDataDV("INSERT INTO Events (PostedOn, LastEditOn, UserName, Venue, Header, [Content], StarRating, hasSongs, mediaCategory, " +
"city, country, state, zip, address) VALUES ('" + DateTime.Now.ToString() + "', '" + DateTime.Now.ToString() + "', 'aleksczajka', " +
VenueID + ", '" + header +
"', '" + description.Replace("'", "''").Replace("\\", "\\\\") + "', 0, 'False', " + mediaCat + ", '" + city + "', " +
country + ", '" + state + "', '" + zip + "', '" + address + "') SELECT @@IDENTITY AS 'Identity'");
string theID = dvEvent[0]["Identity"].ToString();
//Insert date and time
dat.Execute("INSERT INTO Event_Occurance (EventID, DateTimeStart, DateTimeEnd) VALUES (" + theID + ", '" +
dStart.ToString() + "', '" + dStart.AddHours(2.00).ToString() + "')");
//Insert categories
string[] delim = { ";" };
string[] tokens = categories.Split(delim, StringSplitOptions.RemoveEmptyEntries);
foreach (string token in tokens)
{
dat.Execute("INSERT INTO Event_Category_Mapping (CategoryID, EventID, tagSize) VALUES (" + token + ", '" +
theID + "', 22)");
}
//Insert Images
string[] imgDelim = { "^" };
if (images != "")
{
string[] imgTokens = images.Split(imgDelim, StringSplitOptions.RemoveEmptyEntries);
foreach (string token in imgTokens)
{
dat.Execute("INSERT INTO Event_Slider_Mapping (EventID, PictureName, RealPictureName, " +
"ImgPathAbsolute) VALUES(" + theID + ", '" + token + "', '" + token + "', 'True')");
}
}
}
}
示例4: DeleteAd
//[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
//public int ShowMessage()
//{
// //Session["Type"] = "Calendar";
// //MessageLiteral.Text = "<script type=\"text/javascript\">alert('" + message + "');</script>";
// RadWindowManager RadWindowManager = new RadWindowManager();
// Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
// RadWindow RadWindow1 = new RadWindow();
// RadWindow1.NavigateUrl = "http://google.com";
// RadWindow1.Visible = true;
// RadWindowManager.Windows.Add(RadWindow1);
// RadWindowManager.VisibleOnPageLoad = true;
// this.Controls.Add(RadWindowManager);
// return 0;
//}
//protected override void OnPreRender(EventArgs e)
//{
// base.OnPreRender(e);
//}
//protected void RadAjaxManager1_AjaxSettingCreating(object sender, Telerik.Web.UI.AjaxSettingCreatingEventArgs e)
//{
// e.UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Always;
//}
//protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
//{
// //if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
// //{
// // string propertyID = DataBinder.Eval(e.Item.DataItem, "PropertyID").ToString();
// //}
//}
//protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
//{
// if (e.CommandName == "DisplayPropertySchedule")
// {
// }
//}
//protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
//{
//}
//protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
//{
// Resource prop = e.Appointment.Resources.GetResourceByType("Property");
// e.Appointment.CssClass = "ID" + prop.Key.ToString();
//}
//protected void ShowAll_Click(object sender, EventArgs e)
//{
//}
//protected void gotoAd(object sender, EventArgs e)
//{
// Response.Redirect("Ad.aspx?ID=1");
//}
//[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
//public int DeleteUserEvent(string theID, string userID)
//{
// Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
// dat.Execute("DELETE FROM User_Calendar WHERE UserID=" + userID + " AND EventID=" + theID);
// //RadScheduler1.Appointments;
// return int.Parse(theID);
//}
//[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public int DeleteAd(string theID, string userID)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("DELETE FROM Ad_Calendar WHERE AdID=" + theID);
dat.Execute("DELETE FROM Ads WHERE Ad_ID=" + theID);
dat.Execute("DELETE FROM Ad_Category_Mapping WHERE AdID=" + theID);
dat.Execute("DELETE FROM Ad_Slider_Mapping WHERE AdID=" + theID);
//RadScheduler1.Appointments;
return int.Parse(theID);
}
示例5: AutomaticJoin
protected void AutomaticJoin(object sender, EventArgs e)
{
try
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
string shared = "False";
string title = "";
string prefs = "124";
DataView dvGroup = dat.GetDataDV("SELECT * FROM Groups WHERE AutomaticHost='True' " +
"AND ID=" + Request.QueryString["ID"]);
if (dvGroup.Count > 0)
{
shared = "True";
title = "Shared Host";
prefs = "12345";
}
dat.Execute("INSERT INTO Group_Members (GroupID, MemberID, Title, SharedHosting, Accepted, Prefs) " +
"VALUES(" + Request.QueryString["ID"] + ", " + Session["User"].ToString() +
", '" + title + "', '" + shared + "', 'True', " + prefs + ")");
AutomaticPanel.Visible = false;
ThankYouPanel.Visible = true;
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
示例6: DeleteEventAction
protected void DeleteEventAction(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("UPDATE Events SET LIVE='True' WHERE ID=" + Request.QueryString["ID"].ToString());
RemovePanel.Visible = false;
ThankYouPanel.Visible = true;
}
示例7: AcceptMembership
protected void AcceptMembership(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
HtmlButton link = (HtmlButton)sender;
string groupID = link.ID.Replace("acceptMembership", "");
dat.Execute("UPDATE Group_Members SET Accepted='True' WHERE GroupID=" + groupID +
" AND MemberID=" + Session["User"].ToString());
}
示例8: drop_SelectedIndexChanged
protected void drop_SelectedIndexChanged(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
DropDownList drop = (DropDownList)sender;
char[] delim = { ';' };
string[] tokens = drop.SelectedValue.Split(delim);
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("UPDATE SavedAdSearches SET NumAdsInEmail=" + tokens[0] + " WHERE ID=" + tokens[1]);
Response.Redirect("SearchesAndPages.aspx");
}
示例9: DeleteEventAction
protected void DeleteEventAction(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (JustInstanceCheck.Checked)
{
dat.Execute("DELETE FROM GroupEvent_Occurance WHERE ID=" + Request.QueryString["O"].ToString());
DataView dv = dat.GetDataDV("SELECT * FROM GroupEvent_Occurance WHERE GroupEventID=" +
Request.QueryString["ID"].ToString());
if(dv.Count == 0)
dat.Execute("UPDATE GroupEvents SET LIVE='False' WHERE ID=" +
Request.QueryString["ID"].ToString());
}
else
{
dat.Execute("UPDATE GroupEvents SET LIVE='False' WHERE ID=" + Request.QueryString["ID"].ToString());
}
RemovePanel.Visible = false;
ThankYouPanel.Visible = true;
}
示例10: button_ServerClick
protected void button_ServerClick(object sender, EventArgs e)
{
Encryption decrypt = new Encryption();
HttpCookie cookie = Request.Cookies["BrowserDate"];
if (cookie == null)
{
cookie = new HttpCookie("BrowserDate");
cookie.Value = DateTime.Now.ToString();
cookie.Expires = DateTime.Now.AddDays(22);
Response.Cookies.Add(cookie);
}
HtmlButton button = (HtmlButton)sender;
string ID2 = "";
string message = "";
if (Request.QueryString["message"] != null)
message = "<label>" + decrypt.decrypt(Request.QueryString["message"].ToString()) + "</label>";
else
message = "<label>" + Session["Message"].ToString() + "</label>";
//if (Session["str"] != null)
// message += "<div style=\"color: red;\">" + Session["str"].ToString() + "</div>";
if (message.Contains("<savedadsearch>"))
{
string[] delim = { "<savedadsearch>ID:" };
string[] tokens = message.Split(delim, StringSplitOptions.None);
int i = 0;
while (tokens[1][i] != '<')
{
ID2 += tokens[1][i];
i++;
}
}
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("UPDATE SavedAdSearches SET Live='False' WHERE ID=" + ID2);
Label label = new Label();
label.Text = "Your emails feature is disabled";
MessagePanel.Controls.AddAt(MessagePanel.Controls.IndexOf(button), label);
MessagePanel.Controls.Remove(button);
Label label1 = (Label)MessagePanel.FindControl("Label1");
label1.Text = "<label>Search Saved <br/><br/>";
}
示例11: DeleteThread
protected void DeleteThread(object sender, EventArgs e)
{
string command = "";
try
{
string ThreadID = Request.QueryString["ID"].ToString();
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
dat.Execute("DELETE FROM GroupThreads WHERE ID=" + ThreadID);
dat.Execute("DELETE FROM GroupThreads_Comments WHERE ThreadID=" + ThreadID);
ThankYouLabel.Text = "Your thread has been deleted.";
DeletePanel.Visible = false;
ThankYouPanel.Visible = true;
}
catch (Exception ex)
{
ErrorLabel.Text = ex.ToString() + "<br/><br/>" + command;
}
}
示例12: SendIt
protected void SendIt(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
if (cookie == null)
{
cookie = new HttpCookie("BrowserDate");
cookie.Value = DateTime.Now.ToString();
cookie.Expires = DateTime.Now.AddDays(22);
Response.Cookies.Add(cookie);
}
if (EmailTextBox.Text != "")
{
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
SqlDbType [] types = {SqlDbType.NVarChar};
EmailTextBox.Text = dat.stripHTML(EmailTextBox.Text.Trim());
object[] parameters = { EmailTextBox.Text };
DataSet ds = dat.GetDataWithParemeters("SELECT * FROM Users WHERE [email protected]", types, parameters);
bool isNot = false;
if (ds.Tables.Count > 0)
if (ds.Tables[0].Rows.Count > 0)
{
Encryption encrypt = new Encryption();
Random r = new Random(0);
string code = encrypt.encrypt(ds.Tables[0].Rows[0]["UserName"].ToString() + r.Next().ToString());
dat.Execute("UPDATE Users SET PasswordReset='" + code + "' WHERE User_ID="+ds.Tables[0].Rows[0]["User_ID"].ToString());
string body = "You have requested to re-set your password with Hippo Happenings. <br/>" +
"Please visit <a href=\"http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
ds.Tables[0].Rows[0]["UserName"].ToString() + "\">http://HippoHappenings.com/ResetPassword.aspx?CODE=" + code + "&UserName=" +
ds.Tables[0].Rows[0]["UserName"].ToString() + "</a> to do so.";
dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(),
ds.Tables[0].Rows[0]["Email"].ToString(), body, "Hippo Happenings Reset Password Request");
MessageLabel.Text = "An email with the instructions has been sent to your account.";
}
else
isNot = true;
else
isNot = true;
if (isNot)
{
MessageLabel.Text = "There is no user associated with this email address. Please make sure you have typed it correctly.";
}
}
else
{
MessageLabel.Text = "Please include the Email";
}
}
示例13: check_CheckedChanged
protected void check_CheckedChanged(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
CheckBox check = (CheckBox)sender;
string ID = check.Attributes["value"].ToString();
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (check.Checked)
{
dat.Execute("UPDATE SavedAdSearches SET Live='True', NumAdsInEmail=1 WHERE ID=" + ID);
Literal lit = (Literal)AdSearchesPanel.FindControl("lit" + ID);
DropDownList drop = new DropDownList();
drop.Width = 50;
drop.ID = "drop" + ID;
drop.Items.Add(new ListItem("1 (email sent for every ad created)", "1;" + ID));
drop.Items.Add(new ListItem("5 (email sent for every 5 ads created)", "5;" + ID));
drop.Items.Add(new ListItem("10 (every 10 ads)", "10;" + ID));
drop.Items.Add(new ListItem("20 (every 20: this could potentially be a long waiting period)", "20;" + ID));
drop.AutoPostBack = true;
drop.SelectedIndexChanged += new EventHandler(drop_SelectedIndexChanged);
AdSearchesPanel.Controls.AddAt(AdSearchesPanel.Controls.IndexOf(lit), drop);
AdSearchesPanel.Controls.Remove(lit);
}
else
{
dat.Execute("UPDATE SavedAdSearches SET Live='False' WHERE ID=" + ID);
DropDownList drop = (DropDownList)AdSearchesPanel.FindControl("drop" + ID);
Literal b3 = new Literal();
b3.Text = "---";
AdSearchesPanel.Controls.AddAt(AdSearchesPanel.Controls.IndexOf(drop), b3);
AdSearchesPanel.Controls.Remove(drop);
}
Response.Redirect("SearchesAndPages.aspx");
}
示例14: AcceptInvitation
protected void AcceptInvitation(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
HtmlButton link = (HtmlButton)sender;
string[] delim = { "acceptInvitation" };
string[] tokens = link.ID.Split(delim, StringSplitOptions.RemoveEmptyEntries);
string groupID = tokens[0];
string reoccurrID = tokens[1];
if (!HasRegistrationEnded(groupID, reoccurrID))
{
dat.Execute("UPDATE GroupEvent_Members SET Accepted='True' WHERE GroupEventID=" + groupID +
" AND UserID=" + Session["User"].ToString() + " AND ReoccurrID=" + reoccurrID);
}
}
示例15: MakeItSo
protected void MakeItSo(object sender, System.EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
Encryption encrypt = new Encryption();
if (PasswordTextBox.Text.Trim() != "" && ConfirmPasswordTextBox.Text.Trim() != "")
{
if (PasswordTextBox.Text.Trim() == ConfirmPasswordTextBox.Text.Trim())
{
dat.Execute("UPDATE Users SET PasswordReset='', PASSWORD='"+encrypt.encrypt(PasswordTextBox.Text.Trim())+"' WHERE UserName='"+Request.QueryString["UserName"].ToString()+"'");
ErrorLabel.Text = "Your password has been changed.";
}
else
{
ErrorLabel.Text = "Password and confirm password must match.";
}
}
else
{
ErrorLabel.Text = "Include both password and confirm password.";
}
}