Пример #1
0
        // =====================================================
        public static string isSameAuthor(Author author1, Author author2, bool CompareAndMiddleName)
        {
            string fio1 = (author1.FirstName != null ? author1.FirstName.Value : "") + "\t"
                          + (author1.MiddleName != null ? author1.MiddleName.Value : "") + "\t"
                          + author1.LastName != null ? author1.LastName.Value : "";
            string fio2 = (author2.FirstName != null ? author2.FirstName.Value : "") + "\t"
                          + (author2.MiddleName != null ? author2.MiddleName.Value : "") + "\t"
                          + author2.LastName != null ? author2.LastName.Value : "";

            if (author1.isSameAuthor(author2, CompareAndMiddleName))
            {
                return("Одинаковые:\n\n" + "fio1: " + fio1 + "\nfio2: " + fio2);
            }
            else
            {
                return("Нет:\n\n" + "fio1: " + fio1 + "\nfio2: " + fio2);
            }
        }
Пример #2
0
        public static void gebugTestIsSameAuthor(bool CompareAndMiddleName)
        {
            TextFieldType  FirstName1   = new TextFieldType("Иван");
            TextFieldType  MiddleName1  = new TextFieldType("Петрович");
            TextFieldType  LastName1    = new TextFieldType("Кузнецов");
            TextFieldType  NickName1    = new TextFieldType("NNNnnNNN");
            string         m_sID1       = "HGFYTF7HJGJGJHKJ";
            IList <string> lsHomePages1 = new List <string>();

            lsHomePages1.Add("111");
            lsHomePages1.Add("222");
            IList <string> lsEmails1 = new List <string>();

            lsEmails1.Add("111");
            lsEmails1.Add("222");

            TextFieldType FirstName2  = new TextFieldType("Иван");
            TextFieldType MiddleName2 = new TextFieldType("Петрович");
            TextFieldType LastName2   = new TextFieldType("Кузнецов");
            TextFieldType NickName2   = new TextFieldType("NNNnnNNN");
//			string			m_sID2 = "HGFYTF7HJGJGJHKJ";
            IList <string> lsHomePages2 = new List <string>();

            lsHomePages2.Add("111");
            lsHomePages2.Add("222");
            IList <string> lsEmails2 = new List <string>();

            lsEmails2.Add("111");
            lsEmails2.Add("222");
            Author author1 = new Author(FirstName1, MiddleName1, LastName1, NickName1, lsHomePages1, lsEmails1, m_sID1);
            Author author2 = new Author(FirstName2, MiddleName2, LastName2);

            if (author1.isSameAuthor(author2, CompareAndMiddleName))
            {
                MessageBox.Show("Да", "Test - Author", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Нет", "Test - Author", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }