Example #1
0
 public DictionaryCountryModel GetCountry(int countryId)
 {
     {
         DictionaryCountry      country       = _dbContext.DictionaryCountry.Where(a => a.DictionaryCountryId == countryId).FirstOrDefault();
         DictionaryCountryModel countryModels = new DictionaryCountryModel();
         countryModels.DictionaryCountryId   = country.DictionaryCountryId;
         countryModels.DictionaryCountryName = country.DictionaryCountryName;
         countryModels.Code = country.DictionaryCountryCode;
         return(countryModels);
     }
 }
Example #2
0
        public DictionaryCountryModel GetCountry(int countryId)
        {
            SqlCommand sqlCommand = _sqlConnection.CreateCommand();

            sqlCommand.CommandText = "select dc.DictionaryCountryName as Name, dc.DictionaryCountryCode as Code " +
                                     "from DictionaryCountry dc " +
                                     "where dc.DictionaryCountryId = @countryId";
            sqlCommand.Parameters.Add("@countryId", SqlDbType.Int).Value = countryId;
            SqlDataReader          sqlDataReader = sqlCommand.ExecuteReader();
            DictionaryCountryModel countryModel  = new DictionaryCountryModel();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                countryModel.DictionaryCountryId   = countryId;
                countryModel.DictionaryCountryName = sqlDataReader.GetString("Name");
                countryModel.Code = sqlDataReader.GetString("Code");
            }
            return(countryModel);
        }
Example #3
0
        public AddEvent(int editnew, MainForm form, AddConferenceDetailModel addConferenceDetailModel, IGetSpeakerDetail GetSpeakerDetail,
                        IConferenceTypeRepository ConferenceTypeRepository, IConferenceRepository ConferenceRepository,
                        IDictionaryCityRepository dictionaryCityRepository, IDictionaryCountryRepository DictionaryCountryRepository,
                        IDictionaryCountyRepository DictionaryCountyRepository, IDictionaryConferenceCategoryRepository DictionaryConferenceCategoryRepository,
                        ILocationRepository locationRepository)
        {
            InitializeComponent();
            tabType.Hide();
            EditNew = editnew;

            AddConferenceDetailModel = new AddConferenceDetailModel();
            AddConferenceDetailModel = addConferenceDetailModel;

            eventDetails = new AddEventDetailModel();


            var_email = AddConferenceDetailModel.HostEmail;
            formMain  = form;
            f         = this; // Current form to use in New/Edit Form
            _DictionaryCountyRepository             = DictionaryCountyRepository;
            _GetSpeakerDetail                       = GetSpeakerDetail;
            _DictionaryCountryRepository            = DictionaryCountryRepository;
            _ConferenceRepository                   = ConferenceRepository;
            _DictionaryConferenceCategoryRepository = DictionaryConferenceCategoryRepository;
            _LocationRepository                     = locationRepository;
            List <SpeakerDetailModel>     speakers  = GetSpeakers().Result;
            List <DictionaryCountryModel> countries = GetDictionaryCountry().Result;

            countys = GetDictionaryCounty().Result;
            List <DictionaryConferenceCategoryModel> categories = GetDictionaryCategory().Result;

            _ConferenceTypeRepository = ConferenceTypeRepository;
            x = GetConferenceType().Result;

            if (countries == null)
            {
                return;
            }
            else
            {
                populateCountry(countries);
            }
            if (categories == null)
            {
                return;
            }
            else
            {
                populateCategory(categories);
            }
            if (speakers == null)
            {
                return;
            }

            if (countys == null)
            {
                return;
            }

            populateSpeakers(speakers);

            _DictionaryCityRepository = dictionaryCityRepository;
            cityList = GetCity().Result;
            if (cityList == null || cityList.Count() == 0)
            {
                return;
            }


            if (x == null || x.Count() == 0)
            {
                return;
            }
            listView1_populate();

            eventDetails.HostEmail = var_email;
            eventDetails.StartDate = AddStartDate.Value;
            eventDetails.EndDate   = AddEndDate.Value;

            if (editnew == 0)
            {
                eventDetails.DictionaryCityName = addConferenceDetailModel.Location;
                eventDetails.ConferenceId       = addConferenceDetailModel.ConferenceId;
                DictionaryCityModel city = GetCity(eventDetails.ConferenceId).Result;
                eventDetails.DictionaryCityId   = city.DictionaryCityId;
                eventDetails.DictionaryCityName = city.Name;
                eventDetails.DictionaryCityCode = city.Code;
                eventDetails.DictionaryCountyId = city.DictionaryCountyId;
                DictionaryCountyModel county = GetCounty(eventDetails.DictionaryCountyId).Result;
                eventDetails.DictionaryCountyName = county.DictionaryCountyName;
                eventDetails.DictionaryCountyCode = county.Code;
                eventDetails.DictionaryCountryId  = county.DictionaryCountryId;
                DictionaryCountryModel country = GetCountry(eventDetails.DictionaryCountryId).Result;
                eventDetails.DictionaryCountryName = country.DictionaryCountryName;
                eventDetails.DictionaryCountryCode = country.Code;
                eventDetails.ConferenceName        = addConferenceDetailModel.ConferenceName;
                eventDetails.ConferenceTypeName    = addConferenceDetailModel.ConferenceTypeName;
                eventDetails.EndDate     = addConferenceDetailModel.EndDate;
                eventDetails.StartDate   = addConferenceDetailModel.StartDate;
                eventDetails.SpeakerName = addConferenceDetailModel.Speaker;
                eventDetails.DictionaryConferenceCategoryName = addConferenceDetailModel.ConferenceCategoryName;
                DictionaryConferenceCategoryModel category = GetCategory(eventDetails.ConferenceId).Result;
                eventDetails.DictionaryConferenceCategoryId = category.DictionaryConferenceCategoryId;
                eventDetails.LocationName = addConferenceDetailModel.Location;

                AddConferenceName.Text = eventDetails.ConferenceName;
                AddAddress.Text        = eventDetails.LocationName;
                AddStartDate.Value     = eventDetails.StartDate;
                AddEndDate.Value       = eventDetails.EndDate;
                ToSelectItem();
            }
        }
Example #4
0
        public IActionResult GetDictionaryCountry(int obj)
        {
            DictionaryCountryModel countries = _countryRepository.GetCountry(obj);

            return(Ok(countries));
        }