コード例 #1
0
        private List <App> loadApplications()
        {
            var countryList = new List <App>();

            applicationList = DALHelpers.GetApplications();

            dgvApplications.DataSource = null;
            dgvApplications.Rows.Clear();
            dtApplications.Clear();

            foreach (App app in applicationList)
            {
                dtApplications.Rows.Add(

                    app.ApplicationId.ToString(),
                    app.ApplicationName.ToString(),
                    app.ApplicationId.ToString() + app.ApplicationName.ToString());
            }

            dgvApplications.DataSource         = dtApplications;
            dgvApplications.Columns[0].Width   = 100;
            dgvApplications.Columns[1].Width   = 280;
            dgvApplications.Columns[0].Visible = false;
            dgvApplications.Columns[2].Visible = false;

            dgvApplications.Sort(dgvApplications.Columns["Application Name"], ListSortDirection.Ascending);

            return(applicationList);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
                    }
                }
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        public frmAddOrUpdateAppLinks(AppLinks appLinks)
        {
            InitializeComponent();

            GlobalLinkId = appLinks.AppLinkId;

            #region "Loading Credentials"

            dtCredentials.Columns.Add("CredentialId", typeof(int));
            dtCredentials.Columns.Add("CredentialDescription", typeof(string));
            dtCredentials.Columns.Add("Username", typeof(string));
            dtCredentials.Columns.Add("Password", typeof(string));
            dtCredentials.Columns.Add("StringToSearch", typeof(string));

            #endregion

            countryList  = DALHelpers.GetCountries();
            appList      = DALHelpers.GetApplications();
            categoryList = DALHelpers.GetCategories();

            StyleApplicationButtons();

            this.Size = new Size(536, 466);
            grpCredential.Location = new Point(12, 12);

            if (GlobalLinkId > 0)
            {
                txtDescription.Text = appLinks.Description;
                txtURL.Text         = appLinks.Link;

                int counter = 0;

                foreach (Country country in countryList)
                {
                    cmbCountry.Items.Add(country.CountryName.ToString());

                    if (appLinks.CountryId == country.CountryId)
                    {
                        cmbCountry.SelectedIndex = counter;
                    }

                    counter++;
                }

                counter = 0;
                foreach (App app in appList)
                {
                    cmbApplication.Items.Add(app.ApplicationName.ToString());

                    if (appLinks.ApplicationId == app.ApplicationId)
                    {
                        cmbApplication.SelectedIndex = counter;
                    }

                    counter++;
                }

                counter = 0;
                foreach (Category category in categoryList)
                {
                    cmbCategory.Items.Add(category.CategoryName.ToString());

                    if (appLinks.AppCategoryId == category.CategoryId)
                    {
                        cmbCategory.SelectedIndex = counter;
                    }

                    counter++;
                }

                credentialList = loadCredentials();

                counter = 0;
                foreach (Credential credential in credentialList)
                {
                    if (appLinks.CredentialId == credential.CredentialId)
                    {
                        CredentialId             = credential.CredentialId;
                        txtCredentialId.Text     = credential.Username;
                        btnRemoveCredential.Text = "Remove Credential";
                    }
                }
                dgvCredentials.ClearSelection();
            }
            else
            {
                foreach (Country country in countryList)
                {
                    cmbCountry.Items.Add(country.CountryName.ToString());
                }

                foreach (App app in appList)
                {
                    cmbApplication.Items.Add(app.ApplicationName.ToString());
                }

                foreach (Category category in categoryList)
                {
                    cmbCategory.Items.Add(category.CategoryName.ToString());
                }

                credentialList = loadCredentials();
                dgvCredentials.ClearSelection();
            }

            if (btnRemoveCredential.Text == "Select Credential")
            {
                pictureBox1.Visible = false;
            }
            else
            {
                pictureBox1.Visible = true;
            }
        }
コード例 #6
0
        public frmAddOrUpdateAppLinks(int LinkId, int CountryId, int ApplicationId, int CategoryId, string Description, string Link, int CredentialId)
        {
            InitializeComponent();

            GlobalLinkId = LinkId;

            #region "Loading Credentials"

            dtCredentials.Columns.Add("CredentialId", typeof(int));
            dtCredentials.Columns.Add("Username", typeof(string));
            dtCredentials.Columns.Add("Password", typeof(string));
            dtCredentials.Columns.Add("CredentialDescription", typeof(string));

            #endregion

            countryList  = DALHelpers.GetCountries();
            appList      = DALHelpers.GetApplications();
            categoryList = DALHelpers.GetCategories();

            if (LinkId > 0)
            {
                txtDescription.Text = Description;
                txtURL.Text         = Link;

                int counter = 0;

                foreach (Country country in countryList)
                {
                    cmbCountry.Items.Add(country.CountryName.ToString());

                    if (CountryId == country.CountryId)
                    {
                        cmbCountry.SelectedIndex = counter;
                    }

                    counter++;
                }

                counter = 0;
                foreach (App app in appList)
                {
                    cmbApplication.Items.Add(app.ApplicationName.ToString());

                    if (ApplicationId == app.ApplicationId)
                    {
                        cmbApplication.SelectedIndex = counter;
                    }

                    counter++;
                }

                counter = 0;
                foreach (Category category in categoryList)
                {
                    cmbCategory.Items.Add(category.CategoryName.ToString());

                    if (CategoryId == category.CategoryId)
                    {
                        cmbCategory.SelectedIndex = counter;
                    }

                    counter++;
                }

                credentialList = loadCredentials();

                counter = 0;
                foreach (Credential credential in credentialList)
                {
                    if (CredentialId == credential.CredentialId)
                    {
                        txtCredentialUsername.Text = credential.Username;
                        txtCredentialId.Text       = credential.CredentialId.ToString();
                        lblOk.Visible = true;
                    }
                }
                dgvCredentials.ClearSelection();
            }
            else
            {
                foreach (Country country in countryList)
                {
                    cmbCountry.Items.Add(country.CountryName.ToString());
                }

                foreach (App app in appList)
                {
                    cmbApplication.Items.Add(app.ApplicationName.ToString());
                }

                foreach (Category category in categoryList)
                {
                    cmbCategory.Items.Add(category.CategoryName.ToString());
                }

                credentialList = loadCredentials();

                dgvCredentials.ClearSelection();
            }
        }