//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();
        }
        private void DockSelector_DockSelect(object sender, Controls.DockEventArgs e)
        {
            int id = Convert.ToInt32(e.ID);

            DropDownSlips.DataSource     = MarinaManager.getAvailableSlipByDock(id);
            DropDownSlips.DataTextField  = "ID";
            DropDownSlips.DataValueField = "ID";
            DropDownSlips.DataBind();
            DropDownSlips.SelectedIndex = 0;
            uxID.Text   = e.ID;
            uxName.Text = e.Name;

            // convert boolean
            if (e.WaterService == true)
            {
                uxWaterServices.Text = "Available";
            }
            else
            {
                uxWaterServices.Text = "Not Available";
            }
            if (e.ElectricalService == true)
            {
                uxElectricalServices.Text = "Avaialable";
            }
            else
            {
                uxElectricalServices.Text = "Not Available";
            }
        }
示例#3
0
        protected void uxDocks_SelectedIndexChanged(object sender, EventArgs e)
        {
            // event fires
            if (DockSelect != null)
            {
                // get id from list
                var dockID = Convert.ToInt32(uxDocks.SelectedValue);

                // call manager
                var mgr = new MarinaManager();
                // get course object
                var dock = mgr.GetSingleDock(dockID);
                Dock = dock;

                // instantiate event args
                var arg = new DockEventArgs
                {
                    ID       = dock.ID,
                    eService = dock.ElectricalService,
                    wService = dock.WaterService
                };

                // pass args to event and invoke
                DockSelect.Invoke(this, arg);
            }
        }
示例#4
0
        //Login
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //Matching the name
            MarinaManager newMM     = new MarinaManager();
            var           FirstName = txtFirstName.Text;
            var           LastName  = txtLastName.Text;

            Customer cust = newMM.Authinticate(FirstName, LastName);

            if (cust != null)
            {
                //Creating session
                Session["FullName"]   = FirstName + " " + LastName;
                Session["CustomerID"] = cust.ID;

                FormsAuthentication.RedirectFromLoginPage(FirstName + " " + LastName + " ", false);
                Response.Redirect("~/Secure/LeaseSlip");
            }
            else
            {
                //Error if the user is not registered
                Response.Write("<script>alert('User does not exist, please register first.');</script>");
                //For registering
                txtPhone.Visible  = true;
                txtCity.Visible   = true;
                lblCity.Visible   = true;
                lblPhone.Visible  = true;
                btnSubmit.Visible = true;
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsUpdate)
            {
                //get customer id out of session
                if (Session["CustomerID"] != null && uxFirstName.Text == string.Empty)
                {
                    //need to convert the object in session to an int
                    var id = Convert.ToInt32(Session["CustomerID"]);

                    //get the Authentication object from the manager
                    var auth = MarinaManager.FindAuthentication(id);

                    //set the state of the form
                    if (auth != null)
                    {
                        uxFirstName.Text = auth.FirstName;
                        uxLastName.Text  = auth.LastName;
                        uxPhone.Text     = auth.Phone;
                        uxCity.Text      = auth.City;
                        uxUsername.Text  = $"{auth.FirstName}";     // pseudo login
                        uxPassword.Text  = $"{auth.LastName}";      // pseudo login
                    }
                }
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var mgr = MarinaManager.GetAllDocksAsList();
                uxDocks.DataSource     = mgr;
                uxDocks.DataValueField = "ID";
                uxDocks.DataTextField  = "Name";
                uxDocks.DataBind();
            }

            var id       = Convert.ToInt32(uxDocks.SelectedValue);
            var sliplist = MarinaManager.GetSelectedSlip(id);

            uxSelectedSlips.DataSource = sliplist;
            uxSelectedSlips.DataBind();

            HttpContext context = HttpContext.Current;

            var userId = Convert.ToInt32(context.Session["ID"]);
            var lease  = MarinaManager.GetCustomerLease(userId).ToList();

            uxLease.DataSource = lease;
            uxLease.DataBind();
        }
        public void LoadWithData(int dockID)
        {
            var manager        = new MarinaManager();
            var availableSlips = manager.GetAvailableSlips(dockID);

            ddlAvailable.DataSource = availableSlips;
            ddlAvailable.DataBind();
        }
