Beispiel #1
0
        public Dictionary <string, string> InsertTblRegisteredStudents(DataTable StudentRegistrationData, int EventID, string EventName)
        {
            // EventRegistrationDAL eventRegistration = new EventRegistrationDAL();
            Dictionary <String, String> returnData = new Dictionary <String, String>();
            List <String> EmailList = new List <String>();
            Dictionary <String, String> studentsInsertReturnValue = _eventRegistrationDal.InsertTblRegisteredStudents(StudentRegistrationData);

            foreach (var item in studentsInsertReturnValue.Keys)
            {
                if (studentsInsertReturnValue[item].Equals("Invalid Data"))
                {
                    returnData.Add(item, studentsInsertReturnValue[item]);
                }
                else
                {
                    EmailList.Add(item);
                }
            }
            if (EmailList.Count > 0)
            {
                var AttenddesInsertList = _eventRegistrationDal.InsertTblEventAttendees(EmailList, EventID);
                if (AttenddesInsertList.Count > 0)
                {
                    _mailSend.SendRegistrationMail(AttenddesInsertList, EventID);
                    Debug.Print("Succesfully added data into Attendees Table");
                }
                else
                {
                    Debug.Print("Could not insert data into Attendees Table");
                }
            }
            else
            {
                Debug.Print("Could not insert data into Registration Table");
            }
            return(returnData);
        }
        public List <String> InsertTblRegisteredStudents(DataTable StudentRegistrationData, int EventID, string EventName)
        {
            EventRegistrationDAL eventRegistration         = new EventRegistrationDAL();
            List <String>        studentsInsertReturnValue = eventRegistration.InsertTblRegisteredStudents(StudentRegistrationData);

            if (studentsInsertReturnValue.Count > 0)
            {
                var AttenddesInsertList = eventRegistration.InsertTblEventAttendees(studentsInsertReturnValue, EventID);
                if (AttenddesInsertList.Count > 0)
                {
                    _mailSend.SendRegistrationMail(AttenddesInsertList, EventID);
                    Debug.Print("Succesfully added data into Attendees Table");
                }
                else
                {
                    Debug.Print("Could not insert data into Attendees Table");
                }
            }
            else
            {
                Debug.Print("Could not insert data into Registration Table");
            }
            return(studentsInsertReturnValue);
        }