本文整理汇总了C#中DB.CloseViziAppsDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# DB.CloseViziAppsDatabase方法的具体用法?C# DB.CloseViziAppsDatabase怎么用?C# DB.CloseViziAppsDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB.CloseViziAppsDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActivateCustomer_Click
protected void ActivateCustomer_Click(object sender, EventArgs e)
{
ClearMessages();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
string customer_id = State["ServerAdminCustomerID"].ToString();
if (customer_id == "0")
{
AdminMessage.Text = "Select a customer and try again.";
return;
}
//check if admin
string sql = "SELECT status FROM customers WHERE customer_id='" + customer_id + "'";
DB db = new DB();
string status = db.ViziAppsExecuteScalar(State, sql);
if (status == "admin")
{
db.CloseViziAppsDatabase(State);
AdminMessage.Text = "Status of Admin Customer can not be changed.";
}
else
{
sql = "UPDATE customers SET status='active' WHERE customer_id='" + customer_id + "'";
db.ViziAppsExecuteNonQuery(State, sql);
db.CloseViziAppsDatabase(State);
CustomerStatus.Text = "active";
AdminMessage.Text = "Customer has been activated.";
}
}
示例2: Applications_SelectedIndexChanged
protected void Applications_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
ClearMessages();
//get initial values
if (e.Text.IndexOf("->") > 0)
{
HideForApplications();
return;
}
ShowForApplications();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
string customer_id = State["ServerAdminCustomerID"].ToString();
Util util = new Util();
State["SelectedAdminApp"] = e.Text;
string sql = "SELECT * FROM applications WHERE customer_id='" + customer_id + "' AND application_name='" + e.Text + "'";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
string status = "";
DataRow row = rows[0];
string application_id = row["application_id"].ToString();
State["application_id"] = application_id;
status = row["status"].ToString();
ApplicationStatus.Text = status;
db.CloseViziAppsDatabase(State);
}
示例3: GetCustomerInfo
public XmlDocument GetCustomerInfo()
{
XmlUtil x_util = new XmlUtil();
Util util = new Util();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
XmlNode status = null;
XmlDocument Response = new XmlDocument();
XmlNode root = Response.CreateElement("response");
Response.AppendChild(root);
try
{
DB db = new DB();
String sql = "SELECT COUNT(*) FROM customers WHERE status!='inactive'";
String count = db.ViziAppsExecuteScalar(State, sql);
x_util.CreateNode(Response, root, "customer_count", count);
db.CloseViziAppsDatabase(State);
x_util.CreateNode(Response, root, "status", "success");
}
catch (System.Exception SE)
{
util.LogError(State, SE);
if (status == null)
{
Response = new XmlDocument();
XmlNode root2 = Response.CreateElement("response");
Response.AppendChild(root2);
status = x_util.CreateNode(Response, root2, "status");
}
status.InnerText = SE.Message;
util.LogError(State, SE);
}
return Response;
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (State == null || State.Count <= 2) { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "timeOut('../Default.aspx');", true); return; }
DB db = new DB();
string sql = "SELECT * FROM stock_images WHERE ";
if (State["SelectedAppType"].ToString() == Constants.WEB_APP_TYPE || State["SelectedAppType"].ToString() == Constants.HYBRID_APP_TYPE)
sql += "type='jquery_buttons' or type='blank_buttons'";
else
sql += "type='blank_buttons'";
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
DataSet paramsDS = new DataSet("ParameterDataSet");
DataTable paramTable = paramsDS.Tables.Add("ParamTable");
DataColumn paramCol = paramTable.Columns.Add("image_url", typeof(String));
foreach (DataRow row in rows)
{
string type = row["type"].ToString();
string url = row["image_url"].ToString();
DataRow paramRow = paramTable.NewRow();
string[] row_array = new string[1];
row_array[0] = url;
paramRow.ItemArray = row_array;
paramTable.Rows.Add(paramRow);
}
ParamRepeater.DataSource = paramsDS;
ParamRepeater.DataBind();
db.CloseViziAppsDatabase((Hashtable)HttpRuntime.Cache[Session.SessionID]);
}
示例5: InitApplicationCustomers
public void InitApplicationCustomers(Hashtable State)
{
RadComboBox CustomersByAccount = (RadComboBox)State["CustomersByAccount"];
if (CustomersByAccount == null)
return;
string sql = "SELECT username FROM customers ORDER BY username";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
CustomersByAccount.Items.Clear();
foreach (DataRow row in rows)
{
CustomersByAccount.Items.Add(new RadComboBoxItem(row["username"].ToString()));
}
CustomersByAccount.Items.Insert(0, new RadComboBoxItem("Select Customer ->"));
RadComboBox CustomersByEmail = (RadComboBox)State["CustomersByEmail"];
sql = "SELECT email FROM customers ORDER BY email";
rows = db.ViziAppsExecuteSql(State, sql);
CustomersByEmail.Items.Clear();
foreach (DataRow row in rows)
{
CustomersByEmail.Items.Add(new RadComboBoxItem(row["email"].ToString()));
}
CustomersByEmail.Items.Insert(0, new RadComboBoxItem("Select Customer ->"));
db.CloseViziAppsDatabase(State);
}
示例6: GetApplicationTypeForAdmin
public string GetApplicationTypeForAdmin(Hashtable State)
{
DB db = new DB();
string sql = "SELECT application_type FROM applications WHERE application_name='" + State["SelectedAdminApp"].ToString() + "' AND customer_id='" + State["ServerAdminCustomerID"].ToString() + "'";
string application_type = db.ViziAppsExecuteScalar(State, sql);
db.CloseViziAppsDatabase(State);
return application_type;
}
示例7: GetDefaultTimeZone
public string GetDefaultTimeZone(Hashtable State)
{
DB db = new DB();
string sql = "SELECT default_time_zone_delta_hours FROM customers WHERE customer_id='" + State["CustomerID"].ToString() + "'";
string default_time_zone_delta_hours = db.ViziAppsExecuteScalar(State,sql);
db.CloseViziAppsDatabase(State);
State["TimeZoneDeltaHours"] = default_time_zone_delta_hours;
return default_time_zone_delta_hours;
}
示例8: getAppPaidSKU
//Get the SKU from paid_services table for the AppID.
public String getAppPaidSKU(Hashtable State)
{
DB db = new DB();
string sql = "SELECT sku FROM paid_services WHERE application_id='" + State["application_id"].ToString() + "' AND status='paid'";
string sku = db.ViziAppsExecuteScalar(State, sql);
db.CloseViziAppsDatabase(State);
State["SelectedAppSKU"] = sku;
string AppSKU = sku;
System.Diagnostics.Debug.WriteLine("AppSKU =" + AppSKU);
return AppSKU;
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
Util util = new Util();
if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
try
{
Message.Text = "";
ToEmail.Text = Request.QueryString.Get("email");
EmailType.Text = Request.QueryString.Get("type");
//fill in customers applications
string sql = "SELECT application_name FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
ApplicationList.Items.Clear();
if (rows != null && rows.Length > 0)
{
foreach (DataRow row in rows)
{
ApplicationList.Items.Add(row["application_name"].ToString());
}
}
ApplicationList.Items.Insert(0, "No Application Issue");
sql = "SELECT email FROM customers WHERE customer_id='" + State["CustomerID"].ToString() + "'";
string from = db.ViziAppsExecuteScalar(State, sql);
if (EmailType.Text == "Customer Email")
{
FromEmail.Text = HttpRuntime.Cache["TechSupportEmail"].ToString();
}
else if (from == null)
{
FromEmail.Text = "";
}
else
{
FromEmail.Text = from;
}
db.CloseViziAppsDatabase(State);
}
catch (Exception ex)
{
util.ProcessMainExceptions(State, Response, ex);
}
}
示例10: AgreeButton_Click
protected void AgreeButton_Click(object sender, EventArgs e)
{
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
Util util = new Util();
if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
DB db = new DB();
string sql = "SELECT agreed_to_eula FROM customers WHERE customer_id = '" + State["CustomerID"].ToString() + "'";
string agreed_to_eula = db.ViziAppsExecuteScalar((Hashtable)HttpRuntime.Cache[Session.SessionID], sql);
if (agreed_to_eula.ToLower() == "false" || agreed_to_eula == "0")
{
sql = "UPDATE customers SET agreed_to_eula=true WHERE customer_id = '" + State["CustomerID"].ToString() + "'";
db.ViziAppsExecuteNonQuery((Hashtable)HttpRuntime.Cache[Session.SessionID], sql);
SendEmailToSalesandCustomer(db);
}
db.CloseViziAppsDatabase(State);
State["LoggedinFromEula"] = true;
Response.Redirect("Default.aspx", false);
}
示例11: GetAppXmlForAdmin
public XmlDocument GetAppXmlForAdmin(Hashtable State)
{
XmlDocument doc = new XmlDocument();
DB db = new DB();
StringBuilder b_sql = new StringBuilder();
b_sql.Append("SELECT staging_app_xml FROM applications ");
b_sql.Append("WHERE application_name='" + State["SelectedAdminApp"].ToString() + "'");
b_sql.Append(" AND customer_id='" + State["ServerAdminCustomerID"].ToString() + "'");
DataRow[] rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
DataRow row = rows[0];
if (row["staging_app_xml"] == DBNull.Value || row["staging_app_xml"] == null)
{
State["AppXmlDoc"] = null;
return null;
}
string xml = row["staging_app_xml"].ToString();
Util util = new Util();
doc.LoadXml(util.DecodeMySql(xml));
db.CloseViziAppsDatabase(State);
return doc;
}
示例12: CancelPaidServicesDB
public void CancelPaidServicesDB(Hashtable State)
{
try
{
Util util = new Util();
string NOW = DateTime.Now.ToUniversalTime().ToString("u").Replace("Z", "");
string application_id = State["application_id"].ToString();
DB db = new DB();
StringBuilder b_sql = new StringBuilder("UPDATE paid_services SET ");
b_sql.Append("cancellation_date_time='" + NOW + "',");
b_sql.Append("status='cancelled'");
b_sql.Append("WHERE application_id='" + application_id + "'");
System.Diagnostics.Debug.WriteLine("b_sql =" + b_sql.ToString());
string sql_string = b_sql.ToString();
try
{
db.ViziAppsExecuteNonQuery(State, sql_string);
}
catch (Exception ex)
{
util.LogError(State, ex);
if (!ex.Message.ToLower().Contains("duplicate"))
throw new Exception(ex.Message);
}
db.CloseViziAppsDatabase(State);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message.ToString() + ex.StackTrace.ToString());
}
}
示例13: UpdateStagingAppXmlFromAdmin
public void UpdateStagingAppXmlFromAdmin(Hashtable State)
{
try
{
string NOW = DateTime.Now.ToUniversalTime().ToString("u").Replace("Z", "");
DB db = new DB();
StringBuilder b_sql = new StringBuilder("UPDATE applications SET ");
b_sql.Append("application_type='" + State["SelectedAdminAppType"].ToString() + "',");
XmlDocument doc = (XmlDocument)State["AdminAppDesign"];
Util util = new Util();
b_sql.Append("staging_app_xml='" + util.MySqlFilter(doc.OuterXml) + "',");
b_sql.Append("date_time_modified='" + NOW + "' ");
b_sql.Append("WHERE application_name='" + State["SelectedAdminApp"].ToString() + "'");
b_sql.Append(" AND customer_id='" + State["ServerAdminCustomerID"].ToString() + "'");
db.ViziAppsExecuteNonQuery(State, b_sql.ToString());
db.CloseViziAppsDatabase(State);
}
catch (Exception ex)
{
throw new Exception("Error in UpdateStagingAppXmlFromAdmin: " + ex.Message + ": " + ex.StackTrace);
}
}
示例14: LoginToUser_Click
protected void LoginToUser_Click(object sender, EventArgs e)
{
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
Util util = new Util();
if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
if (State["CustomerID"] == null)
{
Warning.Visible = true;
Warning.Text = "Unknown user credentials from email.";
return;
}
DB db = new DB();
string sql = "SELECT username,password FROM customers WHERE customer_id='" + State["CustomerID"].ToString() + "'";
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
DataRow row = rows[0];
db.CloseViziAppsDatabase(State);
State["Username"] = row["username"].ToString();
State["Password"] = row["password"].ToString();
State["LoggedInFromAdmin"] = true;
Response.Redirect("Default.aspx", false);
}
示例15: InitAccountList
public void InitAccountList(Hashtable State, RadComboBox Accounts, bool Initialize)
{
string sql = "SELECT username FROM customers ORDER BY username";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
Accounts.Items.Clear();
int index = 0;
foreach (DataRow row in rows)
{
string username = row["username"].ToString();
Accounts.Items.Add(new RadComboBoxItem(username,username));
if (Initialize)
{
if (username == State["Username"].ToString())
Accounts.SelectedIndex = index;
index++;
}
}
if (!Initialize)
Accounts.Items.Insert(0, new RadComboBoxItem("Select Account ->","Select Account ->"));
db.CloseViziAppsDatabase(State);
}