protected void selectCustomer_Click(object sender, ListViewCommandEventArgs e) { MessageUserControl.TryRun(() => { if (!phoneNumberSubmitBtn.Enabled) //if (!string.IsNullOrEmpty(selectedCustomerRental.Text)) { throw new Exception("A customer profile is loaded! Must cancel to re-select"); } else { RentalCustomerController mgr = new RentalCustomerController(); Customer customer = mgr.selectSingleCustomer(int.Parse(e.CommandArgument.ToString())); selectedCustomerRental.Text = e.CommandArgument.ToString(); HIDDEN_LABEL_selectedCustomerID.Text = customer.CustomerID.ToString(); PhoneNumberInput.Text = customer.ContactPhone; selectedCustomerName.Text = customer.LastName + ", " + customer.FirstName; selectedCustomerAddress.Text = customer.Address; selectedCustomerCity.Text = customer.City; //Actually editing database!!! //RentalController RCmgr = new RentalController(); //Rental by its self gernerats a error, must declare entire namespace - naming coflicts //eTools.Data.Entities.Rental rental = RCmgr.returnSingleRentalForm(int.Parse(e.CommandArgument.ToString())); //RentalDetails //DateOut.Text = rental.RentalDate.ToString(); //CreditCard.Text = rental.CreditCard; //Subtotal.Text = rental.SubTotal.ToString(); //GST.Text = rental.TaxAmount.ToString(); //Discount.Text = rental.Coupon.CouponDiscount.ToString(); //Total.Text = (((rental.SubTotal) + (rental.TaxAmount)) - ((decimal)rental.Coupon.CouponDiscount)).ToString(); //TextBox as Input RentalDetailController RDCmgr = new RentalDetailController(); auxReturnInfo info = RDCmgr.getauxeturnInfo(int.Parse(e.CommandArgument.ToString())); //RentalDetails DateOut.Text = info.dateout.ToString(); CreditCard.Text = info.creditcard; Subtotal.Text = info.subtotal.ToString(); GST.Text = info.gst.ToString(); Discount.Text = info.discount.ToString(); Total.Text = info.total.ToString(); PhoneNumberInput.Enabled = false; PhoneNumberInput.ForeColor = System.Drawing.Color.LightGray; //Button as Input phoneNumberSubmitBtn.Enabled = false; phoneNumberSubmitBtn.ForeColor = System.Drawing.Color.LightGray; //No need as the if above checks if profile is loaded //selectedCustomerBtn newReturn.Visible = true; } }, "Customer Found", "Profile has been successfully retrived. Must select New Return Button to Load New Profile"); }
private void testingOnly() { MessageUserControl.TryRun(() => { //test case int testRentalId = 234; RentalCustomerController mgr = new RentalCustomerController(); Customer customer = mgr.selectSingleCustomer(testRentalId); //customer = mgr.customersReturnLookUp selectedCustomerRental.Text = testRentalId.ToString(); HIDDEN_LABEL_selectedCustomerID.Text = customer.CustomerID.ToString(); PhoneNumberInput.Text = customer.ContactPhone; selectedCustomerName.Text = customer.LastName + ", " + customer.FirstName; selectedCustomerAddress.Text = customer.Address; selectedCustomerCity.Text = customer.City; RentalDetailController RDCmgr = new RentalDetailController(); auxReturnInfo info = RDCmgr.getauxeturnInfo(testRentalId, 5.5); //RentalDetails DateOut.Text = info.dateout.ToString(); CreditCard.Text = info.creditcard; Subtotal.Text = info.subtotal.ToString(); GST.Text = info.gst.ToString(); Discount.Text = info.discount.ToString(); Total.Text = info.total.ToString(); PhoneNumberInput.Enabled = false; PhoneNumberInput.ForeColor = System.Drawing.Color.LightGray; //Button as Input phoneNumberSubmitBtn.Enabled = false; phoneNumberSubmitBtn.ForeColor = System.Drawing.Color.LightGray; //No need as the if above checks if profile is loaded //selectedCustomerBtn newReturn.Visible = true; }, "Testing Error", "Testing related error"); }
protected void selectCustomer_Click(object sender, ListViewCommandEventArgs e) { MessageUserControl.TryRun(() => { if (!string.IsNullOrEmpty(HIDDEN_LABEL_selectedCustomerID.Text)) { throw new Exception("A customer profile is loaded! Must cancel to re-select"); } else { RentalCustomerController mgr = new RentalCustomerController(); /* * selectedCustomerName.Text = mgr.selectSingleCustomer(int.Parse(selectedCustomerRental.Text)).ToString(); * selectedCustomerAddress.Text = mgr.selectSingleCustomer(int.Parse(selectedCustomerRental.Text)).ToString(); * selectedCustomerCity.Text = mgr.selectSingleCustomer(int.Parse(selectedCustomerRental.Text)).ToString(); * * DOESN'T WORK!!!! * Empty string is default for selectedCustomerRental * Customer customer = mgr.selectSingleCustomer(int.Parse(selectedCustomerRental.Text)); */ Customer customer = mgr.selectSingleCustomer(int.Parse(e.CommandArgument.ToString())); HIDDEN_LABEL_selectedCustomerID.Text = customer.CustomerID.ToString(); selectedCustomerName.Text = customer.LastName + ", " + customer.FirstName; selectedCustomerAddress.Text = customer.Address; selectedCustomerCity.Text = customer.City; PhoneNumberInput.Enabled = false; PhoneNumberInput.ForeColor = System.Drawing.Color.LightGray; phoneNumberSubmitBtn.Enabled = false; phoneNumberSubmitBtn.ForeColor = System.Drawing.Color.LightGray; } }, "Customer Found", "Profile has been successfully retrived."); }