private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            ForceValidation();
            if (Validation.GetHasError(txtPasword) || Validation.GetHasError(txtuName))
            {
                MessageBox.Show("Error Some Data is Missing", "ERROR");
                return;
            }
            ResourceForm RFobj = new ResourceForm();
            LoginFactory obj   = new LoginFactory();
            Admin_Table  Aobj  = new Admin_Table();

            Aobj = obj.GetData(2);
            if (txtuName.Text == Aobj.A_UserName && txtPasword.Text == Aobj.A_Password)
            {
                this.Close();
                RFobj.ShowDialog();
            }
            else if (Aobj.A_UserName != txtuName.Text)
            {
                MessageBox.Show("User Name is Wrong Please Enter Again", "Error!");
            }
            else if (txtPasword.Text != Aobj.A_Password)
            {
                MessageBox.Show("Password is Wrong Please Enter Again", "Error!");
            }

            else
            {
                MessageBox.Show("Something is Wrong", "Error!");
            }
        }
        public IHttpActionResult PostAdmin_Table(Admin_Table admin_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Admin_Table.Add(admin_Table);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Admin_TableExists(admin_Table.AminId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = admin_Table.AminId }, admin_Table));
        }
        public IHttpActionResult PutAdmin_Table(int id, Admin_Table admin_Table)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != admin_Table.AminId)
            {
                return(BadRequest());
            }

            db.Entry(admin_Table).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Admin_TableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult DeleteAdmin_Table(int id)
        {
            Admin_Table admin_Table = db.Admin_Table.Find(id);

            if (admin_Table == null)
            {
                return(NotFound());
            }

            db.Admin_Table.Remove(admin_Table);
            db.SaveChanges();

            return(Ok(admin_Table));
        }
Ejemplo n.º 5
0
        public IHttpActionResult LoginCheck(Admin_Table user)
        {
            Admin_Table foundUser = db.Admin_Table.Where(a => a.Admin_username.Equals(user.Admin_username)).FirstOrDefault();

            if (foundUser == null)
            {
                return(NotFound());
            }
            else if (foundUser != null && user.Admin_password.Equals(foundUser.Admin_password))
            {
                return(Ok("Correct"));
            }
            else
            {
                return(NotFound());
            }
        }
