예제 #1
0
        public void testList010()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email[] children = el.ToArray();
            Assert.AreEqual(2, children.Length, "Should have 2 array elements");

            el.RemoveChild(email2);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.RemoveChild(email1);
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");

            children = el.ToArray();
            Assert.AreEqual(0, children.Length, "Should have 0 array elements");
        }
예제 #2
0
        public void testList010()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email[] children = el.ToArray();
            Assert.AreEqual(2, children.Length, "Should have 2 array elements");

            el.RemoveChild(email2);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.RemoveChild(email1);
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");

            children = el.ToArray();
            Assert.AreEqual(0, children.Length, "Should have 0 array elements");
        }
예제 #3
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email( EmailType.Wrap( "asdfasdf" ), "*****@*****.**" );
            Email email2 = new Email( EmailType.Wrap( "Primary" ), "*****@*****.**" );

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email email3 = new Email();
            email3.Type = "Alternate1";
            el.Add(email3);
            Assert.AreEqual(3, el.ChildCount, "Should have 3 emails");

            Email primary = el[EmailType.PRIMARY];
            Assert.IsNotNull( primary );

            primary = el["Primary"];
            Assert.IsNotNull(primary);

            Email secondary = el[EmailType.ALT1];
            Assert.IsNotNull(secondary);

            secondary = el["Alternate1"];
            Assert.IsNotNull(secondary);
        }
예제 #4
0
 private void ExecuteNewCommand()
 {
     new EmailView().Show();
     Messenger.Default.Send(new NotificationMessageAction <EmailItem>(null, item => {
         EmailList.Add(item);
     }), "email");
 }
예제 #5
0
        // Adds new mail into the JSON file so it appears in the inbox.
        public static void AddMail(string src, string dst, string dt, string sbjt, string bdy)
        {
            string domain = "";//init

            if (BootOptions.enableNetworking == true)
            {
                //break up parts of the sender's email
                if (src.Contains("@"))
                {
                    string[] breakUpEmail = src.Split('@');
                    domain = breakUpEmail[1]; //grab domain after the @ symbol
                }
                //If the email source hasn't been blocked on the firewall
                if (Class_Firewall.blockedDomains.Contains(domain) == false)
                {
                    EmailStruct newMail = new EmailStruct
                    {
                        // Creates a new email with the passed in values.
                        Source      = src,
                        Destination = dst,
                        Date        = dt,
                        Subject     = sbjt,
                        Body        = bdy
                    };

                    //Then we add the new email to the inbox.
                    EmailList.Add(newMail);
                    Desktop_BKEND.Notification("You've got mail!");
                }
            }
        }
