//Constructor
 public MakeAPayment(AggActiveAccount prof)
 {
     InitializeComponent();
     profile = prof;
     CopyObject2Form(profile);
     this.Show();
 }
 public void CopyObject2Form(string movieSelect, AggActiveAccount prof, double moviePrice, int rentLength)
 {
     movieTitle_TXT.Text = movieSelect;
     currentBal_TXT.Text = prof.Balance.ToString();
     afterBal_TXT.Text = Convert.ToString((prof.Balance) + (moviePrice));
     dueDateBox.Text = Convert.ToString(DateTime.Now.AddDays(rentLength));
 }
 //Constructor
 public AccountInfo(AggActiveAccount prof)
 {
     InitializeComponent();
     this.Show();
     profile = prof;
     CopyObject2Form(prof);
 }
        private void login_BTN_Click(object sender, EventArgs e)
        {
            userProfile = new AggActiveAccount();
            DataTable memberData = new DataTable();

            //Creates DataTable with all relevant user information
            memberData = AggActiveAccount.CreateAggDataTable(loginUserBox.Text, loginPassBox.Text);

            //if username/pass combo does not exist
            if (memberData.Rows.Count == 0)
            {
                MessageBox.Show("The username or password are invalid.");
                loginPassBox.Text = " ";
            }

            else //User is authenticated
            {
                DataRow memberInfo = memberData.Rows[0];
                userProfile.PopulateProfile(memberData.Rows[0]);
                string MemberIDString = Convert.ToString(memberInfo["MemberID"]);
                string LoginIDString = Convert.ToString(memberInfo["MemID"]);
                string isAdminString = Convert.ToString(memberInfo["IsAdmin"]);
                //Checks if user is Member or Admin and opens appropriate Home Page
                if (LoginIDString == MemberIDString & isAdminString != "True")
                {
                    this.Hide();
                    new MemberHome(userProfile);
                }
                else if (LoginIDString == MemberIDString & isAdminString == "True")
                {
                    this.Hide();
                    new AdminHome().Show();
                }
            }
        }
 public WishList(AggActiveAccount prof)
 {
     InitializeComponent();
     this.Show();
     profile = prof;
     //MovieList mList = new MovieList(prof);
     //mList.Hide();
 }
 //Constructor
 public Checkout(AggActiveAccount prof, string movieSelect, double moviePrice, int daysForRent)
 {
     InitializeComponent();
     profile = prof;
     movie = movieSelect;
     price = moviePrice;
     rentLength = daysForRent;
     CopyObject2Form(movieSelect, profile, moviePrice, rentLength);
 }
 public void CopyObject2Form(AggActiveAccount prof)
 {
     firstName_TXT.Text = prof.FName;
     lastName_TXT.Text = prof.LName;
     address1_TXT.Text = prof.Address1;
     address2_TXT.Text = prof.Address2;
     city_TXT.Text = prof.City;
     state_TXT.Text = prof.State;
     zip_TXT.Text = prof.Zip.ToString();
     phone_TXT.Text = prof.Phone;
     cardNum_TXT.Text = prof.CardNum.ToString();
     memStatus_TXT.Text = prof.MemStatus;
     paymentType_TXT.Text = prof.PaymentType.ToString();
     //Date joined..?
     birthDate_TXT.Text = prof.DateOfBirth.ToString();
 }
 public void CopyObject2Form(AggActiveAccount profile)
 {
     MemID_TXT.Text = profile.MemId.ToString();
     firstName_TXT.Text = profile.FName;
     lastName_TXT.Text = profile.LName;
     address1_TXT.Text = profile.Address1;
     address2_TXT.Text = profile.Address2;
     city_TXT.Text = profile.City;
     state_TXT.Text = profile.State;
     zip_TXT.Text = profile.Zip.ToString();
     phone_TXT.Text = profile.Phone.ToString();
     accountID_TXT.Text = profile.AccId.ToString();
     memStatus_TXT.Text = profile.MemStatus;
     balance_TXT.Text = profile.Balance.ToString();
     cardNum_TXT.Text = profile.CardNum.ToString();
     paymentType_TXT.Text = profile.PaymentType.ToString();
 }
        private void RunConfirmOrderSqlStatement(AggActiveAccount prof, string movieSelect, double moviePrice)
        {
            prof.Balance = Convert.ToDouble(afterBal_TXT.Text);
            //SQL Statement for processing movie order
            string sqlProfileCreate =
                //updating active user account balance by subtracting the movie price (math is already done in copyObjectToForm method)
                "update Account " +
                "set Balance = '" + Convert.ToDouble(afterBal_TXT.Text) + "' " +
                "where AccountID = '" + prof.AccId + "' " +
                //creating a new transaction
                "declare @movieID int " +
                "set  @movieID = (select movieID from Movie where Title = '" + movieSelect + "') " +
                "insert into Transactions(AccountID, MovieID, RewardID, RentDate, DueDate, Total) " +
                "values('"+ prof.AccId + "', @movieID, null, GETDATE(), '"+dueDateBox.Text+"', '"+moviePrice+"')";

            //Establishes connection with SQL DB
            string dbStr = "Data Source = mis220.eil-server.cba.ua.edu; Initial Catalog = MovieRental; user id = uamis; password=RollTide";
            SqlConnection dbCon = new SqlConnection(dbStr);

            try
            {
                //non-query
                SqlCommand cmdIns = new SqlCommand(sqlProfileCreate, dbCon);

                dbCon.Open();
                cmdIns.ExecuteNonQuery();

                cmdIns.Parameters.Clear();
                cmdIns.Dispose();
                cmdIns = null;

            }

            //catch(Exception ex)//need to write exceptions
            finally
            {
                dbCon.Close();
                MessageBox.Show("Your order has been confirmed! Thank you for your business!");
                this.Hide();
                MovieList movieListForm = new MovieList(profile);
                movieListForm.Show();
            }
        }
 public AggActiveAccount CopyForm2Object()
 {
     AggActiveAccount profile = new AggActiveAccount();
     profile.MemId = Convert.ToInt32(MemID_TXT.Text);
     profile.FName = firstName_TXT.Text;
     profile.LName = lastName_TXT.Text;
     profile.Address1 = address1_TXT.Text;
     profile.Address2 = address2_TXT.Text;
     profile.City = city_TXT.Text;
     profile.State = state_TXT.Text;
     profile.Zip = Convert.ToInt32(zip_TXT.Text);
     profile.Phone = phone_TXT.Text;
     profile.AccId = Convert.ToInt32(accountID_TXT.Text);
     profile.MemStatus = memStatus_TXT.Text;
     profile.Balance = Convert.ToDouble(balance_TXT.Text);
     profile.CardNum = Convert.ToInt64(cardNum_TXT);
     profile.PaymentType = Convert.ToInt32(paymentType_TXT);
     return profile;
 }
 public void CopyObject2Form(AggActiveAccount profile)
 {
     accBalBox2.Text = profile.Balance.ToString();
     cardNumberBox.Text = profile.CardNum.ToString();
 }
 //Constructor
 public MovieList(AggActiveAccount prof)
 {
     InitializeComponent();
     this.Show();
     profile = prof;
 }
 public MemberBackgroundForm(AggActiveAccount prof)
 {
     InitializeComponent();
     CopyObject2Form(prof);
 }
 //-------Constructors------------
 public NewMemForm()
 {
     thisAGG = new AggActiveAccount();
     InitializeComponent();
 }