本文整理汇总了C#中Util.GetMaxUsers方法的典型用法代码示例。如果您正苦于以下问题:C# Util.GetMaxUsers方法的具体用法?C# Util.GetMaxUsers怎么用?C# Util.GetMaxUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util.GetMaxUsers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadExcelFileButton_Click
protected void UploadExcelFileButton_Click(object sender, EventArgs e)
{
Util util = new Util();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (util.CheckSessionTimeout(State, Response, "../../Default.aspx")) return;
if (this.FileUpload1.PostedFile != null)
{
// get the file
HttpPostedFile file = this.FileUpload1.PostedFile;
// check the length of the file
if (file.ContentLength > 0)
{
string app_name = ((Hashtable)HttpRuntime.Cache[Session.SessionID])["SelectedApp"].ToString();
string application_id = util.GetAppID((Hashtable)HttpRuntime.Cache[Session.SessionID]);
// get the Excel tables
ExcelUtil excel_util = new ExcelUtil();
DataTable[] excel_tables = excel_util.GetDataTablesFromExcelStream(file.InputStream);
if (excel_tables == null || excel_tables.Length == 0)
{
ErrorMessage.Text = "The file: '" + file.FileName + "' could not be processed as an Excel file.";
return;
}
DataTable excel_table = excel_tables[0];
//string update_type = UploadType.SelectedIndex == 0 ? "add" : "replace";
string update_type = "replace";
//check on user limit
long max_users = util.GetMaxUsers((Hashtable)HttpRuntime.Cache[Session.SessionID]);
if (max_users == 0 || max_users > 1000L)
{
ErrorMessage.Text = "No paid ViziApps service allows any production credentials";
return;
}
if (excel_table.Rows.Count - 1 > max_users)
{
ErrorMessage.Text = "The number of credentials in your Credentials File exceed the limit of the paid ViziApps service";
return;
}
StringBuilder errors = new StringBuilder("The file was successfully uploaded. Close this window.");
util.UpdateUserCredentials((Hashtable)HttpRuntime.Cache[Session.SessionID], application_id, excel_table.Rows, update_type);
ErrorMessage.Text = errors.ToString();
}
else
{
ErrorMessage.Text = "The file: '" + file.FileName + "' is empty.";
}
}
}
示例2: page_refresh
//.........这里部分代码省略.........
/*if (util.IsAppStoreSubmissionPaid(State, State["SelectedApp"].ToString()))
{*/
/*SubmissionNotes.Visible = true;
SubmissionNotesLabel.Visible = true;*/
//PurchaseButton.Visible = false;
/*}
else
{
SubmitForProvisioning.Visible = false;
SubmissionNotes.Visible = false;
SubmissionNotesLabel.Visible = false;
//PurchaseButton.Visible = true;
//ProvisioningMessage.Text = "You can fill this form any time, but to submit your app for production, you need to first purchase one of the ViziApps services to submit the app to an app store.";
//PurchaseButton.Attributes.Add("onclick", PopupHelper.GeneratePopupScript("http://stores.homestead.com/MobiFlexStore/StoreFront.bok", 700, 900, false, false, false, true));
}*/
DB db = new DB();
StringBuilder b_sql = new StringBuilder("SELECT * FROM applications ");
b_sql.Append("WHERE application_name='" + State["SelectedApp"].ToString() + "'");
b_sql.Append(" AND customer_id='" + State["CustomerID"].ToString() + "'");
DataRow[] rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
if (rows.Length > 0)
{
DataRow row = rows[0];
if (row["production_app_name"] != null)
ProductionAppName.Text = row["production_app_name"].ToString();
if (row["production_app_xml"] != DBNull.Value)
ProductionDesignExists.Visible = true;
else
ProductionDesignExists.Visible = false;
bool use_1_user_credential = false;
if (row["use_1_user_credential"] != DBNull.Value)
{
string use_1_cred = row["use_1_user_credential"].ToString();
use_1_user_credential = (use_1_cred.ToLower() == "true") ? true : false;
}
bool has_unlimited_users = false;
if (row["has_unlimited_users"] != DBNull.Value)
{
string has_unlimited = row["has_unlimited_users"].ToString();
has_unlimited_users = (has_unlimited.ToLower() == "true") ? true : false;
}
if (use_1_user_credential)
{
//NumberOfUsers.Style.Value = "";
//NumberOfUsersLabel.Style.Value = "";
//NumberOfUsers.SelectedIndex = 1;
ArrayList credential = util.GetEndUserCredentials(State);
if (credential != null && credential.Count > 0)
{
string[] output = (string[])credential[0];
SingleUsername.Text = output[0];
SinglePassword.Text = output[1];
}
LimitedUsersPanel.Style.Value = "";
}
else if (has_unlimited_users)
{
//NumberOfUsers.Style.Value = "display:none";
//NumberOfUsersLabel.Style.Value = "display:none";
LimitedUsersPanel.Style.Value = "display:none";
}
else
{
long max_users = util.GetMaxUsers(State);
if (max_users > 1000)
{
//NumberOfUsers.Style.Value = "display:none";
//NumberOfUsersLabel.Style.Value = "display:none";
LimitedUsersPanel.Style.Value = "display:none";
util.SetUnlimitedUsers(State);
}
}
}
b_sql = new StringBuilder("SELECT * FROM branding_images ");
b_sql.Append("WHERE application_id='" + State["ApplicationID"].ToString() + "'");
rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
foreach (DataRow image_row in rows)
{
if (image_row["type"].ToString() == "icon" && image_row["width"].ToString() == "512")
{
LargeIconButton.Visible = true;
DeleteIcon.Visible = true;
}
if (image_row["type"].ToString() == "splash")
{
ScreenSplashButton.Visible = true;
DeleteSplashImage.Visible = true;
}
}
db.CloseViziAppsDatabase(State);
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Util util = new Util();
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; }
try
{
ClearMessages();
State["ApplicationID"] = util.GetAppID(State);
App.Text = "Test Native App Name: " + State["SelectedApp"].ToString();
if (util.IsAppStoreSubmissionPaid(State, State["SelectedApp"].ToString()))
{
SubmitForProvisioning.Visible = true;
SubmissionNotes.Visible = true;
SubmissionNotesLabel.Visible = true;
PurchaseButton.Visible = false;
}
else
{
SubmitForProvisioning.Visible = false;
SubmissionNotes.Visible = false;
SubmissionNotesLabel.Visible = false;
PurchaseButton.Visible = true;
ProvisioningMessage.Text = "You can fill this form any time, but to submit your app for production, you need to first purchase one of the ViziApps services to submit the app to an app store.";
PurchaseButton.Attributes.Add("onclick", PopupHelper.GeneratePopupScript(
"http://stores.homestead.com/MobiFlexStore/StoreFront.bok", 700, 900, false, false, false, true));
}
if (!IsPostBack)
{
DB db = new DB();
StringBuilder b_sql = new StringBuilder("SELECT * FROM applications ");
b_sql.Append("WHERE application_name='" + State["SelectedApp"].ToString() + "'");
b_sql.Append(" AND customer_id='" + State["CustomerID"].ToString() + "'");
DataRow[] rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
DataRow row = rows[0];
if (row["production_app_name"] != null)
ProductionAppName.Text = row["production_app_name"].ToString();
if (row["production_app_xml"] != DBNull.Value)
ProductionDesignExists.Visible = true;
else
ProductionDesignExists.Visible = false;
bool use_1_user_credential = false;
if (row["use_1_user_credential"] != DBNull.Value)
{
string use_1_cred = row["use_1_user_credential"].ToString();
use_1_user_credential = (use_1_cred.ToLower() == "true") ? true : false;
}
bool has_unlimited_users = false;
if (row["has_unlimited_users"] != DBNull.Value)
{
string has_unlimited = row["has_unlimited_users"].ToString();
has_unlimited_users = (has_unlimited.ToLower() == "true") ? true : false;
}
if (use_1_user_credential)
{
NumberOfUsers.Style.Value = "";
NumberOfUsersLabel.Style.Value = "";
NumberOfUsers.SelectedIndex = 1;
ArrayList credential = util.GetEndUserCredentials(State);
if (credential != null && credential.Count > 0)
{
string[] output = (string[])credential[0];
SingleUsername.Text = output[0];
SinglePassword.Text = output[1];
}
LimitedUsersPanel.Style.Value = "";
}
else if (has_unlimited_users)
{
NumberOfUsers.Style.Value = "display:none";
NumberOfUsersLabel.Style.Value = "display:none";
LimitedUsersPanel.Style.Value = "display:none";
}
else
{
long max_users = util.GetMaxUsers(State);
if (max_users > 1000)
{
NumberOfUsers.Style.Value = "display:none";
NumberOfUsersLabel.Style.Value = "display:none";
LimitedUsersPanel.Style.Value = "display:none";
util.SetUnlimitedUsers(State);
}
else
{
UploadPublishedUserCredentials.Style.Value = "";
ViewPublishedUserCredentials.Style.Value = "";
UploadPublishedUserCredentials.Attributes.Add("onclick", PopupHelper.GeneratePopupScript(
"../../Dialogs/Publish/UploadUserCredentials.aspx", 350, 800, false, false, false, true));
ViewPublishedUserCredentials.Attributes.Add("onclick", PopupHelper.GeneratePopupScript(
//.........这里部分代码省略.........