예제 #6
0
        private void dlgSendMail_FormClosing(object sender, FormClosingEventArgs e)
        {
            MySQLHelper._connectionString = Global.MySQLConnectionInfo.ConnectionString;

            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (!CheckInfo())
                {
                    txtTo.Hide();
                    txtCc.Hide();
                    e.Cancel = true;
                }
                else
                {
                    dlgPasscode dlg = new dlgPasscode();
                    if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        _passcode = dlg.Passcode;
                        List <string> toEmailList = txtTo.GetEmailList();
                        List <string> ccEmailList = txtCc.GetEmailList();
                        foreach (var mail in toEmailList)
                        {
                            _emailList.Add(mail);
                        }

                        foreach (var mail in ccEmailList)
                        {
                            _emailList.Add(mail);
                        }

                        _emailList.Serialize(Global.EmailListPath);

                        txtTo.Clear();
                        txtCc.Clear();
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
            else
            {
                txtTo.Hide();
                txtCc.Hide();
            }
        }
예제 #7
0
        async void Init()
        {
            var soapClient = new Bubble.ContactsSoapClient();
            IEnumerable <Person>  persons;
            IEnumerable <Email>   ems;
            IEnumerable <Address> ads;
            IEnumerable <Phone>   phs;

            persons = await soapClient.GetPeopleAsync();

            foreach (var dude in persons)
            {
                ContactList.Add(dude);
            }
            ems = await soapClient.GetEmailsAsync();

            foreach (var e in ems)
            {
                EmailList.Add(e);
            }
            ads = await soapClient.GetAddressesAsync();

            foreach (var a in ads)
            {
                AddressList.Add(a);
            }
            phs = await soapClient.GetPhonesAsync();

            foreach (var p in phs)
            {
                PhoneList.Add(p);
            }

            foreach (var dude in ContactList)
            {
                foreach (var e in EmailList)
                {
                    if (dude.PID == e.PersonID)
                    {
                        dude.elist.Add(e);
                    }
                }
                foreach (var a in AddressList)
                {
                    if (dude.PID == a.PersonID)
                    {
                        dude.alist.Add(a);
                    }
                }
                foreach (var p in PhoneList)
                {
                    if (dude.PID == p.PersonID)
                    {
                        dude.plist.Add(p);
                    }
                }
            }
        }
예제 #8
0
        //Send email to all people who has an component with expired loan date, but only once (no more than 1 email pr. user pr. component)

        public void SendExpLoanEmail()
        {
            //DateTime today = DateTime.Today;
            //SqlDateTime? today = DateTime.Today;
            foreach (Component component in AllComponentList)
            {
                if (component.ActualLoanInformation.ReturnDate != null)
                {
                    if ((component.ActualLoanInformation.ReturnDate.Value < DateTime.Now) && (component.ActualLoanInformation.IsEmailSend == "yes"))
                    {
                        EmailList.Add(component);
                    }
                }
            }

            foreach (Component component in EmailList)
            {
                try
                {
                    MailMessage mail = new MailMessage();
                    //put your SMTP address and port here.
                    SmtpClient smtpServer = new SmtpClient("smtp.", 587);                     //todo skal rettes til med mail og port for skolens udbyders SMPT server.
                    //Set the secure socket layer to true.
                    smtpServer.EnableSsl = true;
                    //Your username and password!
                    smtpServer.Credentials = new System.Net.NetworkCredential("", "");                     //todo skal have indsat Login oplysninger for værkstedet for den nye mail oprettet til projektet.
                    //Set the timeout period for which the email keeps trying to send the email
                    smtpServer.Timeout = 30000;
                    //Put the email address
                    mail.From = new MailAddress("@iha.dk");                     //todo skal have indsat skolens statiske mail her.
                    //Put the email where you want to send.
                    mail.To.Add(component.ActualLoanInformation.OwnerID.ToString(CultureInfo.InvariantCulture) + "@iha.dk");
                    mail.Subject = component.ComponentName + "indkaldes";

                    StringBuilder sbBody = new StringBuilder();
                    sbBody.AppendLine("Nu er tiden kommet til at få afleveret lånte komponenter fra værkstedet");
                    sbBody.AppendLine("Du bedes returnere" + component.ComponentName + "snarest muligt");
                    sbBody.AppendLine("Mvh Værkstedet i Shannon");

                    //Writes the newly made predifned string builder into the mails body property.
                    mail.Body = sbBody.ToString();
                    //Your log file path
                    //System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(@"C:\Logs\CheckoutPOS.log");
                    //mail.Attachments.Add(attachment);

                    smtpServer.Send(mail);
                    //MessageBox.Show("The exception has been sent! :)");
                    component.ActualLoanInformation.IsEmailSend = "yes";
                    ldbUtil_.UpdateLoanInformation(component.ComponentID, component.ActualLoanInformation);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Det var ikke muligt at sende emails med udløbet udlån" + ex);
                    //Console.WriteLine(ex.ToString());
                }
            }
        }
예제 #9
0
        private async Task OnAddEmail()
        {
            if (!_emailText.IsValidEmail())
            {
                await Alert.ShowMessage(nameof(AppResources.PleaseEnterValidEmail).Translate());

                return;
            }
            EmailList.Add(_emailText);
        }
예제 #10
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            el.Add(email2);

            Assert.IsNotNull(email1.Parent, "Parent should not be null");
            Assert.IsNotNull(email2.Parent, "Parent should not be null");

            el.Clear();
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");
            Assert.IsNull(email1.Parent, "Parent should be null");
            Assert.IsNull(email2.Parent, "Parent should be null");
        }
