protected void uxUpdate_Click(object sender, EventArgs e)
        {
            if (Session["Customer"] != null)
            {
                var proxy = new MarinaServiceClient();

                proxy.UpdateCustomer(((Customer)(Session["Customer"])).ID,
                                     uxFirstName.Text,
                                     uxLastName.Text,
                                     uxPhone.Text,
                                     uxCity.Text);//update Customer database

                proxy.UpdateAuthorize(uxUsername.Text,
                                      uxPassword.Text,
                                      ((Customer)(Session["Customer"])).ID);//update associated Customer Authorize data in database

                Customer cust = (Customer)Session["Customer"];
                cust.FirstName          = uxFirstName.Text;
                cust.LastName           = uxLastName.Text;
                cust.Phone              = uxPhone.Text;
                cust.City               = uxCity.Text;
                cust.Authorize.UserName = uxUsername.Text;
                cust.Authorize.Password = uxPassword.Text;

                Session["Customer"] = cust;
                FormsAuthentication.RedirectFromLoginPage(cust.FirstName + " " + cust.LastName, false);
            }
        }
Example #2
0
        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            if (Session["Customer"] == null)
            {
                var proxy = new MarinaServiceClient();

                var auth = new Authorize();
                auth.UserName = uxUsername.Text;
                auth.Password = uxPassword.Text;

                var customerID = proxy.AddCustomer(uxFirstName.Text,
                                                   uxLastName.Text,
                                                   uxPhone.Text,
                                                   uxCity.Text); //persist Customer to database and get Customer ID

                var customerSessionData = new Customer(Convert.ToInt32(customerID),
                                                       uxFirstName.Text,
                                                       uxLastName.Text,
                                                       uxPhone.Text,
                                                       uxCity.Text,
                                                       auth);

                proxy.AddAuthorize(uxUsername.Text, uxPassword.Text, Convert.ToInt32(customerID)); //persist Authorize data to database

                Session.Add("Customer", customerSessionData);                                      //add to session
                Session.Add("CustID", customerID);                                                 //get ID for boat method

                FormsAuthentication.RedirectFromLoginPage(customerSessionData.FirstName + " " + customerSessionData.LastName, false);
            }
            else
            {
                Response.Redirect("~/Home.aspx");
            }
        }
Example #3
0
        protected void uxSubmit_Click(object sender, EventArgs e)
        {
            var proxy = new MarinaServiceClient();

            Customer customer = proxy.Authenticate(uxUsername.Text, uxPassword.Text);

            if (customer != null)
            {
                Session["CustID"]   = customer.ID;
                Session["Customer"] = customer;
                FormsAuthentication.RedirectFromLoginPage(customer.FirstName + " " + customer.LastName, false);
            }
        }
Example #4
0
        protected void uxSave_Click(object sender, EventArgs e)
        {
            try
            {
                uxMessage.Text = "";
                var proxy = new MarinaServiceClient();

                var startDate  = Convert.ToDateTime(uxStartDate.Text);
                var endDate    = Convert.ToDateTime(uxEndDate.Text);
                var slip       = int.Parse(uxSlip.SelectedItem.Value);
                var customerID = ((Customer)Session["Customer"]).ID;
                var leaseType  = int.Parse(uxLeaseType.SelectedItem.Value);

                proxy.AddLease(startDate, endDate, slip, customerID, leaseType);

                uxMessage.Text = "Lease ID " + slip.ToString() + " Added Successfully For Customer " + ((Customer)Session["Customer"]).FirstName + " " + ((Customer)Session["Customer"]).LastName + " !";
            }
            catch
            {
                uxMessage.Text = "Error ! Please Contact Administrator for more Information !";
            }
        }
Example #5
0
        protected void uxSave_Click(object sender, EventArgs e)
        {
            try
            {
                uxMessage.Text = "";
                var proxy = new MarinaServiceClient();

                var registrationNo = uxRegistrationNo.Text;
                var manufacturer   = uxManufacturer.Text;
                var modelYear      = int.Parse(uxModelYear.SelectedItem.Text);
                var length         = int.Parse(uxLength.Text);
                var customerID     = ((Customer)Session["Customer"]).ID;

                proxy.AddBoat(registrationNo, manufacturer, modelYear, length, customerID);

                uxMessage.Text    = "New boat added successfully for customer" + ((Customer)Session["Customer"]).FirstName + " " + ((Customer)Session["Customer"]).LastName + " !";
                ux2ndMessage.Text = "Boat: Registration No." + registrationNo + ", manufacturer: " + manufacturer + ", length: " + length.ToString() + " (year made: " + modelYear.ToString() + ")";
            }
            catch
            {
                uxMessage.Text = "Error ! Please Contact Administrator for more Information ! (Hint: Length has to be a number)";
            }
        }