protected void addRentalEquipment_Click(object sender, ListViewCommandEventArgs e) { MessageUserControl.TryRun(() => { if (string.IsNullOrEmpty(HIDDEN_LABEL_selectedCustomerID.Text)) { throw new Exception("Must have customer selected"); } else if (string.IsNullOrEmpty(creditcardinput.Text)) { throw new Exception("Must have credit card"); } else if (PendingRentalListView.Items.Count() == 0) { //Cont. RentalController Rmgr = new RentalController(); //Marshall Methods CouponController Cmgr = new CouponController(); //Test data //Chip Andale EmployeeID: 10 //Fuelling,Adolph 780.600.2840 CustomerID: 47 //int createAndReturnEmptyRentalID //selectedCustomerRental.Text = mgr.createAndReturnEmptyRentalID(47, 10, null, " ").ToString(); //public int createAndReturnEmptyRentalID(int customerid, int employeeid, int? couponid, string creditcard) selectedCustomerRental.Text = Rmgr.createAndReturnEmptyRentalID(int.Parse(HIDDEN_LABEL_selectedCustomerID.Text), 10, null, creditcardinput.Text).ToString(); //Cmgr.ValidateCoupon(string.IsNullOrEmpty(couponinput.Text) ? (int?)null : couponinput.Text).CouponID //Add selected equipment RentalDetailController __addmgr = new RentalDetailController(); __addmgr.addRentalEquipment(int.Parse(selectedCustomerRental.Text), int.Parse(e.CommandArgument.ToString())); RentalEquipmentListview.DataBind(); PendingRentalListView.DataBind(); if (string.IsNullOrEmpty(selectedCustomerRental.Text)) { throw new Exception("Equipment has not been added!!"); } MessageUserControl.ShowInfo("Form Created", "Item added to newly created form"); //newRental.Visible = true; } else { RentalDetailController mgr = new RentalDetailController(); mgr.addRentalEquipment(int.Parse(selectedCustomerRental.Text), int.Parse(e.CommandArgument.ToString())); RentalEquipmentListview.DataBind(); PendingRentalListView.DataBind(); MessageUserControl.ShowInfo("Equipment has been added."); } }); }
protected void clearUserControls() { HIDDEN_LABEL_selectedCustomerID.Text = ""; selectedCustomerRental.Text = ""; PhoneNumberInput.Text = ""; selectedCustomerName.Text = ""; selectedCustomerAddress.Text = ""; selectedCustomerCity.Text = ""; creditcardinput.Text = ""; //no real need //RentalEquipmentListview.DataBind(); CustomerListView.DataBind(); PendingRentalListView.DataBind(); newRental.Visible = false; }
protected void removeRentalEquipment_Click(object sender, ListViewCommandEventArgs e) { MessageUserControl.TryRun(() => { if (string.IsNullOrEmpty(HIDDEN_LABEL_selectedCustomerID.Text)) { throw new Exception("Must have customer selected"); } else if (string.IsNullOrEmpty(creditcardinput.Text)) { throw new Exception("Must have credit card"); } else { RentalDetailController mgr = new RentalDetailController(); mgr.removeRentalEquipment(int.Parse(selectedCustomerRental.Text), int.Parse(e.CommandArgument.ToString())); RentalEquipmentListview.DataBind(); PendingRentalListView.DataBind(); } }, "Equipment Removed", "Equipment has been Removed."); }
protected void clearUserControls() { HIDDEN_LABEL_selectedCustomerID.Text = ""; selectedCustomerRental.Text = ""; PhoneNumberInput.Text = ""; selectedCustomerName.Text = ""; selectedCustomerAddress.Text = ""; selectedCustomerCity.Text = ""; creditcardinput.Text = ""; PhoneNumberInput.Enabled = true; PhoneNumberInput.ForeColor = System.Drawing.Color.Empty; phoneNumberSubmitBtn.Enabled = true; phoneNumberSubmitBtn.ForeColor = System.Drawing.Color.Empty; //no real need //RentalEquipmentListview.DataBind(); CustomerListView.DataBind(); PendingRentalListView.DataBind(); //newRental.Visible = false; }