Exemplo n.º 1
0
        private void DisplayUserInfo()
        {
            userToEdit = uc.GetUser(currentID);
            if (userToEdit != null)
            {
                tbAddFirstName.Text = userToEdit.FirstName;
                tbAddLastName.Text  = userToEdit.LastName;
                tbAddUsername.Text  = userToEdit.Username;
                tbAddPassword.Text  = userToEdit.Password;
                tbAddEmail.Text     = userToEdit.Email;
                tbAddAddress.Text   = userToEdit.Address;
                tbAddPhone.Text     = userToEdit.Phone;
                tbAddSalary.Text    = userToEdit.Salary.ToString();

                dropdownAddGender.selectedIndex     = Convert.ToInt32(userToEdit.Gender);
                dropdownAddRole.selectedIndex       = Convert.ToInt32(userToEdit.Role);
                dropdownAddDepartment.selectedIndex = stController.GetAllDepartments().IndexOf(userToEdit.Dep.DptName);

                dropdownAddBirthDay.selectedIndex   = userToEdit.DateOfBirth.Day - 1;
                dropdownAddBirthMonth.selectedIndex = userToEdit.DateOfBirth.Month - 1;
                dropdownAddBirthYear.selectedIndex  = dropdownAddBirthYear.Items.ToList().IndexOf(userToEdit.DateOfBirth.Year.ToString());

                dropdownAddStartDay.selectedIndex   = userToEdit.DateOfStart.Day - 1;
                dropdownAddStartMonth.selectedIndex = userToEdit.DateOfStart.Month - 1;
                dropdownAddStartYear.selectedIndex  = dropdownAddStartYear.Items.ToList().IndexOf(userToEdit.DateOfStart.Year.ToString());
            }
        }
        private void FormManager_Load(object sender, EventArgs e)
        {
            scController.CheckForUpdateSchedule();
            uc.ExtractAllUsers();
            loggedInUser     = uc.GetUser(loggedUserId);
            currentID        = 0;
            stockID          = 0;
            lblUserName.Text = loggedInUser.Username;

            foreach (var item in stController.GetAllDepartments())
            {
                cmxCategoryStock.AddItem(item);
            }
            UpdateListView();
        }