Ejemplo n.º 6
0
        private async void RegisterButton_Clicked(object sender, EventArgs e)
        {
            if ((string.IsNullOrWhiteSpace(userNameEntry.Text)) || (string.IsNullOrWhiteSpace(passwordEntry.Text)) ||
                (string.IsNullOrWhiteSpace(emailEntry.Text)))
            {
                await DisplayAlert("Warning", "All fields are required", "Ok");
            }
            else if (!string.Equals(passwordEntry.Text, confirmPasswordEntry.Text))
            {
                await DisplayAlert("Warning", "Passwords don't match", "Ok");

                passwordEntry.Text        = string.Empty;
                confirmPasswordEntry.Text = string.Empty;
            }
            else
            {
                var admin = new Admin_Table();
                conn.CreateTable <Admin_Table>();
                admin.AdminEmail    = emailEntry.Text;
                admin.AdminUserName = userNameEntry.Text;
                admin.AdminPassword = passwordEntry.Text;

                var returnValue = helper.AddAdmin(userNameEntry.Text);
                if (returnValue)
                {
                    conn.Insert(admin);
                    await DisplayAlert("Success!", "New admin created", "Ok");

                    await Navigation.PopAsync();
                }
                else
                {
                    await DisplayAlert("Failure", "That Admin Username already exists", "OK");

                    warningLabel.IsVisible = false;

                    emailEntry.Text = string.Empty;

                    userNameEntry.Text = string.Empty;

                    passwordEntry.Text = string.Empty;

                    confirmPasswordEntry.Text = string.Empty;
                }
            }
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bank_Mangment_SystemEntities1 dbe = new Bank_Mangment_SystemEntities1();

            if (oldpasswordtxt.Text != string.Empty || newpasswordtxt.Text != string.Empty || retypepasswordtxt.Text != string.Empty)

            {
                Admin_Table user1 = dbe.Admin_Table.FirstOrDefault(a => a.Username.Equals(usertxt.Text));
                if (user1 != null)
                {
                    if (user1.Password.Equals(oldpasswordtxt.Text))
                    {
                        user1.Password = newpasswordtxt.Text;
                        dbe.SaveChanges();
                        MessageBox.Show("Password Changed Successfully!");
                    }
                    else
                    {
                        MessageBox.Show("Password Incorrect");
                    }
                }
            }
        }
        public MainPage()
        {
            InitializeComponent();

            Title = "Welcome";

            conn = DependencyService.Get <ITravelApp_db>().GetConnection();

            NavigationPage.SetHasNavigationBar(this.Main, true);

            conn.CreateTable <Admin_Table>();
            conn.CreateTable <User_Table>();
            conn.CreateTable <Trips_Table>();
            conn.CreateTable <Flights_Table>();
            conn.CreateTable <Dining_Table>();
            conn.CreateTable <Entertainment_Table>();
            conn.CreateTable <Lodging_Table>();
            conn.CreateTable <Transportation_Table>();

            var _UserList = conn.Query <User_Table>($"SELECT * FROM User_Table");
            var adminList = conn.Query <Admin_Table>($"SELECT * FROM Admin_Table");

            if (!adminList.Any())
            {
                var admin = new Admin_Table();
                admin.AdminUserName = "******";
                admin.AdminPassword = "******";
                admin.AdminEmail    = "*****@*****.**";
                conn.Insert(admin);
                adminList.Add(admin);
            }

            if (!_UserList.Any())
            {
                #region User Data
                var newUser = new User_Table();
                newUser.UserName  = "******";
                newUser.Password  = "******";
                newUser.FirstName = "User";
                newUser.LastName  = "Test";
                newUser.UserEmail = "*****@*****.**";

                conn.Insert(newUser);
                _UserList.Add(newUser);

                var newUser1 = new User_Table();
                newUser1.UserName  = "******";
                newUser1.Password  = "******";
                newUser1.FirstName = "John";
                newUser1.LastName  = "Doe";
                newUser1.UserEmail = "*****@*****.**";

                conn.Insert(newUser1);
                _UserList.Add(newUser1);

                #endregion

                #region Trips Data

                var newTrip2 = new Trips_Table();
                newTrip2.UserName          = newUser.UserName;
                newTrip2.TripName          = "Disneyland 2021";
                newTrip2.TripStart         = new DateTime(2021, 11, 12);
                newTrip2.TripEnd           = new DateTime(2021, 11, 17);
                newTrip2.Notes             = "We're In Disneyland Evan";
                newTrip2.TripNotifications = 0;
                newTrip2.UserId            = newUser.UserId;

                conn.Insert(newTrip2);

                var newTrip3 = new Trips_Table();
                newTrip3.UserName          = newUser1.UserName;
                newTrip3.TripName          = "Utah 2020";
                newTrip3.TripStart         = new DateTime(2020, 11, 12);
                newTrip3.TripEnd           = new DateTime(2020, 11, 17);
                newTrip3.Notes             = "Request time off";
                newTrip3.TripNotifications = 1;
                newTrip3.UserId            = newUser1.UserId;

                conn.Insert(newTrip3);

                #endregion

                #region Dining Data
                var newRes = new Dining_Table();
                newRes.ResName          = "Carnation Cafe";
                newRes.ResAddress       = "Disneyland Park, Anaheim, CA 92802";
                newRes.ResPhone         = "(714)781-3463";
                newRes.ResDate          = DateTime.Today;
                newRes.ResNotes         = "Dinner with my wife";
                newRes.ResNotifications = 1;
                newRes.TripId           = newTrip2.TripId;

                conn.Insert(newRes);

                var newRes2 = new Dining_Table();
                newRes2.ResName          = "Rainforest Cafe";
                newRes2.ResAddress       = "123 Downtown Disney District, Anaheim, CA 92802";
                newRes2.ResPhone         = "(714)866-5555";
                newRes2.ResDate          = new DateTime(2020, 11, 12);
                newRes2.ResNotes         = "Birthday Dinner";
                newRes2.ResNotifications = 1;
                newRes2.TripId           = newTrip2.TripId;

                conn.Insert(newRes2);
                #endregion

                #region Entertainment Data
                var newActivity = new Entertainment_Table();
                newActivity.EntertainName          = "Disneyland";
                newActivity.EntertaninStart        = new DateTime(2020, 11, 12, 08, 00, 00);
                newActivity.EntertainEnd           = new DateTime(2020, 11, 12, 23, 00, 00);
                newActivity.EnterainAddress        = "1313 Disneyland Dr, Anaheim, CA 92802";
                newActivity.EntertainPhone         = "(714)781-4636";
                newActivity.EntertainNotes         = "Get to the park at 7:00";
                newActivity.EntertainNotifications = 1;
                newActivity.TripId = newTrip2.TripId;

                conn.Insert(newActivity);

                var newActivity2 = new Entertainment_Table();
                newActivity2.EntertainName          = "Disneyland";
                newActivity2.EntertaninStart        = new DateTime(2020, 11, 14, 07, 00, 00);
                newActivity2.EntertainEnd           = new DateTime(2020, 11, 15, 00, 00, 00);
                newActivity2.EnterainAddress        = "1313 Disneyland Dr, Anaheim, CA 92802";
                newActivity2.EntertainPhone         = "(714)781-4636";
                newActivity2.EntertainNotes         = "Get to the park at 6:00";
                newActivity2.EntertainNotifications = 1;
                newActivity2.TripId = newTrip2.TripId;

                conn.Insert(newActivity2);
                #endregion

                #region Flights Data
                var newflight = new Flights_Table();
                newflight.FlightNumber        = "SWA123";
                newflight.AirlineName         = "Southwest";
                newflight.DepartTime          = new DateTime(2020, 11, 12, 1, 45, 00);
                newflight.ArriveTime          = new DateTime(2020, 11, 12, 3, 30, 00);
                newflight.DepartLocation      = "SLC";
                newflight.ArriveLocation      = "LAX";
                newflight.DepartGate          = "A5";
                newflight.FlightNotifications = 1;
                newflight.TripId = newTrip2.TripId;

                conn.Insert(newflight);

                var newflight1 = new Flights_Table();
                newflight1.FlightNumber        = "SWA987";
                newflight1.AirlineName         = "Southwest";
                newflight1.DepartTime          = new DateTime(2020, 11, 17, 8, 00, 00);
                newflight1.ArriveTime          = new DateTime(2020, 11, 17, 10, 10, 00);
                newflight1.DepartLocation      = "LAX";
                newflight1.ArriveLocation      = "SLC";
                newflight1.DepartGate          = "G13";
                newflight1.FlightNotifications = 0;
                newflight1.TripId = newTrip2.TripId;

                conn.Insert(newflight1);

                #endregion

                #region Lodging Data
                var newLodge = new Lodging_Table();
                newLodge.LodgeName          = "Best Western Plus Pavilions";
                newLodge.LodgeLocation      = "1176 W Katella Ave, Anaheim, CA 92802";
                newLodge.LodgePhone         = "(714)776-0140";
                newLodge.LodgeStart         = new DateTime(2020, 11, 12, 11, 00, 00);
                newLodge.LodgeEnd           = new DateTime(2020, 11, 15, 9, 00, 00);
                newLodge.LodgeNotifications = 1;
                newLodge.TripId             = newTrip2.TripId;

                conn.Insert(newLodge);

                var newLodge1 = new Lodging_Table();
                newLodge1.LodgeName          = "Best Western Plus Stovals";
                newLodge1.LodgeLocation      = "1100 W Katella Ave, Anaheim, CA 92802";
                newLodge1.LodgePhone         = "(714)776-5555";
                newLodge1.LodgeStart         = new DateTime(2020, 11, 15, 11, 00, 00);
                newLodge1.LodgeEnd           = new DateTime(2020, 11, 17, 9, 00, 00);
                newLodge1.LodgeNotifications = 0;
                newLodge1.TripId             = newTrip2.TripId;

                conn.Insert(newLodge1);

                #endregion

                #region Transportation Data
                var newRental = new Transportation_Table();
                newRental.RentalName          = "Hertz";
                newRental.ConfNumber          = "1E0C2G";
                newRental.PickUpDate          = new DateTime(2020, 11, 12);
                newRental.ReturnDate          = new DateTime(2020, 11, 17);
                newRental.PickUpLocation      = "Los Angeles International Airport";
                newRental.ReturnLocation      = "Los Angeles International Airport";
                newRental.RentalPhone         = "(555)888-5555";
                newRental.RentalNotifications = 1;
                newRental.TripId = newTrip2.TripId;

                conn.Insert(newRental);

                #endregion
            }
        }