Example #1
0
        public string MailTrigger()
        {
            string statusMessage = string.Empty;

            try
            {
                BookListClass.MailTrigger();
                statusMessage = "Mail Triggered Successfully";
            }
            catch { statusMessage = "Mail Trigger Failed."; }
            return(statusMessage);
        }
Example #2
0
        private void btnAddOK_Click(object sender, EventArgs e)
        {
            int    i = 0;
            string updatedBookFile = "updatedBookFile.txt";

            BookClass     Book     = new BookClass();
            BookListClass BookList = new BookListClass();

            string bookTitle  = txtBookTitleAdd.Text;
            string bookAuthor = txtBookAuthorAdd.Text;

            string[] bookKeywords;
            Book.keywordSplitter(txtBookKeywordAdd.Text, out bookKeywords);
            string[] writtenArray = new string[100];
            string   concatWrite  = "";

            concatWrite += (bookTitle + " ");
            concatWrite += (bookAuthor + " ");
            foreach (string element in bookKeywords)
            {
                concatWrite += (element + " ");
            }

            try
            {
                using (StreamWriter w = File.AppendText(updatedBookFile))
                {
                    w.WriteLine(concatWrite + "\n");
                    MessageBox.Show("Book has been added to the list!", "Book Added");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }

            txtBookTitleAdd.Text   = "";
            txtBookAuthorAdd.Text  = "";
            txtBookKeywordAdd.Text = "";
            txtBookTitleAdd.Focus();
        }