本文整理汇总了C#中DB.ViziAppsExecuteSql方法的典型用法代码示例。如果您正苦于以下问题:C# DB.ViziAppsExecuteSql方法的具体用法?C# DB.ViziAppsExecuteSql怎么用?C# DB.ViziAppsExecuteSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB.ViziAppsExecuteSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: SendEmails_Click
protected void SendEmails_Click(object sender, EventArgs e)
{
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (EmailBody.Text.Length == 0)
{
Message.Text = "The email body has no text";
return;
}
if (EmailSubject.Text.Length == 0)
{
Message.Text = "The email subject has no text";
return;
}
string type = EmailType.SelectedValue;
string sql = "";
DB db = new DB();
DataRow[] rows = null;
if (type == "Production Customers")
{
sql = "SELECT username,email FROM customers WHERE status='active'";
rows = db.ViziAppsExecuteSql(State, sql);
}
else
{
sql = "SELECT username,email FROM customers WHERE status!='inactive'";
rows = db.ViziAppsExecuteSql(State, sql);
}
StringBuilder no_emails = new StringBuilder();
StringBuilder sent_users = new StringBuilder();
Email email = new Email();
foreach (DataRow row in rows)
{
string username = row["username"].ToString();
string to_email = row["email"].ToString();
if (to_email.Length > 0)
{
email.SendEmail(State, HttpRuntime.Cache["TechSupportEmail"].ToString(), to_email, "", "", EmailSubject.Text, EmailBody.Text, "",false);
sent_users.Append(username + "\n");
}
else if(username!="admin" && username != "prompts")
{
no_emails.Append(username + "; ");
}
}
if (no_emails.Length > 0)
{
Message.Text = "The emails were sent successfully, except for the following users: " + no_emails.ToString();
}
else
Message.Text = "The emails were all sent successfully.";
SentUsers.Text = sent_users.ToString();
}
示例3: 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);
}
示例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: 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);
}
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
示例9: LoginToViziAppsFromGoogleApps
public string LoginToViziAppsFromGoogleApps(Hashtable State, string username)
{
try
{
string sql = "SELECT * FROM customers WHERE username='" + username + "' AND account_type like '%google_apps%'";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
if (rows.Length == 0)
{
db.CloseViziAppsDatabase(State);
return "The username is incorrect.";
}
DataRow row = rows[0];
if (row["status"].ToString() == "inactive")
{
db.CloseViziAppsDatabase(State);
return "Your account is inactive. Contact ViziApps to re-activate your account.";
}
//check expiration date
string expiration_date = row["expiration_date"].ToString();
if (expiration_date.Length > 0)
{
DateTime expiration = DateTime.Parse(expiration_date);
if (expiration < DateTime.Now.ToUniversalTime())
{
sql = "UPDATE customers SET status='inactive' WHERE customer_id='" + row["customer_id"].ToString() + "'";
db.ViziAppsExecuteNonQuery(State, sql);
db.CloseViziAppsDatabase(State);
return "Your account has expired.";
}
}
State["CustomerID"] = row["customer_id"].ToString();
string account_type = GetAccountType(row["account_type"].ToString());
State["AccountType"] = account_type;
State["CustomerEmail"] = row["email"].ToString();
Hashtable UsersList = (Hashtable)HttpRuntime.Cache["UsersList"];
if (UsersList == null)
{
//this shouldn't happen so report this now and go on
String error = "Application Cache UsersList has been set to null";
string NOW = GetCurrentDateTimeUTCMySqlFormat();
sql = "INSERT INTO error_log SET log_id=UUID(), timestamp='" + NOW + "',username='" +
username + "',app='no app selectred',error='" + error + "',stacktrace='no stack trace'";
db.ViziAppsExecuteNonQuery(State, sql);
db.CloseViziAppsDatabase(State);
HttpRuntime.Cache["UsersList"] = new Hashtable();
UsersList = (Hashtable)HttpRuntime.Cache["UsersList"];
}
string force_1_user_sessions = row["force_1_user_sessions"].ToString();
bool one_user_allowed = force_1_user_sessions == "1" || force_1_user_sessions.ToLower() == "true";
if (UsersList[username] != null)
{
Hashtable UserTable = (Hashtable)UsersList[username];
//check if only 1 user is allowed
if (one_user_allowed && State["PageRequestIPAddress"] != null && UserTable["PageRequestIPAddress"].ToString() != State["PageRequestIPAddress"].ToString())
return "The account is already in use.";
UserTable["PageRequestIPAddress"] = State["PageRequestIPAddress"].ToString();
UserTable["SessionID"] = State["SessionID"];
}
else
{
Hashtable UserTable = new Hashtable();
UserTable["PageRequestIPAddress"] = State["PageRequestIPAddress"].ToString();
UserTable["SessionID"] = State["SessionID"];
UsersList[username] = UserTable;
}
//initialize configurations
State["CustomerStatus"] = row["status"].ToString();
State["Password"] = "";
State["Username"] = username;
SetLoggedIn(State);
TimeZones zone_util = new TimeZones();
zone_util.GetDefaultTimeZone(State);
IncrementNLogins(State);
LogLastUsed(State);
string agreed_to_eula = row["agreed_to_eula"].ToString();
if (username.ToLower() == "admin")
return "admin";
else if (agreed_to_eula == "1" || agreed_to_eula.ToLower() == "true")
{
return "OK";
}
else
return "agree_to_EULA";
}
//.........这里部分代码省略.........
示例10: GetDesign
protected XmlDocument GetDesign(string application_id, string user_id, string customer_id,
int device_display_width, int device_display_height, string app_status, string time_stamp)
{
XmlUtil x_util = new XmlUtil();
Util util = new Util();
DB db = new DB();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
string sql = "SELECT application_name,application_type FROM applications WHERE application_id='" + application_id + "'";
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
DataRow row = rows[0];
string application_name = row["application_name"].ToString();
string application_type = row["application_type"].ToString();
State["SelectedApp"] = application_name;
XmlDocument Design = null;
if (app_status == "staging")
{
Design = util.GetStagingAppXml(State, application_name);
}
else
{
Design = util.GetProductionAppXml(State, application_name);
}
if (Design == null)
return null;
if (application_type == Constants.HYBRID_APP_TYPE)
{
WebAppsUtil w_util = new WebAppsUtil();
State["SelectedAppType"] = Constants.HYBRID_APP_TYPE;
HttpRuntime.Cache["NewWebAppHtml"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\NewViziAppsWebApp.txt");
HttpRuntime.Cache["NewHybridAppXml"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\NewViziAppsHybridApp.xml");
HttpRuntime.Cache["ShareThisScripts"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\ShareThisScripts.txt");
HttpRuntime.Cache["TempFilesPath"] = Server.MapPath(".") + @"\temp_files\";
State["Username"] = util.GetUsernameFromCustomerID(State, customer_id);
//get original design display width and height
string device_design_width = Design.SelectSingleNode("//configuration/device_design_width").InnerText;
string device_design_height = Design.SelectSingleNode("//configuration/device_design_height").InnerText;
double x_size_factor = 1.0D;
double y_size_factor = 1.0D;
if (device_display_width > 600)
{
x_size_factor = Convert.ToDouble(device_display_width) / Convert.ToDouble(device_design_width);
y_size_factor = Convert.ToDouble(device_display_height) / Convert.ToDouble(device_design_height);
}
if (app_status == "production")
State["IsProduction"] = true;
else
State["IsProduction"] = false;
string html = w_util.GetWebApp(State, Design, x_size_factor, y_size_factor);
Design = x_util.GenerateHybridAppXml(State, Design, device_display_width.ToString(), device_display_height.ToString(), html);
}
XmlNode configuration = Design.SelectSingleNode("//configuration");
if (user_id != null && user_id.Length > 0)
x_util.CreateNode(Design, configuration, "user_id", user_id);
x_util.CreateNode(Design, configuration, "customer_id", customer_id);
XmlNode app_node = Design.SelectSingleNode("//application");
if (time_stamp == null)
{
if (app_status == "staging")
{
time_stamp = util.GetStagingAppTimeStamp(State, application_id);
}
else
{
time_stamp = util.GetProductionAppTimeStamp(State, application_id);
}
}
x_util.CreateNode(Design, app_node, "time_stamp", time_stamp);
XmlNode id_node = app_node.SelectSingleNode("id");
if (id_node == null)
x_util.CreateNode(Design, app_node, "id", application_id);
else
id_node.InnerText = application_id;
XmlNode root = Design.SelectSingleNode("app_project");
if (root == null)
root = Design.SelectSingleNode("mobiflex_project");
XmlNode status_node = x_util.CreateNode(Design, root, "status", "OK");
return Design;
}
示例11: Login
//.........这里部分代码省略.........
//bool use_1_user_credential = util.GetUse1UserCredential(State, application_id);
//if (use_1_user_credential)
if (State["Use1UserCredential"] != null && State["Use1UserCredential"].ToString() == "true")
{
Hashtable features = util.IsProductionAppPaid(State, application_id);
DataRow row = rows[0];
sql = "SELECT COUNT(*) FROM users_device_ids WHERE user_id='" + row["user_id"].ToString() + "'";
int device_count = Convert.ToInt32(db.ViziAppsExecuteScalar(State, sql));
sql = "SELECT COUNT(*) FROM users_device_ids WHERE device_id='" + device_id + "'";
string device_exists = db.ViziAppsExecuteScalar(State, sql);
if (device_exists == "0")
{
if (device_count >= (int)features["max_users"])
{
db.CloseViziAppsDatabase(State);
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: reached limit of users");
throw new System.InvalidOperationException("Cannot download app: reached limit of users.");
}
else
{
sql = "INSERT INTO users_device_ids SET device_id='" + device_id + "',user_id='" + row["user_id"].ToString() + "'";
db.ViziAppsExecuteNonQuery(State, sql);
}
}
//else app is allowed
}
}
}
else //staging
{
sql = "SELECT * FROM customers WHERE username='" + user.ToLower() + "'";
rows = db.ViziAppsExecuteSql(State, sql);
if (rows.Length == 0)
{
db.CloseViziAppsDatabase(State);
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: user not registered");
throw new Exception("The username " + user.ToLower() + " is not registered. Go to www.viziapps.com and create a free account.");
}
DataRow row = rows[0];
if (row["password"].ToString() != password)
{
db.CloseViziAppsDatabase(State);
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: bad credentials");
throw new Exception("Either the username or the password: " + password + " is incorrect.");
}
if (row["status"].ToString() == "inactive")
{
db.CloseViziAppsDatabase(State);
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: account is inactive");
throw new Exception("Your account is inactive. Contact ViziApps to re-activate your account.");
}
customer_id = row["customer_id"].ToString();
State["CustomerID"] = customer_id;
}
//user is now logged in
if (app_status == "staging")
{
sql = "SELECT application_id FROM applications WHERE " +
"in_staging=1 AND customer_id='" + customer_id + "'";
application_id = db.ViziAppsExecuteScalar(State, sql);
示例12: CustomersByAccount_SelectedIndexChanged
protected void CustomersByAccount_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
ClearMessages();
HideForCustomers();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (e.Text.IndexOf("->") > 0)
{
CustomersByEmail.Items[0].Selected = true;
AdminMessage.Text = "Select a customer and try again.";
return;
}
State["ServerAdminCustomerUsername"] = e.Text;
string sql = "SELECT * FROM customers WHERE username='" + e.Text + "'";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
DataRow row = rows[0];
string customer_id = row["customer_id"].ToString();
string email = row["email"].ToString();
CustomersByAccount.FindItemByText(row["username"].ToString()).Selected = true;
CustomersByEmail.FindItemByText(email).Selected = true;
State["ServerAdminCustomerID"] = customer_id;
Util util = new Util();
RegisteredDateTime.Text = "Signed Up: " + row["registration_date_time"].ToString();
LastUsedDateTime.Text = "Last used: " + row["last_use_date_time"].ToString();
Password.Text = util.DecodeMySql(row["password"].ToString());
AccountTypes.Text = util.DecodeMySql(row["account_type"].ToString().Replace("type=","").Replace(";",""));
CustomerStatus.Text = row["status"].ToString();
if (row["email"] != null && row["email"].ToString().Length > 0)
{
util.AddEmailToButton(EmailCustomer, row["email"].ToString(), "Customer Email");
}
sql = "SELECT application_name FROM applications WHERE customer_id='" + customer_id + "' ORDER BY application_name";
rows = db.ViziAppsExecuteSql(State, sql);
Applications.Items.Clear();
foreach (DataRow row1 in rows)
{
Applications.Items.Add(new RadComboBoxItem(row1["application_name"].ToString()));
}
Applications.Items.Insert(0, new RadComboBoxItem("Select ViziApps App ->"));
db.CloseViziAppsDatabase(State);
ShowForCustomers();
}
示例13: MapAppToProductionService
public void MapAppToProductionService(Hashtable State, string app_name, string sku)
{
DB db = new DB();
String application_id = GetAppIDFromAppName(State, app_name);
string sql = "UPDATE paid_services SET app_name='" + app_name + "', application_id='" + application_id +
"' WHERE application_id IS NULL AND sku='" + sku + "' AND customer_id='" + State["CustomerID"].ToString() + "' AND status='paid' LIMIT 1";
db.ViziAppsExecuteNonQuery(State, sql);
sql = "SELECT status FROM applications WHERE application_name='" + app_name + "' AND customer_id='" + State["CustomerID"].ToString() + "'";
string status = db.ViziAppsExecuteScalar(State, sql);
if (!status.Contains("production"))
status += "/production";
string has_unlimited_users = "0";
sql = "SELECT sku FROM paid_services WHERE app_name='" + app_name + "' AND customer_id='" + State["CustomerID"].ToString() + "'";
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
if (rows.Length > 0)
{
foreach (DataRow row in rows)
{
sku = row["sku"].ToString();
sql = "SELECT max_users FROM sku_list WHERE sku='" + sku + "'";
string s_max_users = db.ViziAppsExecuteScalar(State, sql);
db.CloseViziAppsDatabase(State);
if (s_max_users != null && s_max_users.Length > 0)
{
long n_users = Convert.ToInt64(s_max_users);
if (n_users > 1000)
{
has_unlimited_users = "1";
break;
}
}
}
}
long max_users = GetMaxUsers(State, app_name);
sql = "UPDATE applications SET status='" + status + "'" +
",has_unlimited_users='" + has_unlimited_users +
"' WHERE application_name='" + app_name + "' AND customer_id='" + State["CustomerID"].ToString() + "'";
db.ViziAppsExecuteNonQuery(State, sql);
db.CloseViziAppsDatabase(State);
ResetAppInDynamoDB(State);
}
示例14: InitAppsList
// Modified from original viziapps code with the Additional Branded check so only valid ones are added to the ComboBox.
private bool InitAppsList(Hashtable State, RadComboBox AppsList)
{
Util util = new Util();
BillingUtil billingutil = new BillingUtil();
try
{
if (AppsList == null)
return false;
//string sql = "SELECT DISTINCT application_name FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name";
string sql = "SELECT DISTINCT application_name,application_type FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name";
DB db = new DB();
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
AppsList.Items.Clear();
foreach (DataRow row in rows)
{
string app_name = row["application_name"].ToString();
string app_type = row["application_type"].ToString();
//For native-hybrid apps do the branded check here inserting only Apps that have paid for branding.
if (app_type.Contains("native") || app_type.Contains("hybrid"))
{
//Inserting only Apps which meet all these criteria.
if ((billingutil.IsAppStoreSubmissionPaid(State, app_name) == true) && // + Submitted for App preparation.
(billingutil.IsAppPaid(State, app_name) == false)) // + not yet paid for any service
{
AppsList.Items.Add(new RadComboBoxItem(app_name, app_name));
}
}
else
{
//Inserting only Apps which meet all these criteria.
if (billingutil.IsAppPaid(State, app_name) == false) // not yet paid for any service
AppsList.Items.Add(new RadComboBoxItem(app_name, app_name));
}
}
if (AppsList.IsEmpty)
return false;
AppsList.Items.Insert(0, new RadComboBoxItem("Select App ->", "Select App ->"));
AppsList.Items[0].Selected = true;
return true;
}
catch (Exception ex)
{
util.ProcessMainExceptions(State, Response, ex);
}
return false;
}
示例15: CancelPaidService
public void CancelPaidService(Hashtable State, string purchase_date, string sku)
{
DB db = new DB();
string sql = "SELECT app_name FROM paid_services WHERE sku='" + sku + "' AND purchase_date='" + purchase_date + "'";
DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
if (rows.Length > 0)
{
DataRow row = rows[0];
string app_name = row["app_name"].ToString();
if (app_name != null && app_name.Length != 0)
RemoveAppFromProductionService(State, app_name, sku);
}
string NOW = DateTime.Now.ToUniversalTime().ToString("u").Replace("Z", "");
int day_of_month = DateTime.Parse(purchase_date).Day;
string expiration = DateTime.Now.ToUniversalTime()
.AddDays(-Convert.ToDouble(DateTime.Now.ToUniversalTime().Day))
.AddMonths(1)
.AddDays(Convert.ToDouble(day_of_month))
.ToString("u").Replace("Z", "");
StringBuilder b_sql = new StringBuilder("UPDATE paid_services SET ");
b_sql.Append("cancellation_date_time='" + NOW + "', ");
b_sql.Append("expiration_date_time='" + expiration + "', ");
b_sql.Append("app_name='NULL', ");
b_sql.Append("application_id='NULL', ");
b_sql.Append("status='cancelled' ");
b_sql.Append("WHERE sku='" + sku + "' ");
b_sql.Append("AND purchase_date='" + purchase_date + "'");
db.ViziAppsExecuteNonQuery(State, b_sql.ToString());
db.CloseViziAppsDatabase(State);
ResetAppInDynamoDB(State);
}