Beispiel #1
0
        private void accountDataGirdView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (accountDataGirdView.Columns[e.ColumnIndex].Name == "Proceed")
            {
                if (accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value == null)
                {
                    MessageBox.Show("You haven't selected any task.");
                    return;
                }
                //MessageBox.Show(accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString() +" : "+ accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value.ToString());
                if (accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value.ToString() == "View Account")
                {
                    accountServiceClient = new AccountService.AccountServiceClient();
                    AccountService.UserAccountData userAccountData = new AccountService.UserAccountData();
                    userAccountData = accountServiceClient.requestDecryption(UserConfiguration.strUserEmail, accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString());
                    MessageBox.Show("Account Name : " + accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString() + "\nUsername : "******"\nPassword : "******"Task"].Value.ToString() == "Update Account")
                {
                    //MessageBox.Show(accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString() + " : " + accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value.ToString());
                    updateAccountPanel.Visible           = true;
                    updatePasswordGeneratorPanel.Visible = false;

                    updateAccUserNameTextBox.Text = "";
                    updateAccPasswordTextBox.Text = "";

                    updateAccountName   = accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString();
                    updateAccLabel.Text = "Update Your " + updateAccountName + " Account ";
                }
                if (accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value.ToString() == "Delete Account")
                {
                    //MessageBox.Show(accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString() + " : " + accountDataGirdView.Rows[e.RowIndex].Cells["Task"].Value.ToString());
                    accountServiceClient = new AccountService.AccountServiceClient();
                    AccountService.UserAccountData userAccountData1 = new AccountService.UserAccountData();
                    userAccountData1.userEmail       = UserConfiguration.strUserEmail;
                    userAccountData1.UserAccountName = accountDataGirdView.Rows[e.RowIndex].Cells["userAccountNameDataGridViewTextBoxColumn"].Value.ToString();
                    accountServiceClient.deleteAccount(userAccountData1);
                    MessageBox.Show("Account deleted");

                    accountServiceClient = new AccountService.AccountServiceClient();
                    userAccountData      = accountServiceClient.getAllAccounts(UserConfiguration.strUserEmail);

                    accountDataGirdView.Rows.Clear();


                    for (int i = 0; i < userAccountData.Length; i++)
                    {
                        userAccountDataBindingSource.Add(new AccountService.UserAccountData()
                        {
                            UserAccountName = userAccountData[i].UserAccountName
                        });
                    }
                }
            }
        }
Beispiel #2
0
        private void updateAccAddBtn_Click(object sender, EventArgs e)
        {
            string userAccountname     = updateAccountName;
            string userAccountUserName = updateAccUserNameTextBox.Text;
            string userAccountPassowrd = updateAccPasswordTextBox.Text;

            if (string.IsNullOrEmpty(userAccountname) || string.IsNullOrEmpty(userAccountUserName) || string.IsNullOrEmpty(userAccountPassowrd))
            {
                MessageBox.Show("All Fields are Required");
            }
            else
            {
                AccountService.UserAccountData userAccountData = new AccountService.UserAccountData();
                userAccountData.UserAccountName = userAccountname;
                userAccountData.UserName        = userAccountUserName;
                userAccountData.Password        = userAccountPassowrd;
                userAccountData.userEmail       = UserConfiguration.strUserEmail;
                accountServiceClient            = new AccountService.AccountServiceClient();
                accountServiceClient.updateAccount(userAccountData);
                MessageBox.Show("Account updated.");
                updateAccountPanel.Visible = false;
            }
        }