public EmailSender(Profile profile, string emailFrom, string subject, string smtpServer, string port)
        {
            InitializeComponent();

            this.profile = profile;
            this.emailFrom = emailFrom;
            this.subject = subject;
            this.smtpServer = smtpServer;

            try
            {
                this.port = Int32.Parse(port);
            }
            catch (Exception)
            {
                MessageBox.Show("Port cannot be parsed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.port = 25;
            }

            this.fromTextBox.Text = emailFrom;
            this.smtpTextBox.Text = smtpServer;
            this.topicTextBox.Text = subject;
            this.portTextBox.Text = port;
            this.body = FormatedMail.htmlOpeningTags();
            this.readUsersFromActiveDirectory();
            this.body += FormatedMail.htmlClosingTags();

            List <string> emailRecepients = profile.EmailRecepients;
            foreach (string email in emailRecepients)
            {
                recepientsBox.Items.Add(email);
            }
        }
Ejemplo n.º 2
0
 public Profile Clone()
 {
     Profile copy = new Profile();
     copy.Name = this.Name;
     copy.SecurityGroups = new List<String>(this.SecurityGroups);
     copy.EmailRecepients = new List<String>(this.EmailRecepients);
     return copy;
 }
        public ProfileEditor(Profile profile, List<Profile> profileNames, List<string> activeDesktopGroups)
        {
            InitializeComponent();
            this.allProfileNames = profileNames;
            this.savedProfile = profile;
            this.editingProfile = profile.Clone();
            this.activeDesktopGroups = activeDesktopGroups;
            this.formApplied = false;

            foreach (string group in activeDesktopGroups)
                securityComboBox.Items.Add(group);
            securityComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 4
0
 private void profileAddedHandler(Profile profile)
 {
     comboProfiles.Items.Add(profile.Name);
     comboProfiles.SelectedIndex = comboProfiles.FindStringExact(profile.Name);
 }
Ejemplo n.º 5
0
 private void onProfileEdited(Profile profile)
 {
     profileSecurityGroups.Items.Clear();
     List<string> curentGroups = profile.SecurityGroups;
     foreach (string group in curentGroups)
         profileSecurityGroups.Items.Add(group);
     comboProfiles.Items[comboProfiles.SelectedIndex] = profile.Name;
 }
Ejemplo n.º 6
0
        private void onProfileDeleted(Profile profile)
        {
            if (profile == null)
                return;
            var profiles = this.manager.Profiles;
            int newIndex = comboProfiles.SelectedIndex;
            profiles.Remove(profile);
            comboProfiles.Items.Remove(profile.Name);

            // Setting the next folowing profile after the removed profile or previous one if the last profile in the list was removed.
            if (comboProfiles.Items.Count != newIndex)
                comboProfiles.SelectedIndex = newIndex;
            else
            {
                comboProfiles.SelectedIndex = newIndex - 1;
                if (newIndex - 1 == -1 )
                {
                    profileSecurityGroups.Items.Clear();
                }

            }
        }
Ejemplo n.º 7
0
 private void btnNewProfile_Click(object sender, EventArgs e)
 {
     Profile createdProfile = new Profile();
     ProfileEditor frm = new ProfileEditor(createdProfile, this.manager.Profiles, this.manager.ActiveDesktopGroups);
     frm.ShowDialog();
     if (frm.FormApplied)
     {
         manager.addProfile(createdProfile);
         xmlManager.writeProfileToXml(createdProfile);
     }
 }
 public void setCurrentProfile(Profile current)
 {
     if (current != null)
         this.openedProfile = current;
 }
 public void addProfile(Profile profile)
 {
     profiles.Add(profile);
     if (onProfileAdded != null)
         onProfileAdded(profile);
 }
 public SecurityGroupManager(List<string> groups)
 {
     activeDesktopGroups = new List<string>(groups);
     profiles = new List<Profile>();
     openedProfile = new Profile();
 }
 public ExcelReportForm(Profile profile)
 {
     InitializeComponent();
     this.profile = profile;
 }
Ejemplo n.º 12
0
 public void Copy(Profile profile)
 {
     this.Name = profile.Name;
     this.SecurityGroups = profile.SecurityGroups;
     this.EmailRecepients = profile.EmailRecepients;
 }