Example #1
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (appConfig.GetValue("ActiveDirectory").Equals("yes"))
                {
                    ckAcctiveDirectory.IsChecked = true;
                }
                else
                {
                    txtDomainName.IsEnabled = false;
                }

                if (appConfig.GetValue("Outlook").Equals("yes"))
                {
                    ckOutlook.IsChecked = true;
                }
                if (appConfig.GetValue("OutlookExpress").Equals("yes"))
                {
                    ckOutlookExpress.IsChecked = true;
                }

                txtDomainName.Text = appConfig.GetValue("DomainName");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);
            lbOrganisationName.Text = appConfig.GetValue("OrganisationName");
            try
            {
                Uri         imageUri = new Uri(appConfig.GetValue("OrganisationLogo"));
                BitmapImage bi       = new BitmapImage(new Uri(appConfig.GetValue("OrganisationLogo"), UriKind.RelativeOrAbsolute));
                imgLogo.Source = bi;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid Path of Logo");
            }



            contacts = searcher.SearchAll();

            var x = from u in contacts select u.Key;

            foreach (string st in x)
            {
                lbName.Items.Add(st);
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     if (!appConfig.GetValue("ActiveDirectory").Equals("yes"))
     {
         btnPermissionsAllUser.IsEnabled = false;
         btnPermissions.IsEnabled        = false;
         btnExport.IsEnabled             = false;
         btnImport.IsEnabled             = false;
     }
 }
Example #4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (appConfig.GetValue("ActiveDirectory").Equals("yes"))
            {
                ckAcctiveDirectory.IsChecked = true;
            }
            if (appConfig.GetValue("Outlook").Equals("yes"))
            {
                ckOutlook.IsChecked = true;
            }

            txtDomainName.Text = appConfig.GetValue("DomainName");
        }
Example #5
0
        private void OptionsForm_Load(object sender, EventArgs e)
        {
            if (appConfig.GetValue("ActiveDirectory").Equals("yes"))
            {
                ckActiveDirectory.Checked = true;
            }
            if (appConfig.GetValue("Outlook").Equals("yes"))
            {
                ckOutlook.Checked = true;
            }

            if (appConfig.GetValue("HomePhone").Equals("yes"))
            {
                ckHomePhone.Checked = true;
            }

            if (appConfig.GetValue("MobilePhone").Equals("yes"))
            {
                ckMobilePhone.Checked = true;
            }

            if (appConfig.GetValue("BusinessPhone").Equals("yes"))
            {
                ckBusinessPhone.Checked = true;
            }

            if (appConfig.GetValue("BusinessFax").Equals("yes"))
            {
                ckBusinessFax.Checked = true;
            }

            if (appConfig.GetValue("Address").Equals("yes"))
            {
                ckAddress.Checked = true;
            }

            if (appConfig.GetValue("Email").Equals("yes"))
            {
                ckEmail.Checked = true;
            }

            if (appConfig.GetValue("WindowsService").Equals("yes"))
            {
                ckWindowService.Checked = true;
            }

            txtDomain.Text = appConfig.GetValue("DomainName");
        }
Example #6
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     if (appConfig.GetValue("WindowsService").Equals("yes"))
     {
         ckWindowService.IsChecked = true;
     }
 }
Example #7
0
        /// <summary>
        /// Search all the contacts
        /// </summary>
        public Dictionary <string, Contact> SearchAll()
        {
            CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(Constants.CONGIF_FILE);

            //Outlook contact
            if (appConfig.GetValue("Outlook").Equals("yes"))
            {
                try
                {
                    _contacts = CommonLibrary.OutlookContact.ContactManagement.RetreiveAllContact();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Outlook not available " + ex.Message);
                }
            }


            if (appConfig.GetValue("ActiveDirectory").Equals("yes"))
            {
                //Active Directory Contact
                string domainName = appConfig.GetValue("DomainName");
                try
                {
                    CommonLibrary.ActiveDirectory.ContactManagement contactManagement = new CommonLibrary.ActiveDirectory.ContactManagement(domainName);
                    Dictionary <string, Contact> activeDirectoryContacts = contactManagement.RetrieveAllContact("(objectCategory=person)");

                    foreach (var k in activeDirectoryContacts)
                    {
                        if (_contacts.ContainsKey(k.Key))
                        {
                            _contacts.Add(k.Key + " (AD)", k.Value);
                        }
                        else
                        {
                            _contacts.Add(k.Key, k.Value);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Wrong Domain Name  " + domainName);
                }
            }

            return(_contacts);
        }
Example #8
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         txtLicensedTo.Text = "Registered to: " + appConfig.GetValue("OrganisationName");
     }
     catch (Exception ex)
     {
     }
 }