예제 #11
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("asdfasdf"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("Primary"), "*****@*****.**");



            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");


            Email email3 = new Email();

            email3.Type = "Alternate1";
            el.Add(email3);
            Assert.AreEqual(3, el.ChildCount, "Should have 3 emails");



            Email primary = el[EmailType.PRIMARY];

            Assert.IsNotNull(primary);

            primary = el["Primary"];
            Assert.IsNotNull(primary);


            Email secondary = el[EmailType.ALT1];

            Assert.IsNotNull(secondary);

            secondary = el["Alternate1"];
            Assert.IsNotNull(secondary);
        }
예제 #12
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");


            el.Add(email1);
            el.Add(email2);

            Assert.IsNotNull(email1.Parent, "Parent should not be null");
            Assert.IsNotNull(email2.Parent, "Parent should not be null");

            el.Clear();
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");
            Assert.IsNull(email1.Parent, "Parent should be null");
            Assert.IsNull(email2.Parent, "Parent should be null");
        }
예제 #13
0
        public void testAddChildTwice()
        {
            StudentPersonal sp1    = new StudentPersonal();
            Email           email1 = new Email(EmailType.PRIMARY, "*****@*****.**");

            EmailList eList = new EmailList();

            sp1.EmailList = eList;

            eList.AddChild(CommonDTD.EMAIL, email1);
            // We should be able to add the same child twice without getting an exception
            eList.AddChild(CommonDTD.EMAIL, email1);

            // Add it again, using the overload
            eList.AddChild(email1);

            Email[] studentEmails = sp1.EmailList.ToArray();
            Assert.AreEqual(1, studentEmails.Length, "Should be one email");

            StudentPersonal sp2    = ObjectCreator.CreateStudentPersonal();
            Email           email2 = new Email(EmailType.ALT1, "*****@*****.**");
            EmailList       elist2 = new EmailList();

            elist2.Add(email2);
            sp2.EmailList = elist2;

            bool exceptionThrown = false;

            try
            {
                eList.AddChild(email2); // should throw here
            }
            catch (InvalidOperationException)
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown, "IllegalStateException should have been thrown in addChild(SIFElement)");

            exceptionThrown = false;
            try
            {
                eList.AddChild(CommonDTD.EMAILLIST, email2); // should throw here
            }
            catch (InvalidOperationException)
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown,
                          "IllegalStateException should have been thrown in addChild( ElementDef, SIFElement)");
        }
예제 #14
0
        public void testList030()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("bar"), "*****@*****.**");

            el.Add(email1);
            el.Add(email2);

            // test the iterator
            int count = 0;
            foreach (Email e in el)
            {
                Assert.IsNotNull(e, "Email should not be null");
                Assert.AreEqual(24, e.TextValue.Length, "Should have email address");
                count++;
            }

            Assert.AreEqual(2, count, "Should have iterated 2 emails");
        }
예제 #15
0
        public void testList030()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("bar"), "*****@*****.**");

            el.Add(email1);
            el.Add(email2);

            // test the iterator
            int count = 0;

            foreach (Email e in el)
            {
                Assert.IsNotNull(e, "Email should not be null");
                Assert.AreEqual(24, e.TextValue.Length, "Should have email address");
                count++;
            }

            Assert.AreEqual(2, count, "Should have iterated 2 emails");
        }
예제 #16
0
        private void _import(string file)
        {
            if (string.IsNullOrEmpty(file) || !File.Exists(file))
            {
                return;
            }

            var          encoder = new TxtEncoder();
            StreamReader sr      = new StreamReader(file, encoder.GetEncoding(file));
            string       line;

            while ((line = sr.ReadLine()) != null)
            {
                if (!Regex.IsMatch(line, Pattern))
                {
                    continue;
                }
                var match = Regex.Match(line, Pattern);
                EmailList.Add(new EmailItem(match.Groups[1].Value, match.Groups[2].Value));
            }
            sr.Close();
        }