Ejemplo n.º 1
0
        //this the method that saves the select lease to the database
        protected void uxLease_Click(object sender, EventArgs e)
        {
            //get the selected slip from the dropdown
            var selectedSlip = Convert.ToInt32(uxSlips.SelectedValue);
            //get the customerid from the session
            var sessionCustomerID = ((int)Session["CustomerID"]);

            var newLease = new Lease       //create a new customer object entity class
            {
                SlipID     = selectedSlip, //add info from text boxes to object
                CustomerID = sessionCustomerID,
            };

            MarinaManager.AddLease(newLease); //call the add method to insert a new lease

            var mgr = new MarinaManager();

            //call the method that gets the data for the lease for the customer
            uxSlipsGridview.DataSource = mgr.GetSlipsGridviewCustomer(sessionCustomerID);
            DataBind();                                                // calls information on the page

            var selectedDock = Convert.ToInt32(uxDocks.SelectedValue); //get the select docks value

            //call the method that gets the available slips on the selected dock
            //and populate the slips drop down
            uxSlips.DataSource     = mgr.GetSlipsAvailable(selectedDock);
            uxSlips.DataTextField  = "ID";
            uxSlips.DataValueField = "ID";
            uxSlips.DataBind();
        }