当前位置: 首页>>代码示例>>C#>>正文


C# Util.SetFreeProductionExpiration方法代码示例

本文整理汇总了C#中Util.SetFreeProductionExpiration方法的典型用法代码示例。如果您正苦于以下问题:C# Util.SetFreeProductionExpiration方法的具体用法?C# Util.SetFreeProductionExpiration怎么用?C# Util.SetFreeProductionExpiration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util.SetFreeProductionExpiration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Web_SubmitPublishingForm_Click

    protected void Web_SubmitPublishingForm_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)
        {
            Web_PublishMessage.Text = "The Published App Name needs to be set and saved";
            return;
        }
        if (row["production_app_xml"] == DBNull.Value)
        {
            Web_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)
        {
            Web_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)
        {
            Web_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)
        {
            Web_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)
            {
                Web_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)
        {
            Web_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(" ", "_");
        Web_PublishMessage.Text = "Published App URL: " + url;

        BitlyData.LoginName = ConfigurationManager.AppSettings["BitlyLoginName"];
        BitlyData.APIKEY = ConfigurationManager.AppSettings["BitlyAPIKey"];
        String bitly_url = Bitly.ShortURL(url, Bitly.Format.TXT);
        Web_QRCode.Src = Bitly.GetQRCodeURL(bitly_url);
        Web_PublishedAppURL.Text = "Short-length published App URL: " + bitly_url;

        Web_QRCode.Style.Value = "";
        Web_QRCodeLabel.Style.Value = "";
        Web_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.";

        util.SetFreeProductionExpiration(State, DateTime.Now.ToUniversalTime().AddDays(14.0D));
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:100,代码来源:PublishingForm.aspx.cs

示例2: CG_CreateFreeCustomerAndInvoices


//.........这里部分代码省略.........

                return false;
            }

            //SUCCESS
            if (String.IsNullOrEmpty(returnCustomer.Code) == false)
            {
                AppCGCustomerCode = returnCustomer.Code;
            }

            // IF SUCCESSFULLY ABLE TO CREATE THE FREE NATIVE CUSTOMER THEN KICK OFF A ONE TIME INVOICE FOR BRANDING

            OneTimeInvoicePost myonetimeinvoice = new OneTimeInvoicePost();

            myonetimeinvoice.InvoiceCharges = new CustomChargePost[1];

            int number_of_charges = 0;
            CustomChargePost mycustom1 = new CustomChargePost();

            mycustom1.CustomerCode = AppCGCustomerCode;
            mycustom1.Description = "Branding";
            mycustom1.ChargeCode = "BRANDING ";
            mycustom1.EachAmount = 0;
            mycustom1.Quantity = 0;

            if ((State["SelectedDeviceType"].ToString() == Constants.ANDROID_PHONE || State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET) && (String.IsNullOrEmpty(AppCGCustomerCode) == false))
            {
                mycustom1.ChargeCode += "- ANRDOID";
                mycustom1.CustomerCode = AppCGCustomerCode;
                mycustom1.Quantity = 1;
                mycustom1.EachAmount += 99;
                mycustom1.Description += "- Android";
            }

            if ((State["SelectedDeviceType"].ToString() == Constants.IPHONE || State["SelectedDeviceType"].ToString() == Constants.IPAD) && (String.IsNullOrEmpty(AppCGCustomerCode) == false))
            {
                mycustom1.ChargeCode += "- iOS";
                mycustom1.Quantity = 1;
                mycustom1.EachAmount += 99;
                mycustom1.Description += "- iOS";
            }

            myonetimeinvoice.InvoiceCharges[number_of_charges] = new CustomChargePost();
            myonetimeinvoice.InvoiceCharges[number_of_charges] = mycustom1;

            CGError servererror2 = new CGError();
            //SERVER CALL TO THE ONE TIME INVOICE for both charges at once.
            Customer returnCustomer2 = CheddarGetter.CreateOneTimeInvoice(myonetimeinvoice, servererror2);

            if (String.IsNullOrEmpty(servererror2.Code) == false)
            {
                //CG.InnerHtml += "<li>ERROR:" + servererror2.Message;

                SubmitButton.Enabled = true;
                SubmitButton.Text = "Submit";

                //string clickHandler = "this.disabled = false; this.value=\'Submit\'; ";
                //SubmitButton.Attributes.Add("onclick", clickHandler);

                RadNotification1.Title = "WARNING";
                RadNotification1.Text = servererror2.Message;
                RadNotification1.Visible = true;
                RadNotification1.Show();

                return false;
            }

            //Store in the PaidServicesDB
            BillingUtil billingutil = new BillingUtil();

            //Record the new SKU but do not turn on the 'paid' field as yet.

            string confirm = returnCustomer2.Subscriptions[0].Invoices[1].PaidTransactionId.ToString();

            string sku = returnCustomer2.Subscriptions[0].SubscriptionsPlans[0].Code.ToString();
            billingutil.StorePaidServicesDB(confirm,sku,State,false);

            //Enable 10 day grace for App store Approval.
            Util util = new Util();
            util.SetFreeProductionExpiration(State, DateTime.Now.ToUniversalTime().AddDays(10.0D));

            //Send Email to Support.
            System.Text.StringBuilder body = new System.Text.StringBuilder("Customer Username: " + State["Username"].ToString() + "\n");
            body.Append("App Name: " + State["SelectedApp"].ToString() + "\n");
            body.Append("\n-- ViziApps Support");
            Email email = new Email();
            string status = email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(),  HttpRuntime.Cache["TechSupportEmail"].ToString(),"", "", "Customer submitted App for App Store Preparation", body.ToString(), "", false);

            return true;

        }//end try

        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.Message.ToString() + ex.StackTrace.ToString());

        }

        return false;
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:AppBrandingBilling.aspx.cs

