Example #1
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);
            }
        }
Example #2
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");
            }
        }