Esempio n. 1
0
 private void updateUsersToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if ((updateUserForm == null) || (updateUserForm.IsDisposed))
     {
         updateUserForm = new Admin.UpdateUserForm
         {
             MdiParent = this
         };
     }
     updateUserForm.Show();
 }
        private void usersListBox_DoubleClick(object sender, System.EventArgs e)
        {
            Models.User oSelectedUser =
                usersListBox.SelectedItem as Models.User;

            if (oSelectedUser != null)
            {
                UpdateUserForm updateUserForm = new UpdateUserForm();

                updateUserForm.User = oSelectedUser;
                //updateUserForm.UserId = oSelectedUser.Id;

                updateUserForm.ShowDialog();
            }
        }
Esempio n. 3
0
        private void UsersListBox_DoubleClick(object sender, System.EventArgs e)
        {
            Models.User selectedUser = usersListBox.SelectedItem as Models.User;

            if (selectedUser != null)
            {
                UpdateUserForm updateUserForm = new UpdateUserForm
                {
                    SelectedUser = selectedUser
                };

                updateUserForm.ShowDialog();

                Search();
            }
        }
Esempio n. 4
0
        private void UsersListBox_DoubleClick(object sender, System.EventArgs e)
        {
            // **************************************************
            // روش احمقانه
            // **************************************************
            //Models.User selectedUser =
            //	(Models.User)usersListBox.SelectedItem;
            // **************************************************

            // **************************************************
            // روش هوشمندانه
            // **************************************************
            //Models.User selectedUser =
            //	usersListBox.SelectedItem as Models.User;

            //if (selectedUser != null)
            //{
            //}
            // **************************************************

            // **************************************************
            // روش مدرن
            // **************************************************
            if (usersListBox.SelectedItem is Models.User selectedUser)
            {
                // **************************************************
                //UpdateUserForm updateUserForm = new UpdateUserForm
                //{
                //	SelectedUserId = selectedUser.Id,
                //};
                // **************************************************

                // **************************************************
                UpdateUserForm updateUserForm = new UpdateUserForm
                {
                    SelectedUser = selectedUser,
                };
                // **************************************************

                updateUserForm.ShowDialog();

                Search();
            }
            // **************************************************
        }
Esempio n. 5
0
        private void usersListBox_DoubleClick(object sender, System.EventArgs e)
        {
            // روش احمقانه
            //Models.User selectedUser =
            //	(Models.User)usersListBox.SelectedItem;

            Models.User selectedUser =
                usersListBox.SelectedItem as Models.User;

            if (selectedUser != null)
            {
                UpdateUserForm updateUserForm = new UpdateUserForm();

                updateUserForm.SelectedUser = selectedUser;
                //updateUserForm.SelectedUserId = selectedUser.Id;

                updateUserForm.ShowDialog();

                Search();
            }
        }
Esempio n. 6
0
        private void usersListbox_DoubleClick(object sender, EventArgs e)
        {
            Models.User selectedUser = usersListbox.SelectedItem as Models.User;
            if (selectedUser != null)
            {
                UpdateUserForm updateUserForm = new UpdateUserForm
                {
                    SelectedUser = selectedUser
                };

                updateUserForm.ShowDialog();
                Search();
            }

            //if ((updateUserForm == null) || (updateUserForm.IsDisposed))
            //{
            //    updateUserForm = new Admin.UpdateUserForm
            //    {
            //        MdiParent = this
            //    };
            //}
            //updateUserForm.Show();
        }
Esempio n. 7
0
        private void UsersListBox_DoubleClick(object sender, System.EventArgs e)
        {
            if (usersListBox.SelectedItem == null)
            {
                System.Windows.Forms.MessageBox
                .Show("You did not specify any user for editing!");

                return;
            }

            // **************************************************
            // روش احمقانه
            // **************************************************
            //var selectedUser =
            //	(Models.User)usersListBox.SelectedItem;
            // **************************************************

            // **************************************************
            // روش یه کم منطقی
            // **************************************************
            //Models.User selectedUser = null;

            //if (usersListBox.SelectedItem is Models.User)
            //{
            //	selectedUser =
            //		(Models.User)usersListBox.SelectedItem;
            //}
            // **************************************************

            // **************************************************
            // روش هوشمندانه
            // **************************************************
            //var selectedUser =
            //	usersListBox.SelectedItem as Models.User;

            //if (selectedUser != null)
            //{
            //}
            // **************************************************

            // **************************************************
            // روش مدرن
            // **************************************************
            if (usersListBox.SelectedItem is Models.User selectedUser)
            {
                // **************************************************
                //var updateUserForm =
                //	new UpdateUserForm
                //	{
                //		SelectedUserId = selectedUser.Id,
                //	};
                // **************************************************

                // **************************************************
                var updateUserForm =
                    new UpdateUserForm
                {
                    SelectedUser = selectedUser,
                };
                // **************************************************

                updateUserForm.ShowDialog();

                Search();
            }
            // **************************************************
        }