コード例 #1
0
        private void addUser(TicketMastersEntities context)
        {
            AddUserWindow p = new AddUserWindow();
            if (p.ShowDialog().Value)
            {
                User addNewUser = new User
                {

                    FirstName = p.firstNameTxt.Text,
                    LastName = p.lastNameTxt.Text,
                    StreetAddress = p.streetAddressTxt.Text,
                    City = p.cityTxt.Text,
                    State = p.stateTxt.Text,
                    ZipCode = p.zipCodeTxt.Text,
                    PhoneNumber = p.phoneNumTxt.Text

                };
                context.Users.AddObject(addNewUser);
                saveUser();

                //fix still shows when data not saving

                useridLbl.Text = addNewUser.UserID.ToString();
                firstLbl.Text = addNewUser.FirstName;
                lastLbl.Text = addNewUser.LastName;
                streetLbl.Text = addNewUser.StreetAddress;
                cityLbl.Text = addNewUser.City;
                stateLbl.Text = addNewUser.State;
                zipLbl.Text = addNewUser.ZipCode;
                phoneLbl.Text = addNewUser.PhoneNumber;

            }
        }
コード例 #2
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 public static User CreateUser(global::System.Int32 userID, global::System.String firstName, global::System.String lastName)
 {
     User user = new User();
     user.UserID = userID;
     user.FirstName = firstName;
     user.LastName = lastName;
     return user;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
コード例 #4
0
        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // in order to pass data, it must be all data coming from a iqueryable<object/parameter>. if i just do it from a var ... = query, it wont work since that is
            // considered as read only. once it gets it/displays it, it dumps it from memory
            objecttoshow = listBox1.SelectedItem as User;

            viewUserDetailbtn.IsEnabled = true;

            displayData(objecttoshow);
        }
コード例 #5
0
        private void displayData(User objecttoshow)
        {
            try
            {

                useridLbl.Text = objecttoshow.UserID.ToString();
                firstLbl.Text = objecttoshow.FirstName;
                lastLbl.Text = objecttoshow.LastName;
                streetLbl.Text = objecttoshow.StreetAddress;
                phoneLbl.Text = objecttoshow.PhoneNumber;
                cityLbl.Text = objecttoshow.City;
                zipLbl.Text = objecttoshow.ZipCode;
                stateLbl.Text = objecttoshow.State;
            }
            catch (NullReferenceException)
            {
                // switch this to
                MessageBox.Show("no such user exists/n Search by first name only");
            }
        }