Example #9
0
        private static string GetDomain()
        {
            string domainName = "";

            CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(CommonLibrary.Constants.GetConfigFilePath());
            domainName = appConfig.GetValue("DomainName");


            return(domainName);
        }
Example #10
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (appConfig.GetValue("HomePhone").Equals("yes"))
            {
                ckHomePhone.IsChecked = true;
            }

            if (appConfig.GetValue("MobilePhone").Equals("yes"))
            {
                ckMobilePhone.IsChecked = true;
            }

            if (appConfig.GetValue("BusinessPhone").Equals("yes"))
            {
                ckBusinessPhone.IsChecked = true;
            }

            if (appConfig.GetValue("BusinessFax").Equals("yes"))
            {
                ckBusinessFax.IsChecked = true;
            }

            if (appConfig.GetValue("Address").Equals("yes"))
            {
                ckAddress.IsChecked = true;
            }

            if (appConfig.GetValue("Email").Equals("yes"))
            {
                ckEmail.IsChecked = true;
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            txtOrganisationName.Text = appConfig.GetValue("OrganisationName");
            txtOrganisationLogo.Text = appConfig.GetValue("OrganisationLogo");
            if (appConfig.GetValue("DefaultLogo").Equals("yes"))
            {
                ckDefaultLogo.IsChecked = true;
            }

            try
            {
                string strBackground = appConfig.GetValue("Background");
                if (!strBackground.Equals(""))
                {
                    currentColor.Fill = BusinessLayer.Convert.HexColor2Brush(strBackground);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid Background value");
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);
            lbOrganisationName.Text = appConfig.GetValue("OrganisationName");
            if (appConfig.GetValue("DefaultLogo").Equals("no"))
            {
                try
                {
                    Uri         imageUri = new Uri(appConfig.GetValue("OrganisationLogo"));
                    BitmapImage bi       = new BitmapImage(new Uri(appConfig.GetValue("OrganisationLogo"), UriKind.RelativeOrAbsolute));
                    imgLogo.Source = bi;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Invalid Path of Logo");
                }
            }

            try
            {
                string hexColor = appConfig.GetValue("Background");
                if (!hexColor.Equals(""))
                {
                    this.Background = BusinessLayer.Convert.HexColor2Brush(hexColor);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid Background value");
            }
            //t = new Thread(new ThreadStart(SearchAllContact));
            //Thread.Sleep(1);
            //t.Start();

            SearchAllContact();
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            txtOrganisationName.Text = appConfig.GetValue("OrganisationName");
            txtOrganisationLogo.Text = appConfig.GetValue("OrganisationLogo");
            if (appConfig.GetValue("DefaultLogo").Equals("yes"))
            {
                ckDefaultLogo.IsChecked = true;
                button2.IsEnabled       = false;
            }

            try
            {
                string strBackground = appConfig.GetValue("Background");
                if (!strBackground.Equals(""))
                {
                    currentColor.Fill = Convert.HexColor2Brush(strBackground);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid Background value");
                CommonLibrary.Utilities.Log.Create("Invalid Background value; " + ex.Message);
            }
        }
Example #14
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);
         if (appConfig.GetValue("FirstRun").Equals("yes"))
         {
             appConfig.SaveValue("FirstRun", "No");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Options - closing  " + ex.Message);
     }
 }
Example #15
0
        public MainGUI()
        {
            InitializeComponent();

            try
            {
                CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);

                if (appConfig.GetValue("FirstRun").Equals("yes"))
                {
                    Options _Options = new Options();
                    _Options.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MainGUI:" + ex.Message);
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (appConfig.GetValue("HomePhone").Equals("yes"))
                {
                    ckHomePhone.IsChecked = true;
                }

                if (appConfig.GetValue("MobilePhone").Equals("yes"))
                {
                    ckMobilePhone.IsChecked = true;
                }

                if (appConfig.GetValue("BusinessPhone").Equals("yes"))
                {
                    ckBusinessPhone.IsChecked = true;
                }

                if (appConfig.GetValue("BusinessFax").Equals("yes"))
                {
                    ckBusinessFax.IsChecked = true;
                }

                if (appConfig.GetValue("Address").Equals("yes"))
                {
                    ckAddress.IsChecked = true;
                }

                if (appConfig.GetValue("Email").Equals("yes"))
                {
                    ckEmail.IsChecked = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #17
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

                int i = username.IndexOf(@"\");
                if (i != -1)
                {
                    username = username.Substring(i + 1, username.Length - i - 1);
                }
                txtUsername.Text = username;

                CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);
                contactManagement = new CommonLibrary.ActiveDirectory.ContactManagement(appConfig.GetValue("DomainName"));
                contact           = contactManagement.GetUserProfile(username);
                contact.Username  = username;

                txtHomePhone.Text     = contact.HomePhone;
                txtMobilePhone.Text   = contact.MobilePhone;
                txtBusinessPhone.Text = contact.BusinessPhone;
                txtBusinessFax.Text   = contact.BusinessFax;
                txtEmail.Text         = contact.Email;
                txtAddress.Text       = contact.Address;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     txtOrganisationName.Text = appConfig.GetValue("OrganisationName");
     txtOrganisationLogo.Text = appConfig.GetValue("OrganisationLogo");
 }
Example #19
0
        private void ViewData()
        {
            if (lbName.SelectedIndex != -1 && BusinessLayer.Constants.IsNotContain(lbName.SelectedItem.ToString()))
            {
                var x =
                    from u in contacts
                    where BusinessLayer.Constants.IsContain(u.Key)
                    select u.Key;

                string[] st = x.ToArray();

                for (int k = 0; k < st.Count(); k++)
                {
                    contacts.Remove(st[k]);
                    lbName.Items.Remove(st[k]);
                }


                int     i       = lbName.SelectedIndex;
                Contact contact = contacts[lbName.SelectedItem.ToString().Trim()];

                CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);

                if (appConfig.GetValue("HomePhone").Equals("yes"))
                {
                    string home = BusinessLayer.Constants.HOME_PHONE + " " + contact.HomePhone;
                    contacts.Add(home, contact);
                    lbName.Items.Insert(i + 1, home);
                }

                if (appConfig.GetValue("MobilePhone").Equals("yes"))
                {
                    string mobile = BusinessLayer.Constants.MOBILE_PHONE + " " + contact.MobilePhone;
                    contacts.Add(mobile, contact);
                    lbName.Items.Insert(i + 2, mobile);
                }

                if (appConfig.GetValue("BusinessPhone").Equals("yes"))
                {
                    string business = BusinessLayer.Constants.BUSINESS_PHONE + " " + contact.BusinessPhone;
                    contacts.Add(business, contact);
                    lbName.Items.Insert(i + 3, business);
                }

                if (appConfig.GetValue("BusinessFax").Equals("yes"))
                {
                    string businessfax = BusinessLayer.Constants.BUSINESS_FAX + " " + contact.BusinessFax;
                    contacts.Add(businessfax, contact);
                    lbName.Items.Insert(i + 4, businessfax);
                }

                if (appConfig.GetValue("Email").Equals("yes"))
                {
                    string email = BusinessLayer.Constants.EMAIL + " " + contact.Email;
                    contacts.Add(email, contact);
                    lbName.Items.Insert(i + 5, email);
                }

                if (appConfig.GetValue("Address").Equals("yes"))
                {
                    string address = BusinessLayer.Constants.ADDRESS + " " + contact.Address;
                    contacts.Add(address, contact);
                    lbName.Items.Insert(i + 6, address);
                }



                //lbName.SelectedIndex = i;
            }
        }
Example #20
0
 public static string GetADDomain()
 {
     return(GetDomain(appConfig.GetValue("DomainName")));
 }
Example #21
0
        public MainGUI()
        {
            InitializeComponent();

            try
            {
                CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);

                if (appConfig.GetValue("FirstRun").Equals("yes"))
                {
                    Options _Options = new Options();
                    _Options.Show();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("MainGUI:" + ex.Message);
            }

            NotifyMenu              = new System.Windows.Forms.ContextMenuStrip();
            mnuAboutUs              = new System.Windows.Forms.ToolStripMenuItem();
            mnuExit                 = new System.Windows.Forms.ToolStripMenuItem();
            mnuOptions              = new System.Windows.Forms.ToolStripMenuItem();
            mnuEditMyProfile        = new System.Windows.Forms.ToolStripMenuItem();
            mnuEditMyProfile.Click += new EventHandler(mnuEditMyProfile_Click);
            mnuOptions.Click       += new EventHandler(mnuOptions_Click);

            //
            // mnuAboutUs
            //
            mnuAboutUs.Name = "mnuAboutUs";
            mnuAboutUs.Size = new System.Drawing.Size(152, 22);
            mnuAboutUs.Text = "About Us";

            //
            // mnuExit
            //
            mnuExit.Name   = "mnuExit";
            mnuExit.Size   = new System.Drawing.Size(152, 22);
            mnuExit.Text   = "Exit";
            mnuExit.Click += new EventHandler(mnuExit_Click);


            //
            // mnuOptions
            //
            mnuOptions.Name = "mnuOptions";
            mnuOptions.Size = new System.Drawing.Size(152, 22);
            mnuOptions.Text = "Options";

            //
            // mnuOptions
            //
            mnuEditMyProfile.Name = "mnuEditMyProfile";
            mnuEditMyProfile.Size = new System.Drawing.Size(152, 22);
            mnuEditMyProfile.Text = "Edit My Profile";

            //
            // NotifyMenu
            //
            NotifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                mnuOptions,
                mnuEditMyProfile,
                mnuAboutUs,
                mnuExit
            });
            NotifyMenu.Name = "NotifyMenu";
            NotifyMenu.Size = new System.Drawing.Size(153, 92);



            // NotifyIcon
            m_notifyIcon = new System.Windows.Forms.NotifyIcon();
            m_notifyIcon.ContextMenuStrip = NotifyMenu;
            m_notifyIcon.BalloonTipText   = "The app has been minimised. Click the tray icon to show.";
            m_notifyIcon.BalloonTipTitle  = "The App";
            m_notifyIcon.Text             = "The App";
            m_notifyIcon.Icon             = new System.Drawing.Icon(@"Icons\Icon.ico");
            m_notifyIcon.MouseClick      += new System.Windows.Forms.MouseEventHandler(m_notifyIcon_MouseClick);
            ShowTrayIcon(true);
        }
        private void ViewData()
        {
            if (lbName.SelectedIndex != -1 && BusinessLayer.Constants.IsNotContain(lbName.SelectedItem.ToString()))
            {
                RemoveDetailsView();



                Contact contact = contacts[lbName.SelectedItem.ToString().Trim()];

                CommonLibrary.AppConfig appConfig = new CommonLibrary.AppConfig(BusinessLayer.Constants.CONGIF_FILE);

                Brush itemColor = new SolidColorBrush(Color.FromRgb(235, 235, 235));

                int itemIndex = lbName.SelectedIndex + 1;
                if (appConfig.GetValue("HomePhone").Equals("yes"))
                {
                    string home = BusinessLayer.Constants.HOME_PHONE + " " + contact.HomePhone;
                    contacts.Add(home, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = home;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                if (appConfig.GetValue("MobilePhone").Equals("yes"))
                {
                    string mobile = BusinessLayer.Constants.MOBILE_PHONE + " " + contact.MobilePhone;
                    contacts.Add(mobile, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = mobile;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                if (appConfig.GetValue("BusinessPhone").Equals("yes"))
                {
                    string business = BusinessLayer.Constants.BUSINESS_PHONE + " " + contact.BusinessPhone;
                    contacts.Add(business, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = business;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                if (appConfig.GetValue("BusinessFax").Equals("yes"))
                {
                    string businessfax = BusinessLayer.Constants.BUSINESS_FAX + " " + contact.BusinessFax;
                    contacts.Add(businessfax, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = businessfax;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                if (appConfig.GetValue("Email").Equals("yes"))
                {
                    string email = BusinessLayer.Constants.EMAIL + " " + contact.Email;
                    contacts.Add(email, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = email;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                if (appConfig.GetValue("Address").Equals("yes"))
                {
                    string address = BusinessLayer.Constants.ADDRESS + " " + contact.Address;
                    contacts.Add(address, contact);
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.FontWeight = FontWeights.Bold;
                    lbi.Background = itemColor;
                    lbi.Content    = address;
                    lbName.Items.Insert(itemIndex++, lbi);
                }

                oldSelectedIndex = lbName.SelectedIndex;
            }
        }