private void loadAppLinks() { try { var appLinksList = new List <AppLinks>(); appLinksList.Clear(); appLinksList = DALHelpers.GetAppLinks(); dgvAppLinks.DataSource = null; dgvAppLinks.Rows.Clear(); dtAppLinks.Clear(); foreach (AppLinks link in appLinksList) { string tempPassword = link.Password.ToString(); if (!string.IsNullOrEmpty(tempPassword)) { tempPassword = Encryption.Decrypt(tempPassword); } dtAppLinks.Rows.Add(link.ListId.ToString(), link.Description.ToString(), link.Link.ToString(), link.AppCategoryId.ToString(), link.AppCategoryName.ToString(), link.ApplicationId.ToString(), link.ApplicationName.ToString(), link.CountryId.ToString(), link.CountryName.ToString(), link.CredentialId.ToString(), link.CredentialDescription.ToString(), link.Username.ToString(), tempPassword, link.AppCategoryName.ToString() + link.ApplicationName.ToString() + link.CountryName.ToString() + link.Description.ToString() + link.Link.ToString() + link.CredentialDescription.ToString() + link.Username.ToString()); } dgvAppLinks.DataSource = dtAppLinks; dgvAppLinks.Columns[0].Visible = false; dgvAppLinks.Columns[3].Visible = false; dgvAppLinks.Columns[5].Visible = false; dgvAppLinks.Columns[7].Visible = false; dgvAppLinks.Columns[9].Visible = false; dgvAppLinks.Columns[13].Visible = false; dgvAppLinks.Columns[1].Width = 200; dgvAppLinks.Columns[2].Width = 300; dgvAppLinks.Columns[4].Width = 70; dgvAppLinks.Columns[6].Width = 70; dgvAppLinks.Columns[8].Width = 70; dgvAppLinks.Columns[10].Width = 140; dgvAppLinks.Columns[11].Width = 70; dgvAppLinks.Sort(dgvAppLinks.Columns["Link Description"], ListSortDirection.Ascending); } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message); } }
public static DatabaseViewModel GetDataFromDatabase() { DatabaseViewModel databaseViewModel = new DatabaseViewModel(); databaseViewModel.ContactList = DALHelpers.GetContacts(); databaseViewModel.DealerContactList = DALHelpers.GetDealerContacts(); databaseViewModel.MainDealerList = DALHelpers.GetDealers(); databaseViewModel.DealerBranchesList = DALHelpers.GetDealerBranchs(); databaseViewModel.ApplicationsList = DALHelpers.GetApplications(); databaseViewModel.AppLinksList = DALHelpers.GetAppLinks(); databaseViewModel.CountryList = DALHelpers.GetCountries(); return(databaseViewModel); }
private void updatePasswordToolStripMenuItem_Click(object sender, EventArgs e) { foreach (var password in PasswordList) { TreeNode tn = treeView1.SelectedNode; if (tn != null) { if (treeView1.SelectedNode.Text.ToString() == password.Value.ToString()) { frmUpdatePassword _frmUpdatePassword = new frmUpdatePassword(password.Key, left, top, width, height); this.TopMost = false; _frmUpdatePassword.ShowDialog(); //loadAppLinks(); setTopMostWindowSetting(); _frmUpdatePassword.Dispose(); PasswordList.Clear(); ApplicationsList = DALHelpers.GetApplications(); AppLinksFromDatabase = DALHelpers.GetAppLinks(); if (txtAppSearch.Text.Length > 1) { loadAppsFromSearchBox(); } else { loadTreeview(false, null); } break; } } } }
private void frmContacts_Load(object sender, EventArgs e) { try { #region "Get App Version" //AppVersion appVersion = new AppVersion(); //appVersion = DALHelpers.GetVersion(); //string myVersion = Validation.AssemblyVersion; ////int result = string.Compare(myVersion, appVersion.LatestVersion.ToString()); //if (myVersion.ToString() != appVersion.LatestVersion.ToString()) //{ // System.Diagnostics.Process.Start(@"\\vcn.ds.volvo.net\it-cta\ITPROJ02\002378\DESENV\DBS\AUTOMATOR\LINKS FORM\release\setup.exe"); // notifyIcon.Visible = false; // Application.Exit(); //} #endregion #region "Loading Contacts" dtContacts.Columns.Add("ContactId", typeof(string)); dtContacts.Columns.Add("Name", typeof(string)); dtContacts.Columns.Add("Phone", typeof(string)); dtContacts.Columns.Add("CellPhone", typeof(string)); dtContacts.Columns.Add("TeamId", typeof(string)); dtContacts.Columns.Add("TeamName", typeof(string)); dtContacts.Columns.Add("Computer Name", typeof(string)); dtContacts.Columns.Add("StringToSearch", typeof(string)); contactList = DALHelpers.GetContacts(); loadContacts(); #endregion #region "Loading DealerContacts" dtDealerContacts.Columns.Add("DealerContactId", typeof(string)); dtDealerContacts.Columns.Add("MainDealerId", typeof(string)); dtDealerContacts.Columns.Add("Name", typeof(string)); dtDealerContacts.Columns.Add("Phone", typeof(string)); dtDealerContacts.Columns.Add("CellPhone", typeof(string)); dtDealerContacts.Columns.Add("Email", typeof(string)); dtDealerContacts.Columns.Add("DealerName", typeof(string)); dtDealerContacts.Columns.Add("Department", typeof(string)); dtDealerContacts.Columns.Add("CountryId", typeof(string)); dtDealerContacts.Columns.Add("CountryName", typeof(string)); dtDealerContacts.Columns.Add("StringToSearch", typeof(string)); dealerContactList = DALHelpers.GetDealerContacts(); //loadDealerContacts(); #endregion #region "Loading Dealers" dtDealers.Columns.Add("DealerId", typeof(string)); dtDealers.Columns.Add("Dealer", typeof(string)); dtDealers.Columns.Add("Branch", typeof(string)); dtDealers.Columns.Add("Phone Number", typeof(string)); dtDealers.Columns.Add("CTDI", typeof(string)); dtDealers.Columns.Add("BaldoPartner", typeof(string)); dtDealers.Columns.Add("CountryId", typeof(string)); dtDealers.Columns.Add("Country", typeof(string)); dtDealers.Columns.Add("CNPJ", typeof(string)); dtDealers.Columns.Add("IsActive", typeof(string)); dtDealers.Columns.Add("MainDealerId", typeof(string)); dtDealers.Columns.Add("StringToSearch", typeof(string)); dtDealers.Columns.Add("Sort", typeof(string)); dealerList = DALHelpers.GetDealers(); loadDealers(); #endregion #region "Loading AppLinks TreeView" ApplicationsList = DALHelpers.GetApplications(); AppLinksFromDatabase = DALHelpers.GetAppLinks(); loadTreeview(false, null); #endregion #region "MAIN WINDOW POSITION" left = this.DesktopLocation.X; top = this.DesktopLocation.Y; width = this.Width; height = this.Height; #endregion } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message); } }