示例#8
0
        private void DockSelector_DockSelect(object sender, Controls.DockEventArgs e)
        {
            int id = Convert.ToInt32(e.ID);

            // display available slips in grid view
            gridvSlips.DataSource = MarinaManager.getAvailableSlipByDock(id);
            gridvSlips.DataBind();
        }
        protected void ddlAvailable_SelectedIndexChanged(object sender, EventArgs e)
        {
            var manager = new MarinaManager();
            int slipID  = Convert.ToInt32(ddlAvailable.SelectedValue);

            txtLength.Text = Convert.ToString(manager.GetSlipLength(slipID));
            txtWidth.Text  = Convert.ToString(manager.GetSlipWidth(slipID));
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var manager = new MarinaManager();
            var docks   = manager.GetDocks();

            ddlDocks.DataSource = docks;
            ddlDocks.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var mgr = MarinaManager.GetAvailableSlips();
         uxAvailableSlips.DataSource = mgr;
         uxAvailableSlips.DataBind();
     }
 }
        protected void DdlDocks_SelectedIndexChanged(object sender, EventArgs e)
        {
            var manager        = new MarinaManager();
            int dockID         = Convert.ToInt32(ddlDocks.SelectedValue);
            var availableSlips = manager.GetAvailableSlipIDs(dockID);

            ddlAvailable.DataSource = availableSlips;
            ddlAvailable.DataBind();
        }
示例#13
0
 protected void btnLease_Click(object sender, EventArgs e)
 {
     if (lblSelectedSlipID.Text != "")
     {
         var         aID     = Convert.ToInt32(lblSelectedSlipID.Text);
         HttpContext context = HttpContext.Current;
         var         userId  = Convert.ToInt32(context.Session["ID"]);
         MarinaManager.AddNewLease(aID, userId);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     {
         uxWelcome.Text           = $"Hello  {Context.User.Identity.Name} , Welcome to Leasing!";
         DockSelector.DockSelect += DockSelector_DockSelect;
         int customerID = Convert.ToInt32(Session["CustomerID"]);
         uxLeaseHistory.DataSource = MarinaManager.GetLeasesByCustomerID(customerID);
         uxLeaseHistory.DataBind();
     }
 }
示例#15
0
        private void DockSelector_DockSelect(object sender, Controls.DockEventArgs e)
        {
            var dockID = e.ID;
            var slips  = MarinaManager.GetAllSlipsByDockId(dockID);

            uxSlips.DataSource     = slips;
            uxSlips.DataValueField = "ID";
            uxSlips.DataTextField  = "ID";     // slip ID
            uxSlips.DataBind();
        }
        protected void DropDownSlips_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ID    = Convert.ToInt32(DropDownSlips.SelectedValue);
            var slips = MarinaManager.FindSlip(ID);

            uxSlipId.Text = slips.ID.ToString();
            uxWidth.Text  = slips.Width.ToString();
            uxLength.Text = slips.Length.ToString();
            uxDockID.Text = slips.DockID.ToString();
        }
示例#17
0
 //for saving lease
 protected void btnLease_Click(object sender, EventArgs e)
 {
     MarinaManager mm = new MarinaManager();
     int custID = int.Parse(Session["CustomerID"].ToString());
     int spId = int.Parse(txtSlipLease.Text);
     mm.SaveLease(custID, spId);
     //Shows the updated leased slip list
     grdLesSlp.DataSource = mm.GetLeaseSlip();
     grdLesSlp.DataBind();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            var manager       = new MarinaManager();
            var customer      = (Customer)Session["Customer"];
            int userID        = customer.ID;
            var currentLeases = manager.GetLeasesByCustomer(userID);

            grdLeases.DataSource = currentLeases;
            grdLeases.DataBind();
        }
示例#19
0
        //this method is for the docks dropdown that will be executed on a selection change
        protected void uxDocks_SelectedIndexChanged1(object sender, EventArgs e)
        {
            // get id from the drop down list
            var selectedDock = Convert.ToInt32(uxDocks.SelectedValue);
            var mgr          = new MarinaManager();

            //popluate the gridview with the available slips
            uxSlipsGridview.DataSource = mgr.GetSlipsAvailable(selectedDock);
            DataBind(); // calls it on the page; in particular: uxInstructors.DataBind();
        }
        public void Refresh()
        {
            var manager       = new MarinaManager();
            var customer      = (Customer)Session["Customer"];
            int userID        = customer.ID;
            var currentLeases = manager.GetLeasesByCustomer(userID);

            grdLeases.DataSource = currentLeases;
            grdLeases.DataBind();
        }
