private void DeleteSingleAccount() { try { int i = grvAccounts_AccountCreator_AccountDetails.SelectedIndex; if (i < 0) { GlobusLogHelper.log.Info("Please select account for deletion"); return; } QueryManager qm = new QueryManager(); MessageBoxButton btn = MessageBoxButton.OK; MessageBoxButton btnC = MessageBoxButton.YesNoCancel; var result = ModernDialog.ShowMessage("Are you want to delete this Accounts permanently?", " Delete Account ", btnC); if (result == MessageBoxResult.Yes) { foreach (var selection in grvAccounts_AccountCreator_AccountDetails.SelectedItems) { try { DataRowView row = (DataRowView)selection; string Username = row[0].ToString(); string Password = row[1].ToString(); qm.DeleteAccounts(Username); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } } LoadAccountsFromDataBase(); } try { DataSet ds = new DataSet(); ds = Qm.SelectAccounts(); DataTable dt = new DataTable(); dt = ds.Tables["tb_LinkedInAccount"]; Application.Current.Dispatcher.Invoke(new Action(() => { lblaccounts_ManageAccounts_LoadsAccountsCount.Content = dt.Rows.Count.ToString(); })); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } }
protected void OnBtnClearAccountsAccountManagerClicked (object sender, EventArgs e) { try { MessageDialog md = new MessageDialog (this, DialogFlags.Modal, MessageType.Info, ButtonsType.OkCancel, "Are you sure to clear all accounts from database?"); ResponseType response = (ResponseType)md.Run (); //string module = string.Empty; if (response == ResponseType.Ok) { QueryManager objclsPDAccount = new QueryManager(); DataTable dt = objclsPDAccount.SelectAccoutsForGridView(); if (dt.Rows.Count > 0) { try { QueryManager.deleteQuery (); } catch{} Gtk.Application.Invoke (delegate { accountData.Clear (); PDGlobals.loadedAccountsDictionary.Clear (); PDGlobals.listAccounts.Clear (); }); Addtologger ("Account Deleted Successfully"); } else { Addtologger ("There is no Account Present in Database."); } } md.Destroy (); } catch { }; }
public string CreateBoard_new(string BoardName, string Category, ref PinInterestUser objPinUser) { try { string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/")); string ScreenName = objPinUser.ScreenName; //ObjAccountManager.Getscreen_NameRepin(ref objPinUser); if (Checking.Contains("profileName")) { } else { ObjAccountManager.LoginPinterestAccount(ref objPinUser); } string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; if (!string.IsNullOrEmpty(Checking)) { ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr(); //string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EUserProfilePage(resource%3DUserResource(username%3D" + ScreenName + "%2C+invite_code%3Dnull))%3EUserProfileContent(resource%3DUserResource(username%3D" + objPinUser.ScreenName + "%2C+invite_code%3Dnull))%3EUserBoards()%3EGrid(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EGridItems(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23Modal(module%3DBoardCreate())"; string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EUserProfilePage%3EUserProfileContent%3EUserBoards%3EGrid%3EGridItems%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23App%3EModalManager%3EModal(showCloseModal%3Dtrue%2C+mouseDownInModal%3Dfalse)"; string PostUrlBoard = redirectDomain + ".pinterest.com/resource/BoardResource/create/"; try { CreatedBoardPageSource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrlBoard), newpostdata, newHomePageUrl); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } if (CreatedBoardPageSource.Contains("error\": null")) { if (newpostdata.Contains("You already have a board with that name.")) { GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]"); return null; } try { string ModuleName = "AddBoardName"; string Status = "Board_Created"; QueryManager qm = new QueryManager(); qm.insertAccRePort(objPinUser.Username, ModuleName, "", BoardName, "", "", "", "", Status, "", "", DateTime.Now); //qm.insertBoard_AddBoardName(objPinUser.Username, ModuleName, BoardName, Status); objDelegateAccountReport(); } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Board Created " + BoardName + " ]"); return null; } GlobusLogHelper.log.Info(" => [ Successfully Created Board " + BoardName + " For " + objPinUser.Username + " ]"); string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);//GetBoardId(BoardName, ref pinterestAccountManager); return BoardId; } else if (CreatedBoardPageSource.Contains("You have a board with this name.")) { GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]"); string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser); return BoardId; } else { GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]"); return CreatedBoardPageSource; } } else { GlobusLogHelper.log.Info(" => [ Login Issue " + " For " + objPinUser.Username + " ]"); } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]"); return null; } return null; }
private void btnSave_AddSingleAcc_Click(object sender, RoutedEventArgs e) { try { QueryManager QM = new QueryManager(); string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; if (string.IsNullOrEmpty(txtEmail_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountUser = (txtEmail_AddSingleAcc.Text).ToString(); } if (string.IsNullOrEmpty(txtPassword_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountPass = (txtPassword_AddSingleAcc.Text).ToString(); } try { niches = (txtNiche_AddSinleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyAddress = (txtProxyAddress_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPort = (txtProxyPort_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyUserName = (txtProxyUsername_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPassword = (txtProxyPassword_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } LoginStatus = "NotChecked"; QM.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName,LoginStatus); UploadAccount objUploadAccount = new UploadAccount(); objUploadAccount.AccounLoad(); Window parentWindow = (Window)this.Parent; parentWindow.Close(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
private void Grid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) { try { DataGrid grid = (DataGrid)sender; if (e.Command == DataGrid.DeleteCommand) { try { int i = dgvAccounts.SelectedIndex; if (i < 0) { GlobusLogHelper.log.Info("Please select account for deletion"); return; } QueryManager qm = new QueryManager(); MessageBoxButton btn = MessageBoxButton.OK; MessageBoxButton btnC = MessageBoxButton.YesNo; var result = ModernDialog.ShowMessage("Are you want to delete this Accounts permanently?", " Delete Account ", btnC); if (result == MessageBoxResult.Yes) { foreach (AccountNotifyPropertyChanged objAccountNotifyPropertyChanged in dgvAccounts.SelectedItems) { try { string Username = objAccountNotifyPropertyChanged.Username.ToString(); string Password = objAccountNotifyPropertyChanged.Password.ToString(); QueryManager.DeleteAccounts(Username); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } } PDGlobals.loadedAccountsDictionary.Clear(); AccounLoad(); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } e.Handled = true; } } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.StackTrace); } }
public void AddSingleAccountUploadAcc() { try { QueryManager QM = new QueryManager(); string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; if (string.IsNullOrEmpty(obj_AddSingleAccount_UploadAccount.txtEmail_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountUser = (obj_AddSingleAccount_UploadAccount.txtEmail_AddSingleAcc.Text).ToString(); } if (string.IsNullOrEmpty(obj_AddSingleAccount_UploadAccount.txtPassword_AddSingleAcc.Text)) { try { GlobusLogHelper.log.Info("Please Enter Account"); ModernDialog.ShowMessage("Please Enter Account", "Enter Account", MessageBoxButton.OK); return; } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } } else { accountPass = (obj_AddSingleAccount_UploadAccount.txtPassword_AddSingleAcc.Text).ToString(); } try { niches = (obj_AddSingleAccount_UploadAccount.txtNiche_AddSinleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyAddress = (obj_AddSingleAccount_UploadAccount.txtProxyAddress_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPort = (obj_AddSingleAccount_UploadAccount.txtProxyPort_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyUserName = (obj_AddSingleAccount_UploadAccount.txtProxyUsername_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { proxyPassword = (obj_AddSingleAccount_UploadAccount.txtProxyPassword_AddSingleAcc.Text).ToString(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } if (Globals.IsBasicVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 5) { AccounLoad(); MessageBox.Show("You Are Using PD Basic Version 5 Accounts allready loaded.."); return; } else { // int RemainingAccount = 5 - countLoadedAccounts; //templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } if (Globals.IsProVersion) { try { string selectQuery = "select count(UserName) from tb_emails"; DataSet DS = DataBaseHandler.SelectQuery(selectQuery, "tb_emails"); int countLoadedAccounts = Convert.ToInt32(DS.Tables[0].Rows[0].ItemArray[0].ToString()); if (countLoadedAccounts >= 15) { AccounLoad(); MessageBox.Show("You Are Using PD Pro Version 15 Accounts allready loaded.."); return; } else { // int RemainingAccount = 15 - countLoadedAccounts; // templist.RemoveRange(RemainingAccount, templist.Count - RemainingAccount); } } catch { } } LoginStatus = "NotChecked"; QM.AddAccountInDataBase(accountUser, accountPass, niches, proxyAddress, proxyPort, proxyUserName, proxyPassword, ScreenName, LoginStatus); UploadAccount objUploadAccount = new UploadAccount(); objUploadAccount.AccounLoad(); //Window parentWindow = (Window)this.Parent; //parentWindow.Close(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } }
public bool AddUserToBoard(string BoardName, string UserName, string Category, ref PinInterestUser pinterestAccountManager) { try { GlobusLogHelper.log.Info(" => [ Start Adding " + UserName + " to " + BoardName + " ]"); string checklogin = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com")); string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0]; string newHomePageUrl = redirectDomain + "." + "pinterest.com"; string screen_Name = pinterestAccountManager.ScreenName; //ObjAccountManager.Getscreen_Name(ref pinterestAccountManager); pinterestAccountManager.globusHttpHelper = new GlobusHttpHelper(); BoardName = BoardName.Replace(" ", "-"); string AfterInvitePageSourceData = string.Empty; string userid = string.Empty; if (BoardName.Contains("pinterest.com")) { BoardName = BoardName.Replace("https://pinterest.com/", string.Empty).Replace(pinterestAccountManager.Name, string.Empty).Trim('/'); } string BoardUrl = "https://pinterest.com/" + pinterestAccountManager.ScreenName + "/" + BoardName + "/"; string SettingsUrl = BoardUrl + "settings/"; string Collabrator = BoardUrl; string InvitePostData1 = "collaborator_name=&collaborator_username="******"-", "+"); string invited_userid = string.Empty; string invited = "https://pinterest.com/" + UserName.Replace(" ", "").Replace("%20", ""); string pagesourceinvited = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(invited)); try { invited_userid = Utils.Utils.getBetween(pagesourceinvited, "options\": {\"user_id\"", "}"); invited_userid = Utils.Utils.getBetween(invited_userid, "\"", "\""); } catch { }; string MainPageSource = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(BoardUrl), "https://pinterest.com/", string.Empty, pinterestAccountManager.UserAgent); try { int startindex = MainPageSource.IndexOf("\"user_id\":"); string start = MainPageSource.Substring(startindex).Replace("\"user_id\":", ""); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex); userid = end.Replace("\"", "").Replace("}}", string.Empty).Trim(); } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } //string screen_Name = ObjAccountManager.Getscreen_Name(ref pinterestAccountManager); string BoardId = Utils.Utils.getBetween(MainPageSource, "board\", \"id", ",").Replace("\"", "").Replace(":", "").Trim(); string InviteToBoardPostData = string.Empty; // if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager)) if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager)) { string Url = "https://www.pinterest.com/resource/BoardInviteResource/get/?source_url=%2F" + screen_Name + "%2Fhealth%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%2C%22field_set_key%22%3A%22boardEdit%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EBoardCollaboratorInviter(resource%3DBoardResource(board_id%3D" + BoardId + "))%3EBoardInviteForm()%3ESocialTypeaheadField()%3ETypeahead(bypass_maxheight%3Dtrue%2C+tags%3Dpinners_and_contacts%2C+template%3Duser_circle_avatar%2C+view_type%3DuserCircleSelect)&_=1431320928412"; string getResponce = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(Url)); if (UserName.Contains("@")) { UserName = UserName.Replace("@", "%40"); //InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal()"; InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2Fas%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EBoardCollaboratorInviter%3EBoardInviteForm%3EButton(class_name%3DinviteButton%2C+text%3DInvite%2C+color%3Ddefault%2C+state_badgeValue%3D%22%22%2C+state_accessibilityText%3D%22%22%2C+state_disabled%3Dundefined)"; try { string postInviteEmail = redirectDomain + ".pinterest.com/resource/BoardEmailInviteResource/create/"; AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postInviteEmail), InviteToBoardPostData, newHomePageUrl); } catch (Exception ex) { }; } else { InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal(state_isVisible%3Dtrue%2C+showCloseModal%3Dtrue%2C+state_mouseDownInModal%3Dtrue%2C+state_showModalMask%3Dtrue%2C+state_showContainer%3Dfalse%2C+state_showPositionElement%3Dtrue)"; try { string postUrlInviteBoard = redirectDomain + ".pinterest.com/resource/BoardInviteResource/create/"; AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postUrlInviteBoard), InviteToBoardPostData, newHomePageUrl); } catch (Exception ex) { }; } if (!string.IsNullOrEmpty(AfterInvitePageSourceData)) { string ModuleName = "AddUserToBoard"; string Status = "Invitation Sent"; QueryManager qm = new QueryManager(); //qm.insertSentInvitation_AddUserToBoard(pinterestAccountManager.Username, ModuleName, BoardName, UserName, Status); qm.insertAccRePort(pinterestAccountManager.Username, ModuleName, "", BoardName, UserName, "", "", "", Status, "", "", DateTime.Now); objAddUserToBoarddelegate(); GlobusLogHelper.log.Info(" => [ Invitation sent to " + UserName + " for Board " + BoardName + " ]"); return true; } else { GlobusLogHelper.log.Info(" => [ Not Added to Board " + BoardName + " ]"); return true; } } else { } } catch (Exception ex) { GlobusLogHelper.log.Info(" => [ " + UserName + " Not Added to Board " + BoardName + " ]"); return true; } return false; }
private void DeleteSingleAccount() { QueryManager qm = new QueryManager(); MessageBoxButton btn = MessageBoxButton.OK; MessageBoxButton btnC = MessageBoxButton.YesNoCancel; try { int i = grvAccounts_AccountCreator_AccountDetails.SelectedIndex; if (i < 0) { GlobusLogHelper.log.Info("Please Select Account For Deletion !"); var ResultMessageBox = ModernDialog.ShowMessage("Please Select Account For Deletion !", " Delete Account ", btnC); return; } var result = ModernDialog.ShowMessage("Are You Want To Delete This Accounts Permanently?", " Delete Account ", btnC); if (result == MessageBoxResult.Yes) { foreach (GramDominator.ViewModule.AccountNotifyPropertyChanged objAccountNotifyPropertyChanged in grvAccounts_AccountCreator_AccountDetails.SelectedItems) { try { // AccountViewModel._listOfAccount //DataRowView row = (DataRowView)selection; string Username = objAccountNotifyPropertyChanged.Username.ToString(); string Password = objAccountNotifyPropertyChanged.Password.ToString(); qm.DeleteAccounts(Username); } catch (Exception ex) { GlobusLogHelper.log.Error("Error :" + ex.Message); } } LoadAccountsFromDataBase(); AccounLoad(); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } }
private void Grid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) { DataGrid grid = (DataGrid)sender; if (e.Command == DataGrid.DeleteCommand) { try { int i = grvAccounts_AccountCreator_AccountDetails.SelectedIndex; if (i < 0) { GlobusLogHelper.log.Info("Please select account for deletion"); return; } QueryManager qm = new QueryManager(); MessageBoxButton btn = MessageBoxButton.OK; MessageBoxButton btnC = MessageBoxButton.YesNo; var result = ModernDialog.ShowMessage("Are you want to delete this Accounts permanently?", " Delete Account ", btnC); if (result == MessageBoxResult.Yes) { foreach (var selection in grvAccounts_AccountCreator_AccountDetails.SelectedItems) { try { DataRowView row = (DataRowView)selection; string Username = row[1].ToString(); string Password = row[2].ToString(); qm.DeleteAccounts(Username); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } } LoadAccountsFromDataBase(); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } e.Handled = true; } }
private void DeleteSingleAccount() { QueryManager qm = new QueryManager(); MessageBoxButton btn = MessageBoxButton.OK; MessageBoxButton btnC = MessageBoxButton.YesNoCancel; try { int i = grvAccounts_AccountCreator_AccountDetails.SelectedIndex; if (i < 0) { GlobusLogHelper.log.Info("Please Select Account For Deletion !"); var ResultMessageBox = ModernDialog.ShowMessage("Please Select Account For Deletion !", " Delete Account ", btnC); return; } var result = ModernDialog.ShowMessage("Are You Want To Delete This Accounts Permanently?", " Delete Account ", btnC); if (result == MessageBoxResult.Yes) { foreach (var selection in grvAccounts_AccountCreator_AccountDetails.SelectedItems) { try { DataRowView row = (DataRowView)selection; string Username = row["UserName"].ToString(); string Password = row["Password"].ToString(); qm.DeleteAccounts(Username); } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } } LoadAccountsFromDataBase(); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : 55" + ex.Message); } }