示例#1
0
        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.");
                }
            });
        }
示例#2
0
 protected void deleteRental_Click(object sender, EventArgs e)
 {
     MessageUserControl.TryRun(() =>
     {
         if (string.IsNullOrEmpty(selectedCustomerRental.Text))
         {
             throw new Exception("No form to delete");
         }
         else
         {
             RentalController mgr = new RentalController();
             mgr.deleteRental(int.Parse(selectedCustomerRental.Text));
             RentalEquipmentListview.DataBind();
             clearUserControls();
         }
     }, "Deleted Rental Order", "Order has beem successfully deleted.");
 }
示例#3
0
 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.");
 }