示例#21
0
        static void Main(string[] args)
        {
            var a = MarinaManager.GetAvailableSlips();

            foreach (object s in a)
            {
                Console.WriteLine(s);
                Console.ReadLine();
            }
        }
示例#22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var mgr = new MarinaManager();
         uxDocks.DataSource     = mgr.GetAllDocks();
         uxDocks.DataTextField  = "Name";
         uxDocks.DataValueField = "ID";
         uxDocks.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var mgr = new MarinaManager();
         UxLeases.DataSource     = mgr.GetUnleasedSlip();
         UxLeases.DataValueField = "dkId";
         UxLeases.DataBind();
         //UxLeases.SelectedIndex = 0;
         //UxLeases_SelectedIndexChanged(this, e);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var manager = new MarinaManager();
         var docks   = manager.GetDocks();
         ddlDocks.DataSource = docks;
         ddlDocks.DataBind();
         var availableSlips = manager.GetAvailableSlipIDs(1);
         ddlAvailable.DataSource = availableSlips;
         ddlAvailable.DataBind();
     }
 }
        protected void uxAuthenticate_Click(object sender, EventArgs e)
        {
            //pass the credentials to the AuthenticationManager
            var Customer = MarinaManager.AuthenticateCustomer(uxUsername.Text, uxPassword.Text);

            // add customer id to session
            Session.Add("CustomerID", Customer.Id);

            // redirect
            FormsAuthentication.RedirectFromLoginPage(Customer.FirstName, false);
            //FormsAuthentication.SetAuthCookie(Customer.FirstName, true);
            Response.Redirect("~/secure/lease.aspx");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var dk = new MarinaManager();
         uxDocks.DataSource     = dk.GetAllListItems();
         uxDocks.DataTextField  = "Name";
         uxDocks.DataValueField = "ID";
         uxDocks.DataBind();
         uxDocks.SelectedIndex = 0;
         uxDocks_SelectedIndexChanged(this, e);
     }
 }
        protected void uxPurchase_Click(object sender, EventArgs e)
        {
            int customerID = Convert.ToInt32(Session["CustomerID"]);
            int slipID     = Convert.ToInt32(DropDownSlips.SelectedValue);
            var db         = new MarinaEntities();
            var lease      = new Lease {
                SlipID = slipID, CustomerID = customerID
            };

            db.Leases.Add(lease);
            db.SaveChanges();
            uxLeaseHistory.DataSource = MarinaManager.GetLeasesByCustomerID(customerID);
            uxLeaseHistory.DataBind();
        }
示例#28
0
        protected override void OnPreRenderComplete(EventArgs e)
        {
            if (Session["CustomerID"] == null)
            {
                return;
            }
            var CustomerID = Session["CustomerID"].ToString();
            var id         = int.Parse(CustomerID);

            var LeaseEnrollment = MarinaManager.GetCustomerLeaseEnrollment(id);

            uxEnrollment.DataSource = LeaseEnrollment;
            uxEnrollment.DataBind();
        }
示例#29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //if this the first time page load
     if (!IsPostBack)
     {
         var mgr = new MarinaManager();
         //populate the docks drop down list
         uxDocks.DataSource     = mgr.GetDocks();
         uxDocks.DataTextField  = "Name";
         uxDocks.DataValueField = "ID";
         uxDocks.DataBind();
         uxDocks.SelectedIndex = 0;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var slip = new MarinaManager();
         uxSlip.DataSource     = slip.GetAllSlipsListItems();
         uxSlip.DataTextField  = "ID";
         uxSlip.DataValueField = "Width";
         uxSlip.DataValueField = "Length";
         uxSlip.DataValueField = "DockId";
         uxSlip.DataBind();
         uxSlip.SelectedIndex = 0;
         uxSlip_SelectedIndexChanged(this, e);
     }
 }