예제 #1
0
 void editUser()
 {
     if (mode != UserAdminMode.Edit_user)
     {
         mode = UserAdminMode.Edit_user;
         showUserPane();
     }
 }
예제 #2
0
 void addUser()
 {
     if (mode != UserAdminMode.Add_user)
     {
         mode = UserAdminMode.Add_user;
         showUserPane();
     }
 }
예제 #3
0
        public void init(UserAdminMode mode)
        {
            txtFirstname.Focus();
            masterController.setFormReturnkey = btnSave;
            this.mode         = mode;
            hasPictureChanged = false;

            if (mode == UserAdminMode.Add_user)
            {
                clearTextboxes();
                loadSqueryList();
                togglePasswordInputs(true);
                updateStatus("You are creating a New User", SystemColors.menuLightBlue);
            }
            else if (mode == UserAdminMode.Edit_user)
            {
                loadSqueryList();
                togglePasswordInputs(false);
                updateStatus("You are updating an Existing User", SystemColors.menuBarBlue);
                currentEmployee         = userAdministration.selectedEmployee;
                cmbSquery.SelectedIndex = dbController.getSqueryFromID(currentEmployee.User_id) - 1;

                txtLastname.Text   = currentEmployee.Lastname;
                txtFirstname.Text  = currentEmployee.Firstname;
                txtMiddlename.Text = currentEmployee.MiddleName;
                txtMobno.Text      = currentEmployee.MobileNo;

                txtUsername.Text    = currentEmployee.User_id;
                txtImagepath.Text   = currentEmployee.ImagePath;
                txtAddress.Text     = currentEmployee.Address;
                domainPosition.Text = currentEmployee.Position.ToString();

                if (File.Exists(currentEmployee.ImagePath))
                {
                    imageUser.Image = Renderer.resizeImage(Image.FromFile(currentEmployee.ImagePath) as Bitmap, imageUser.Width, imageUser.Height) as Image;
                }
                else
                {
                    imageUser.Image = null;
                }
            }
        }
예제 #4
0
        void viewUser()
        {
            try
            {
                if (addUserPane != null && addUserPane.IsDirty)
                {
                    DialogResult result = MessageBox.Show("There are seems unsaved work.. Are you sure you want to continue?",
                                                          "You are going to leave unsave work", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (result == DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        addUserPane.clearTextboxes();
                    }
                }

                if (mode != UserAdminMode.View_user)
                {
                    userView = new UserView(userPanel, masterController);
                    mode     = UserAdminMode.View_user;
                    flipColors();
                }

                lbUsers.Focus();
                selectedEmployee = userEmployeeMap[lbUsers.SelectedItem.ToString()];
                userView.showUser(selectedEmployee);
            }
            catch (NullReferenceException)
            {
                if (lbUsers.SelectedItem == null)
                {
                    MessageBox.Show("No selected user.. ");
                }
            }
        }
예제 #5
0
        void viewUser()
        {
            try
                {
                    if (addUserPane != null && addUserPane.IsDirty)
                    {
                        DialogResult result = MessageBox.Show("There are seems unsaved work.. Are you sure you want to continue?",
                                                                "You are going to leave unsave work", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                        if (result == DialogResult.No)
                            return;
                        else
                            addUserPane.clearTextboxes();
                    }

                    if (mode != UserAdminMode.View_user)
                    {
                        userView = new UserView(userPanel, masterController);
                        mode = UserAdminMode.View_user;
                        flipColors();
                    }

                    lbUsers.Focus();
                    selectedEmployee = userEmployeeMap[lbUsers.SelectedItem.ToString()];
                    userView.showUser(selectedEmployee);
                }
                catch (NullReferenceException)
                {
                    if (lbUsers.SelectedItem == null)
                        MessageBox.Show("No selected user.. ");
                }
        }
예제 #6
0
 void editUser()
 {
     if (mode != UserAdminMode.Edit_user){
         mode = UserAdminMode.Edit_user;
         showUserPane();
     }
 }
예제 #7
0
 void addUser()
 {
     if (mode != UserAdminMode.Add_user)
     {
         mode = UserAdminMode.Add_user;
         showUserPane();
     }
 }
예제 #8
0
        public void init(UserAdminMode mode)
        {
            txtFirstname.Focus();
            masterController.setFormReturnkey = btnSave;
            this.mode = mode;
            hasPictureChanged = false;

            if (mode == UserAdminMode.Add_user)
            {
                clearTextboxes();
                togglePasswordInputs(true);
                updateStatus("You are creating a New User", SystemColors.menuLightBlue);
            }
            else if (mode == UserAdminMode.Edit_user)
            {
                togglePasswordInputs(false);
                updateStatus("You are updating an Existing User", SystemColors.menuBarBlue);
                currentEmployee = userAdministration.selectedEmployee;

                txtLastname.Text = currentEmployee.Lastname;
                txtFirstname.Text = currentEmployee.Firstname;
                txtMiddlename.Text = currentEmployee.MiddleName;
                txtMobno.Text = currentEmployee.MobileNo;

                txtUsername.Text = currentEmployee.User_id;
                txtImagepath.Text = currentEmployee.ImagePath;
                txtAddress.Text = currentEmployee.Address;
                domainPosition.Text = currentEmployee.Position.ToString();

                if (File.Exists(currentEmployee.ImagePath))
                    imageUser.Image = Renderer.resizeImage(Image.FromFile(currentEmployee.ImagePath) as Bitmap, imageUser.Width, imageUser.Height) as Image;
                else
                    imageUser.Image = null;
            }
        }