コード例 #1
0
        void LoadAppData(string AppName)
        {
            txtFeedback.Visible  = btnSubmit.Visible = false;
            btnInstall.Visible   = true;
            btnUninstall.Visible = true;
            adb = new ApplicationDBLayer();
            adb.getApplicationData(AppName);
            lblAppName.Text     = AppName;
            lblDevName.Text     = "Developer: " + adb.app.getdevName();
            lblRating.Text      = adb.app.getRating() + " * ";
            txtDescription.Text = adb.app.getDescription();
            size            = Convert.ToDecimal(adb.app.dev.getCapacity());
            lblSize.Text    = Convert.ToString(adb.app.dev.getCapacity()) + " MB";
            lblReviews.Text = adb.LoadReviews(AppName).ToString();
            //var loc = lblReviews.Location;
            //loc.X = lblReviews.Location.X + lblReviews.Text.Length + 10;
            //lblReviewsText.Location = loc;
            AdjustLblPosition(lblReviewsText, lblReviews);
            //AdjustLblPosition(lblDownloadText, lblDownloads);
            //lblReviewsText.Location.X = lblReviews.Text.Length + lblReviewsText.Location.X;
            lblOS.Text = adb.app.dev.getOS();
            decimal p = adb.app.getPrice();

            if ((int)p == 0)
            {
                lblPrice.Text     = "Free";
                lblDollar.Visible = false;
            }
            else
            {
                lblPrice.Text     = adb.app.getPrice().ToString();
                lblDollar.Visible = true;
            }
            lblDownloads.Text = adb.LoadNoOfDownloads(AppName);
            AdjustLblPosition(lblDownloadText, lblDownloads);
            //tabUserMenu.SelectedTab = this.tabPage10;

            if (adb.CheckInstalled(AppName, pID))
            {
                btnInstall.Visible = false;
            }
            else
            {
                btnUninstall.Visible = false;
            }
            circularProgressBar1.Visible = false;
            circularProgressBar1.Value   = 0;
            lblReviewsText.Visible       = true;
        }
コード例 #2
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            try
            {
                cdb = new CustomerDBLayer();
                if (lblPrice.Text == "Free")
                {
                    decimal size1 = size / 2;



                    if (cdb.InstallApp(lblAppName.Text, pID))
                    {
                        circularProgressBar1.Visible = true;
                        for (int i = 0; i < 100; i++)
                        {
                            int a = (int)size1 / 100;
                            System.Threading.Thread.Sleep(a * 10);
                            circularProgressBar1.Value = i;
                            circularProgressBar1.Text  = i.ToString() + " %";
                        }
                        MessageBox.Show("App Installed Successfully");
                        circularProgressBar1.Visible = false;
                        circularProgressBar1.Value   = 0;
                        btnInstall.Visible           = false;
                        btnUninstall.Visible         = true;
                        adb = new ApplicationDBLayer();
                        lblDownloads.Text = adb.LoadNoOfDownloads(lblAppName.Text);
                        LoadDeviceInfo();
                    }
                    else
                    {
                        MessageBox.Show("App Installation Unsuccessful");
                    }
                }
                else
                {
                    tabControl5.SelectTab(tabPage11);
                    txtPayment.Text       = lblPrice.Text;
                    grpSelectCard.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void btnProceed_Click(object sender, EventArgs e)
        {
            cdb = new CustomerDBLayer();
            int cID = cdb.MakePayment(txtSelectCardNo.Text, pID, cmbSelectCardType.Text, Convert.ToDecimal(txtPayment.Text));

            if (cID != 0)
            {
                decimal size1 = size / 2;
                MessageBox.Show("Payment Successful");
                if (cdb.InstallApp(lblAppName.Text, pID))
                {
                    circularProgressBar1.Visible = true;
                    for (int i = 0; i < 100; i++)
                    {
                        int a = (int)size1 / 100;
                        System.Threading.Thread.Sleep(a * 10);
                        circularProgressBar1.Value = i;
                        circularProgressBar1.Text  = i.ToString() + " %";
                    }
                    MessageBox.Show("App Installed Successfully");
                    btnInstall.Visible   = false;
                    btnUninstall.Visible = true;
                    adb = new ApplicationDBLayer();
                    adb.LoadNoOfDownloads(lblAppName.Text);
                }
                else
                {
                    //Rollback payment is called

                    MessageBox.Show("App Installation Unsuccessful");
                    if (cdb.RollbackPayment(cID, cmbSelectCardType.Text, Convert.ToDecimal(txtPayment.Text)))
                    {
                        MessageBox.Show("Payment Rollback Successfully");
                    }
                    else
                    {
                        MessageBox.Show("Payment Rollback Unsuccessful");
                    }
                }
            }
            else
            {
                MessageBox.Show("Payment Unsuccessful");
            }
        }
コード例 #4
0
 private void btnUninstall_Click(object sender, EventArgs e)
 {
     try
     {
         cdb = new CustomerDBLayer();
         if (cdb.UninstallApp(lblAppName.Text, pID))
         {
             MessageBox.Show("App Uninstalled Successfully");
             btnInstall.Visible   = true;
             btnUninstall.Visible = false;
             adb = new ApplicationDBLayer();
             adb.LoadNoOfDownloads(lblAppName.Text);
             LoadDeviceInfo();
         }
         else
         {
             MessageBox.Show("App Uninstall Unsuccessful");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }