private void btnAddCard_Click(object sender, EventArgs e) { cdb = new CustomerDBLayer(); if (cdb.AddCard(txtCardNo.Text, pID, cmbCardType.Text, Convert.ToDecimal(txtBalance.Text))) { MessageBox.Show("Card Added Successfully"); txtCardNo.Text = cmbCardType.Text = txtBalance.Text = ""; } else { MessageBox.Show("Card Adding Unsuccessful"); } }
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); } }
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"); } }
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); } }
private void btnCreate_Click(object sender, EventArgs e) { bool result = false; try { if (txtPasswordCreate.Text == txtConfirmCreate.Text) { if (!CheckEmpty()) { if (txtPasswordCreate.TextLength < 8) { MessageBox.Show("Password must be of atLeast 8 Characters"); return; } string input = txtPasswordCreate.Text; bool isDigitPresent = input.Any(a => char.IsDigit(a)); if (!isDigitPresent) { MessageBox.Show("Password must contain atLeast 1 digit"); return; } if (cmbUserType.Text == "Customer") { if (!correctUnit(cmbUnitRam.Text)) { MessageBox.Show("Invlalid Ram Unit"); return; } if (!correctUnit(cmbUnitStr.Text)) { MessageBox.Show("Invlalid Capacity Unit"); return; } customerObj = new CustomerDBLayer(); customerObj.cusObj.setEmail(txtEmailCreate.Text); customerObj.cusObj.setName(txtName.Text); customerObj.cusObj.setGender(cmbGender.Text); customerObj.cusObj.setPswd(txtPasswordCreate.Text); customerObj.cusObj.setCountry(cmbCountry.Text); customerObj.cusObj.device.setName(txtDevName.Text); customerObj.cusObj.device.setOS(txtOS.Text); customerObj.cusObj.device.setRam(Convert.ToDecimal(txtRAM.Text)); customerObj.cusObj.device.setCapacity(Convert.ToDecimal(txtStorage.Text)); result = customerObj.CreateCustomer(cmbUnitRam.Text, cmbUnitStr.Text); } else if (cmbUserType.Text == "Developer") { developerObj = new AppDBLayer(); developerObj.developer.setEmail(txtEmailCreate.Text); developerObj.developer.setName(txtName.Text); developerObj.developer.setGender(cmbGender.Text); developerObj.developer.setPswd(txtPasswordCreate.Text); developerObj.developer.setCountry(cmbCountry.Text); result = developerObj.CreateDeveloper(); } if (result) { MessageBox.Show("Account created successfully"); IntializeBoxes(); } else { MessageBox.Show("Account creation unsuccessful"); } } else { MessageBox.Show("Some of the fields are empty"); } } else { MessageBox.Show("Both Passwords doesn't match"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }