Пример #1
0
        private void guna2Button2_Click(object sender, EventArgs e)
        {
            //documentPanel.Show();
            documentPanel.Visible = true;
            //diaryPanel.Show();
            diaryPanel.Visible = true;
            //sharedPanel.Show();
            sharedPanel.Visible = true;

            accountPanel.Visible = true;

            addAccountPanel.Visible = false;

            updateAccountPanel.Visible = false;

            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
                });
            }
        }
Пример #2
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
                        });
                    }
                }
            }
        }
Пример #3
0
        private void accountRefreshBtn_Click(object sender, EventArgs e)
        {
            addAccountPanel.Visible = false;

            updateAccountPanel.Visible = false;

            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
                });
            }
        }
Пример #4
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;
            }
        }
Пример #5
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(searchTextBox.Text))
            {
                MessageBox.Show("Enter search text.");
                return;
            }
            if (searchComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Please select type for search text");
                return;
            }
            if (searchComboBox.Items[searchComboBox.SelectedIndex].ToString() == "Diaries")
            {
                //MessageBox.Show("Search type : "+ searchComboBox.Items[searchComboBox.SelectedIndex].ToString()+"\nSearch text : "+ searchTextBox.Text);
                guna2Button4.PerformClick();

                diaryDataGridView.Visible = true;
                personalDiaryClient       = new DiaryService.PersonalDiaryClient();
                diaries = personalDiaryClient.getAllDiaryData(UserConfiguration.strUserEmail);
                bool[] isMatched = new bool[diaries.Length];

                diaryDataGridView.Rows.Clear();
                for (int i = 0; i < diaries.Length; i++)
                {
                    if (diaries[i].title.ToLower().Contains(searchTextBox.Text.ToLower()))
                    {
                        isMatched[i] = true;
                    }
                    else
                    {
                        isMatched[i] = false;
                    }
                }
                for (int i = 0; i < diaries.Length; i++)
                {
                    if (isMatched[i])
                    {
                        diaryDataBindingSource.Add(new DiaryData()
                        {
                            date = diaries[i].date, title = diaries[i].title
                        });
                    }
                }
            }
            if (searchComboBox.Items[searchComboBox.SelectedIndex].ToString() == "Documents")
            {
                //MessageBox.Show("Search type : " + searchComboBox.Items[searchComboBox.SelectedIndex].ToString() + "\nSearch text : " + searchTextBox.Text);
                guna2Button1.PerformClick();

                documentDataGridView.Visible = true;

                documentServiceClient = new DocumentService.DocumentServiceClient();
                documents             = documentServiceClient.getAllDocumnetData(UserConfiguration.strUserEmail);
                bool[] isMatched = new bool[documents.Length];

                documentDataGridView.Rows.Clear();
                for (int i = 0; i < documents.Length; i++)
                {
                    if (documents[i].fileName.ToLower().Contains(searchTextBox.Text.ToLower()))
                    {
                        isMatched[i] = true;
                    }
                    else
                    {
                        isMatched[i] = false;
                    }
                }
                for (int i = 0; i < documents.Length; i++)
                {
                    if (isMatched[i])
                    {
                        documentDataBindingSource.Add(new DocumentService.DocumentData()
                        {
                            fileName = documents[i].fileName
                        });
                    }
                }
            }
            if (searchComboBox.Items[searchComboBox.SelectedIndex].ToString() == "Accounts")
            {
                //MessageBox.Show("Search type : " + searchComboBox.Items[searchComboBox.SelectedIndex].ToString() + "\nSearch text : " + searchTextBox.Text);

                AccountsBtn.PerformClick();
                accountServiceClient = new AccountService.AccountServiceClient();
                userAccountData      = accountServiceClient.getAllAccounts(UserConfiguration.strUserEmail);
                bool[] isMatched = new bool[userAccountData.Length];


                accountDataGirdView.Rows.Clear();


                for (int i = 0; i < userAccountData.Length; i++)
                {
                    if (userAccountData[i].UserAccountName.ToLower().Contains(searchTextBox.Text.ToLower()))
                    {
                        isMatched[i] = true;
                    }
                    else
                    {
                        isMatched[i] = false;
                    }
                }
                for (int i = 0; i < userAccountData.Length; i++)
                {
                    if (isMatched[i])
                    {
                        userAccountDataBindingSource.Add(new AccountService.UserAccountData()
                        {
                            UserAccountName = userAccountData[i].UserAccountName
                        });
                    }
                }
            }
            if (searchComboBox.Items[searchComboBox.SelectedIndex].ToString() == "Shared Documents")
            {
                //MessageBox.Show("Search type : " + searchComboBox.Items[searchComboBox.SelectedIndex].ToString() + "\nSearch text : " + searchTextBox.Text);
                guna2Button5.PerformClick();


                sharingServiceClient = new SharingService.SharingServiceClient();
                sharedDocments       = sharingServiceClient.getSharedDocument(UserConfiguration.strUserEmail);
                bool[] isMatched = new bool[sharedDocments.Length];

                sharedDocumentDataGridView.Rows.Clear();
                for (int i = 0; i < sharedDocments.Length; i++)
                {
                    if (sharedDocments[i].fileName.ToLower().Contains(searchTextBox.Text.ToLower()))
                    {
                        isMatched[i] = true;
                    }
                    else
                    {
                        isMatched[i] = false;
                    }
                }
                for (int i = 0; i < sharedDocments.Length; i++)
                {
                    if (isMatched[i])
                    {
                        sharedDocumentDataBindingSource.Add(new SharedDocumentData()
                        {
                            fileName = sharedDocments[i].fileName, sharedBy = sharedDocments[i].sharedBy
                        });
                    }
                }
            }
        }