Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CarFacade facade = CarFacade.Instance();

            if (!IsPostBack)
            {
                if (User.Identity.IsAuthenticated)
                {
                    if (facade.UserCar((String)Session["username"]) != null)
                    {
                        ShowCarInfo.Visible = true;
                        ShowCarType.Text    = string.Format(facade.UserCar((String)Session["username"]).Type);
                        ShowCapacity.Text   = string.Format(facade.UserCar((String)Session["username"]).Capacity.ToString());
                        ShowLicense.Text    = string.Format(facade.UserCar((String)Session["username"]).License);
                    }
                    else
                    {
                        EditCarInfo.Visible = true;
                    }
                }
                else
                {
                    Response.Redirect("~/Account/Login.aspx");
                }
            }
        }
Ejemplo n.º 2
0
 public static CarFacade Instance()
 {
     if (theInstance == null)
     {
         theInstance = new CarFacade();
     }
     return(theInstance);
 }
Ejemplo n.º 3
0
        public void ConfirmRide(object sender, EventArgs e)
        {
            // set car to the ride, add the new car into DB
            if (EditCarInfo.Visible)
            {
                CarFacade.Instance().AddCar(CarType.Text, Int32.Parse(Capacity.Text), LicenseNumber.Text);
            }
            else
            {
                CarFacade.Instance().AddCar();
            }

            // add the car into the ride object, store the ride into DB
            RideFacade.Instance().ConfirmRide();
            Response.Redirect("~/Confirm.aspx");
        }