Example #1
0
 void editUser()
 {
     if (mode != UserAdminMode.Edit_user)
     {
         mode = UserAdminMode.Edit_user;
         showUserPane();
     }
 }
Example #2
0
 void addUser()
 {
     if (mode != UserAdminMode.Add_user)
     {
         mode = UserAdminMode.Add_user;
         showUserPane();
     }
 }
Example #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;
                }
            }
        }
Example #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.. ");
                }
            }
        }
        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.. ");
                }
        }
 void editUser()
 {
     if (mode != UserAdminMode.Edit_user){
         mode = UserAdminMode.Edit_user;
         showUserPane();
     }
 }
 void addUser()
 {
     if (mode != UserAdminMode.Add_user)
     {
         mode = UserAdminMode.Add_user;
         showUserPane();
     }
 }
Example #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;
            }
        }