本文整理汇总了C#中Util.IsProductionAppPaid方法的典型用法代码示例。如果您正苦于以下问题:C# Util.IsProductionAppPaid方法的具体用法?C# Util.IsProductionAppPaid怎么用?C# Util.IsProductionAppPaid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util.IsProductionAppPaid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login
public XmlDocument Login()
{
Init init = new Init();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
init.InitSkuConfigurations(State);
HttpRuntime.Cache["TempFilesPath"] = Server.MapPath(".") + @"\temp_files\";
Util util = new Util();
XmlUtil x_util = new XmlUtil();
XmlNode status = null;
XmlDocument Design = null;
try
{
DB db = new DB();
HttpRequest request = Context.Request;
string viziapps_version = request.QueryString.Get("viziapps_version");
if (viziapps_version == null)
viziapps_version = request.QueryString.Get("mobiflex_version");
string device_id = request.QueryString.Get("deviceid");
string device_model = request.QueryString.Get("device_model");
string customer_username = request.QueryString.Get("customer");
string app_status = (customer_username != null && customer_username.Length > 0) ? "production" : "staging";
string application_name = request.QueryString.Get("app");
string application_id = request.QueryString.Get("app_id");
string unlimited = request.QueryString.Get("unlimited");
string device_version = request.QueryString.Get("device_version");
if (application_id == null)
application_id = "";
string sql = null;
DataRow[] rows = null;
string customer_id = null;
string user_id = null;
string user = request.QueryString.Get("user");
string password = request.QueryString.Get("pwd");
string display_width = request.QueryString.Get("display_width");
if (display_width == null)
display_width = "320";
string display_height = request.QueryString.Get("display_height");
if (display_height == null)
display_height = "480";
if (device_model == null)
State["SelectedDeviceType"] = Constants.IPHONE;
else if (device_model.ToLower().Contains("iphone") || device_model.ToLower().Contains("ipod"))
State["SelectedDeviceType"] = Constants.IPHONE;
else if (device_model.ToLower().Contains("ipad"))
State["SelectedDeviceType"] = Constants.IPAD;
else if (Convert.ToInt32(display_width) > 600)
State["SelectedDeviceType"] = Constants.ANDROID_TABLET;
else
State["SelectedDeviceType"] = Constants.ANDROID_PHONE;
if (unlimited == null || unlimited != "true")
{
if (user == null || password == null)
{
Design = new XmlDocument();
XmlNode root2 = Design.CreateElement("login_response");
Design.AppendChild(root2);
status = x_util.CreateNode(Design, root2, "status", "Either the username or the password: " + password + " is incorrect.");
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: bad credentials");
return Design;
}
}
if (app_status == "production")
{
util.GetProductionAccountInfo(State, customer_username);
if (customer_id == null)
customer_id = State["CustomerID"].ToString();
//State["Username"] = customer_username;
//customer_id = util.GetCustomerIDFromUsername(State, customer_username);
//State["CustomerID"] = customer_id;
//string account_status = util.GetCustomerStatus(State);
// if (account_status == "inactive")
if (State["AccountStatus"].ToString() == "inactive")
{
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: account inactive");
throw new System.InvalidOperationException("Your customer account is inactive.");
}
util.GetProductionAppInfo(State, application_name);
application_id = State["AppID"].ToString();
if (State["IsProductionAppPaid"] != null && State["IsProductionAppPaid"].ToString() != "true")
{
//if (!util.IsFreeProductionValid(State, application_id))
if (State["IsFreeProductionValid"] != null && State["IsFreeProductionValid"].ToString() != "true")
{
SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, null, null, "app login: publishing service expired");
throw new System.InvalidOperationException("The publishing service for your app has expired.");
}
}
if (unlimited == null || unlimited != "true")
//.........这里部分代码省略.........
示例2: Publish_Click
protected void Publish_Click(object sender, EventArgs e)
{
Util util = new Util();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
if (util.CheckSessionTimeout(State, Response, "../../Default.aspx")) return;
//check if entries were set
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"] == DBNull.Value || row["production_app_name"].ToString().Length == 0)
{
PublishMessage.Text = "The Published App Name needs to be set and saved";
return;
}
if (row["production_app_xml"] == DBNull.Value)
{
PublishMessage.Text = "The Publish Design needs to be saved";
return;
}
string icon_url = util.GetApplicationLargeIcon(State, State["ApplicationID"].ToString());
if (icon_url == null || icon_url.Length == 0)
{
PublishMessage.Text = "The Icon image needs to be uploaded";
return;
}
string splash_url = util.GetApplicationSplashImage(State, State["ApplicationID"].ToString());
if (splash_url == null || splash_url.Length == 0)
{
PublishMessage.Text = "The splash image needs to be uploaded";
return;
}
//check on paid service
//is payment current
XmlUtil x_util = new XmlUtil();
Hashtable features = util.IsProductionAppPaid(State);
if (features == null)
{
PublishMessage.Text = "A production service needs to be paid for your app.";
return;
}
else //check number of pages
{
int page_count = x_util.GetProductionAppPageCount(State);
int sku_page_count = (int)features["max_pages"];
if (page_count > sku_page_count)
{
PublishMessage.Text = "Your production app of " + page_count.ToString() + " pages exceeds the page limit of " + sku_page_count .ToString() + " for the production service you paid for.";
return;
}
}
State["UrlAccountIdentifier"] = util.GetUrlAccountIdentifier(State);
if (State["UrlAccountIdentifier"].ToString().Length == 0)
{
PublishMessage.Text = "The Account Identifier has not been set. Go the Design Page and set the Account Identifier in the app properties";
return;
}
WebAppsUtil web_util = new WebAppsUtil();
AmazonS3 s3 = new AmazonS3();
State["IsProduction"] = true;
string file_name = State["SelectedApp"].ToString() + "/index.html";
file_name = file_name.Replace(" ", "_");
string save_file_path = HttpRuntime.Cache["TempFilesPath"].ToString() + State["Username"].ToString() + "." + file_name.Replace("/index.html", ".html");
if (File.Exists(save_file_path))
File.Delete(save_file_path);
string html = web_util.GetWebApp(State,util.GetStagingAppXml(State),1.0D,1.0D);
File.WriteAllText(save_file_path, html);
string key = State["UrlAccountIdentifier"].ToString() + "/" + file_name;
s3.UploadFileWithKey(State, file_name, save_file_path, key);
if (File.Exists(save_file_path))
File.Delete(save_file_path);
string filename = State["SelectedApp"].ToString().Replace(" ", "_") + "_qrcode.png";
string url = "http://viziapps.s3-website-us-east-1.amazonaws.com/" + State["UrlAccountIdentifier"].ToString() + "/" + State["SelectedApp"].ToString().Replace(" ", "_");
PublishMessage.Text = "Pulished App URL: " + url;
BitlyData.LoginName = ConfigurationManager.AppSettings["BitlyLoginName"];
BitlyData.APIKEY = ConfigurationManager.AppSettings["BitlyAPIKey"];
String bitly_url = Bitly.ShortURL(url, Bitly.Format.TXT);
QRCode.Src = Bitly.GetQRCodeURL(bitly_url);
PublishedAppURL.Text = "Short-length published App URL: " + bitly_url;
QRCode.Style.Value = "";
QRCodeLabel.Style.Value = "";
QRCodeLabel.Text = "QR Code for Published Web App: " + State["SelectedApp"].ToString() + ". Capture the URL from this image with any app that reads QR codes and you will see your app on your device in seconds.";
}
示例3: Report
public string Report(string app_id, string customer_id, string is_production)
{
Init init = new Init();
Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
init.InitSkuConfigurations(State);
Util util = new Util();
XmlUtil x_util = new XmlUtil();
XmlNode status_node = null;
XmlDocument Report = new XmlDocument();
XmlNode root = Report.CreateElement("mobiflex_report");
Report.AppendChild(root);
string xml_prefix = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
try
{
DB db = new DB();
if (is_production == "yes")
{
//is payment current
Hashtable features = util.IsProductionAppPaid(State, app_id);
if (features == null)
{
if (!util.IsFreeProductionValid(State, app_id))
{
x_util.CreateNode(Report, root, "status", "kill");
x_util.CreateNode(Report, root, "status_message", "The account for this app is inactive. Contact ViziApps to re-activate your account.");
return (xml_prefix + Report.OuterXml);
}
}
}
if (customer_id != null && customer_id.Length > 0)
{
State["CustomerID"] = customer_id;
string active_sql = "SELECT COUNT(*) FROM customers where customer_id='" + customer_id + "' AND status!='inactive'";
string active_count = db.ViziAppsExecuteScalar(State, active_sql);
if (active_count == "0")
{
x_util.CreateNode(Report, root, "status", "kill");
x_util.CreateNode(Report, root, "status_message", "The account for this app is inactive. Contact ViziApps to re-activate your account.");
return (xml_prefix + Report.OuterXml);
}
}
string status = "OK";
status_node = x_util.CreateNode(Report, root, "status", status);
}
catch (System.Exception SE)
{
util.LogError(State, SE);
if (status_node == null)
{
Report = new XmlDocument();
XmlNode root2 = Report.CreateElement("app_project");
Report.AppendChild(root2);
status_node = x_util.CreateNode(Report, root2, "status");
}
status_node.InnerText = SE.Message + ": " + SE.StackTrace;
}
return (xml_prefix + Report.OuterXml);
}