예제 #1
0
        private void btnEditUsers_Click(object sender, EventArgs e)
        {
            FormAddUser addUser = new FormAddUser();

            addUser.Owner = this;
            foreach (Rewards r in Program.rewardsBL.GetList().ToList())
            {
                addUser.rewards.Items.Add(r.Title);
            }
            Program.usersBL.indexOfUser = 0;
            addUser.tbFirstName.Text    = Program.usersBL.GetList().ToList()[Program.usersBL.indexOfUser].FirstName;
            addUser.tbLastName.Text     = Program.usersBL.GetList().ToList()[Program.usersBL.indexOfUser].LastName;
            addUser.tbBerthdate.Text    = Convert.ToString(Program.usersBL.GetList().ToList()[Program.usersBL.indexOfUser].Birthdate);
            for (int i = 0; i < Program.rewardsBL.GetList().Count(); i++)
            {
                addUser.rewards.Items[i] = Program.rewardsBL.GetList().ToList()[i].Title;
                if (Program.usersBL.GetList().ToList()[Program.usersBL.indexOfUser].Rewards != null)
                {
                    if (Program.usersBL.GetList().ToList()[Program.usersBL.indexOfUser].Rewards.Contains(Program.rewardsBL.GetList().ToList()[i].Title))
                    {
                        addUser.rewards.SetItemChecked(i, true);
                    }
                }
            }
            addUser.btnSaveAdd.Visible  = false;
            addUser.btnExit.Visible     = false;
            addUser.btnAhead.Visible    = true;
            addUser.btnBack.Visible     = true;
            addUser.btnSaveEdit.Visible = true;
            addUser.btnDelete.Visible   = true;
            addUser.Show();
        }
예제 #2
0
        private void btnAddUsers_Click(object sender, EventArgs e)
        {
            FormAddUser addUser = new FormAddUser();

            addUser.Owner = this;
            foreach (Rewards r in Program.rewardsBL.GetList().ToList())
            {
                addUser.rewards.Items.Add(r.Title);
            }
            addUser.btnSaveAdd.Visible  = true;
            addUser.btnExit.Visible     = true;
            addUser.btnAhead.Visible    = false;
            addUser.btnBack.Visible     = false;
            addUser.btnSaveEdit.Visible = false;
            addUser.btnDelete.Visible   = false;
            addUser.Show();
        }