Exemplo n.º 1
0
        public void DeleteContact(int id)
        {
            var       connectString = ConfigurationManager.AppSettings["connectString"];
            IMylogger log           = new Log4netUsing();

            var test = new ContactDBWorker(connectString, log);

            test.DeleteContact(id);
        }
Exemplo n.º 2
0
        public void UpdateContact(Contact person)
        {
            var       connectString = ConfigurationManager.AppSettings["connectString"];
            IMylogger log           = new Log4netUsing();

            var test = new ContactDBWorker(connectString, log);

            test.UpdateContact(person);
        }
Exemplo n.º 3
0
        public void CreateContact(Contact person)
        {
            var       connectString = ConfigurationManager.AppSettings["connectString"];
            IMylogger log           = new Log4netUsing();

            var test = new ContactDBWorker(connectString, log);

            /*var test_return = */ test.Create(person);

            //return 1;
        }
Exemplo n.º 4
0
        public List <Contact> GetContactsByLastName(string lastname)
        {
            var connectString  = ConfigurationManager.AppSettings["connectString"];
            var amountRestrict = Convert.ToInt32(ConfigurationManager.AppSettings["amountrestrict"]);

            IMylogger log = new Log4netUsing();

            var test     = new ContactDBWorker(connectString, log);
            var toReturn = test.GetContactsByLastName(lastname);

            toReturn = BubbleSorter.BubbleSorterFN(toReturn);
            toReturn = ListContactSlicer.Slice(toReturn, amountRestrict);
            return(toReturn);
        }
Exemplo n.º 5
0
        public List <Contact> GetContactsByFirstName(string firstname)// чтобы вернуть еще и значение amountRestrict, нужно создать класс GetContactsResponse и добавить туда два поля: List<Contact> и int amountRestrict
        {
            var       connectString  = ConfigurationManager.AppSettings["connectString"];
            var       amountRestrict = Convert.ToInt32(ConfigurationManager.AppSettings["amountrestrict"]);
            IMylogger log            = new Log4netUsing();

            var test = new ContactDBWorker(connectString, log);
            // ДЛЯ КАЖДОГО МЕТОДА СЕРВИСА TRY CATCH
            var toReturn = test.GetContactsByFirstName(firstname);

            toReturn = BubbleSorter.BubbleSorterLN(toReturn);
            toReturn = ListContactSlicer.Slice(toReturn, amountRestrict);
            return(toReturn);
        }
Exemplo n.º 6
0
        public List <Contact> GetContacts()
        {
            var       connectString = ConfigurationManager.AppSettings["connectString"];
            IMylogger log           = new Log4netUsing();

            var            test     = new ContactDBWorker(connectString, log);
            List <Contact> toReturn = new List <Contact>();

            try
            {
                toReturn = test.GetContacts();
            }
            catch (SqlException e)
            {
                log.Info("При считывании всех записей из бд таблицы Person произошла ошибка Детали: " + e.ToString());
            }
            return(toReturn);
        }