private void InsertSMSClick()
        {
            if (string.IsNullOrWhiteSpace(TBoxMID) || string.IsNullOrWhiteSpace(TBoxSender) || string.IsNullOrWhiteSpace(TBoxBody))
            {
                MessageBox.Show("Please fill out all boxes please");
                return;
            }

            EmailAdd AddEmail = new EmailAdd();

            {
                AddEmail.MessageID = "E" + TBoxMID;
                AddEmail.Sender    = TBoxSender;
                AddEmail.Subject   = TBoxSubject;
                AddEmail.Body      = TBoxBody;
            }

            ListEmail.Add(AddEmail);

            SaveToFile save = new SaveToFile();

            if (!save.EmailToCSV(ListEmail, MessageType))
            {
                MessageBox.Show("Error while saving\n" + save.ErrorCode);
            }
            else
            {
                save = null;
            }
            MessageBox.Show("Order saved");
        }
示例#2
0
        private void InsertSMSClick()
        {
            var email   = new EmailAddressAttribute();
            var website = new UrlAttribute();

            if (email.IsValid(TBoxSender))
            {
                string[] Body = TBoxBody.Split(' ');
                foreach (string word in Body)
                {
                    WebCheck = word;
                    if (website.IsValid(word) || word.Contains("www"))
                    {
                        ListAdd Quarantine = new ListAdd();
                        {
                            Quarantine.ListType = word;
                            Quarantine.Count    = "1";
                        }
                        ListType = "Q";
                        ListQuarantine.Add(Quarantine);

                        SaveToList Q = new SaveToList();

                        if (!Q.WriteToCSV(ListQuarantine, ListType))
                        {
                            MessageBox.Show("Error while saving\n" + Q.ErrorCode);
                        }
                        else
                        {
                            Q = null;
                        }

                        WebCheck = WebCheck.Replace(WebCheck, "<URL Quarantined>");
                        MessageBox.Show(WebCheck);
                        for (int x = 0; x < Body.Length; x++)
                        {
                            if (Body[x] == word)
                            {
                                Body[x] = Body[x].Replace(word, WebCheck);
                            }
                        }
                    }
                }
                TBoxBody = string.Join(" ", Body);
                MessageBox.Show(TBoxBody);

                EmailAdd AddEmail = new EmailAdd();
                {
                    AddEmail.MessageID = "E" + TBoxMID;
                    AddEmail.Sender    = TBoxSender;
                    try
                    {
                        AddEmail.Subject = "SIR " + DPickerContent.ToString();
                        check            = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Please Select a date");
                        check = false;
                    }
                    AddEmail.Body = CentreCode + "" + Incident + "" + TBoxBody;
                }

                if (check == true)
                {
                    ListEmail.Add(AddEmail);

                    SaveToFile save = new SaveToFile();

                    if (!save.EmailToCSV(ListEmail, MessageType))
                    {
                        MessageBox.Show("Error while saving\n" + save.ErrorCode);
                    }
                    else
                    {
                        save = null;
                    }

                    ListAdd SIRList = new ListAdd();
                    {
                        SIRList.ListType = AddEmail.Subject;
                        SIRList.Count    = "66-666-99";
                    }

                    ListType = "S";
                    ListSIR.Add(SIRList);

                    SaveToList SIR = new SaveToList();
                    if (!SIR.WriteToCSV(ListSIR, ListType))
                    {
                        MessageBox.Show("Error while saving\n" + SIR.ErrorCode);
                    }
                    else
                    {
                        SIR = null;
                    }
                    MessageBox.Show("Order saved");
                }
            }
            else
            {
                MessageBox.Show("Wrong");
            }
        }