示例3: SubmitPublishingFormClicked

    protected void SubmitPublishingFormClicked(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        /*if (!util.IsAppStoreSubmissionPaid(State, State["SelectedApp"].ToString()))
        {
            ProvisioningMessage.Text = "You need to first purchase one of the ViziApps services to submit the app to an app store.";
            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)
        {
            ProvisioningMessage.Text = "The Published App Name needs to be set and saved";
            return;
        }
        if (row["production_app_xml"] == DBNull.Value)
        {
            ProvisioningMessage.Text = "The Publish Design has not been saved";
            return;
        }

        string url = util.GetApplicationLargeIcon(State, State["ApplicationID"].ToString());
        if (url == null || url.Length == 0)
        {
            ProvisioningMessage.Text = "The Icon image has not been uploaded";
            return;
        }
        url = util.GetApplicationSplashImage(State, State["ApplicationID"].ToString());
        if (url == null || url.Length == 0)
        {
            ProvisioningMessage.Text = "The splash image has not been uploaded";
            return;
        }

        StringBuilder body = new StringBuilder("Customer Username: " + State["Username"].ToString() + "\n");
        body.Append("App Name: " + State["SelectedApp"].ToString() + "\n");
        body.Append("App Type: " + State["SelectedAppType"].ToString() + "\n");
        if (SubmissionNotes.Text.Length > 0)
            body.Append("Customer Notes: " + SubmissionNotes.Text + "\n");
        body.Append("\n-- ViziApps Support");

        Email email = new Email();

        string status = email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(),  HttpRuntime.Cache["TechSupportEmail"].ToString(), "", "", "Customer Submitted Publishing Form", body.ToString(), "", false);

        if (status.IndexOf("OK") >= 0)
        {
            ProvisioningMessage.Text = "Your publishing form has been received.";
        }
        else
        {
            ProvisioningMessage.Text = "There has been a problem submitting your publishing form. Please contact [email protected]";
        }

        util.SetFreeProductionExpiration(State, DateTime.Now.ToUniversalTime().AddDays(14.0D));
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:65,代码来源:PublishingForm.aspx.cs


注:本文中的Util.SetFreeProductionExpiration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。