示例#1
0
        public IQueryable <Country> GetAll()
        {
            CountryDAL           dalObject = new CountryDAL();
            IQueryable <Country> results   = dalObject.GetAll();

            return(results);
        }
示例#2
0
 public void GetDataSources()
 {
     ViewData["Nationality"] = NationalityDAL.GetNationalitysComboList();
     ViewData["Country"]     = CountryDAL.GetCountrysComboList();
     ViewData["Education"]   = EnumDAL.GetEnumsComboList(EnumType.Education.ToString());
     ViewData["Gender"]      = EnumDAL.GetEnumsComboList(EnumType.Geneder.ToString());
 }
示例#3
0
        public void GetCountries_GetCountriesFromNonEmptyTable_ReturnsTableWithList()
        {
            ICountryDAL     countryDAL  = new CountryDAL(new DBService(new DbConnectionService(_connectionStringName)));
            List <ICountry> countryList = countryDAL.GetCountries().ToList();

            Assert.IsTrue(countryList.Count() == DbSeeder.countryList.Count());
        }
示例#4
0
        public IQueryable <Country> FindBy(System.Linq.Expressions.Expression <Func <Country, bool> > predicate)
        {
            CountryDAL           dalObject = new CountryDAL();
            IQueryable <Country> results   = dalObject.FindBy(predicate);

            return(results);
        }
示例#5
0
        static public List <Country> GetAllBind()
        {
            DataTable      dt            = CountryDAL.GetAll();
            List <Country> CountriesList = GenericConvertDataTableToList.ConvertDataTable <Country>(dt);

            return(CountriesList);
        }
示例#6
0
        public void GetCountries_GetCountriesFromEmptyTable_ReturnsEmptyTable()
        {
            _dbSeeder.EmptyTables();
            ICountryDAL            countryDAL  = new CountryDAL(new DBService(new DbConnectionService(_connectionStringName)));
            IEnumerable <ICountry> countryList = countryDAL.GetCountries();

            Assert.IsTrue(countryList.Count() == 0);
        }
示例#7
0
        private void LoadCountry()
        {
            CountryDAL countryDAL = new CountryDAL();

            ddlCountryCode.DataSource     = countryDAL.SelectAll();
            ddlCountryCode.DataTextField  = "Name";
            ddlCountryCode.DataValueField = "Code";
            ddlCountryCode.DataBind();
        }
        public async Task <ICountryModel> IndexAsync(HttpContext context, CancellationToken cancellationToken, string CountryId)
        {
            _dal = new CountryDAL();
            ICountryModel model = await _dal.SelectByIDAsync(Convert.ToInt64(CountryId), userId, cancellationToken);

            await PoulateDropDownListAsync(model, cancellationToken);

            return(model);
        }
示例#9
0
 public static void Initialize(string connectionString)
 {
     SupplierDB         = new SupplierDAL(connectionString);
     CustomerDB         = new CustomerDAL(connectionString);
     ShipperDB          = new ShipperDAL(connectionString);
     CategoryDB         = new CategoryDAL(connectionString);
     ProductDB          = new ProductDAL(connectionString);
     ProductAttributeDB = new ProductAttributeDAL(connectionString);
     AttributeDB        = new AttributeDAL(connectionString);
     CountryDB          = new CountryDAL(connectionString);
 }
示例#10
0
 public bool Delete(Countries country)
 {
     try
     {
         CountryDAL countryDAL = new CountryDAL();
         return(countryDAL.Delete(country));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#11
0
        /// <summary>
        /// Date Created:   19/10/2012
        /// Created By:     Josephine Gad
        /// (description)   Get the generic class of country
        /// </summary>
        public static void GetRestrictedNationalityList(bool IsViewBoth, bool IsRestricted, int CountryID)
        {
            List <NationalityGenericClass> list = new List <NationalityGenericClass>();

            list = CountryDAL.GetRestrictedNationalityList(IsViewBoth, IsRestricted, CountryID);
            if (IsViewBoth)
            {
                HttpContext.Current.Session["NationalityGenericClass_NonRestNationalityList"] = list[0].NonRestNationalityList;
                HttpContext.Current.Session["NationalityGenericClass_RestNationalityList"]    = list[0].RestNationalityList;
                HttpContext.Current.Session["NationalityGenericClass_RestNationalityCount"]   = list[0].RestNationalityCount;
            }
        }
示例#12
0
        static void PrintCountries()
        {
            var countryDAL       = new CountryDAL(_iconfiguration);
            var listCountryModel = countryDAL.GetList();

            listCountryModel.ForEach(item =>
            {
                Console.WriteLine(item.Country);
            });
            Console.WriteLine("Press any key to stop.");
            Console.ReadKey();
        }
示例#13
0
 public DataTable GetAll()
 {
     try
     {
         CountryDAL countryDAL = new CountryDAL();
         return(countryDAL.GetAll());
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#14
0
 public DataTable GetById(int id)
 {
     try
     {
         CountryDAL countryDAL = new CountryDAL();
         return(countryDAL.GetById(id));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#15
0
        public Boolean Delete(SqlInt32 CountryID)
        {
            CountryDAL dalCountry = new CountryDAL();

            if (dalCountry.Delete(CountryID))
            {
                return(true);
            }
            else
            {
                Message = dalCountry.Message;
                return(false);
            }
        }
示例#16
0
        public void InitializeValues()
        {
            LookupCity.Properties.ValueMember   = "CityID";
            LookupCity.Properties.DisplayMember = "CityName";

            LookupState.Properties.ValueMember   = "StateID";
            LookupState.Properties.DisplayMember = "StateName";

            CountryDAL CountryDAL = new CountryDAL();

            LookupCountry.Properties.ValueMember   = "CountryID";
            LookupCountry.Properties.DisplayMember = "CountryName";
            LookupCountry.Properties.DataSource    = CountryDAL.GetEditList();
        }
示例#17
0
 public ResultBM GetCountries()
 {
     try
     {
         CountryDAL        countryDal   = new CountryDAL();
         List <CountryDTO> countriesDto = countryDal.GetCountries();
         List <CountryBM>  countriesBm  = ConvertIntoBusinessModel(countriesDto);
         return(new ResultBM(ResultBM.Type.OK, "Recuperación de registros exitosa.", countriesBm));
     }
     catch (Exception exception)
     {
         return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception));
     }
 }
示例#18
0
        public Boolean Update(CountryENT entCountry)
        {
            CountryDAL dalCountry = new CountryDAL();

            if (dalCountry.Update(entCountry))
            {
                return(true);
            }
            else
            {
                Message = dalCountry.Message;
                return(false);
            }
        }
示例#19
0
        private void ContractorManagement_Load(object sender, EventArgs e)
        {
            ContractorDAL contractor = new ContractorDAL();

            _contractorsDs = contractor.getContractorsPresentationDs();
            DataView dv = _contractorsDs.Tables[0].DefaultView;

            dv.RowFilter             = "IsDeleted = 0";
            dgContractors.DataSource = dv;
            combCountries.DataSource = CountryDAL.GetCountries();
            btAddNewContractor.Focus();
            _contractorAdapter = contractor.getContractorAdapter();
            this.dgContractors.SelectionChanged += new EventHandler(dgContractors_SelectionChanged);
            isDirty = false;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             ddlCountries.DataSource = CountryDAL.GetAllCountry();
             ddlCountries.DataBind();
         }
     }
     catch (Exception ex)
     {
         lbMsg.Text = "error";
         AppLogger.WriteLog(ex.ToString());
     }
 }
示例#21
0
        public bool InsertCountry(Country data)
        {
            int        nRows     = 0;
            CountryDAL dbCountry = new CountryDAL();

            nRows = dbCountry.InsertCountry(data);
            if (nRows != -1)
            {
                return(true);
            }
            else
            {
                ErrorMessage = dbCountry.ErrorMessage;
                return(false);
            }
        }
示例#22
0
        /// <summary>
        /// Devuelve el país para el iso2 requerido
        /// </summary>
        /// <param name="iso2"></param>
        /// <returns></returns>
        public ResultBM GetCountry(string iso2)
        {
            try {
                CountryDAL countryDal = new CountryDAL();
                CountryDTO countryDto = countryDal.GetCountry(iso2);
                CountryBM  countryBm  = null;

                if (countryDto != null)
                {
                    countryBm = new CountryBM(countryDto);
                }

                return(new ResultBM(ResultBM.Type.OK, "Operación exitosa.", countryBm));
            }
            catch (Exception exception) {
                return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception));
            }
        }
示例#23
0
        public List <CountryMaster> GetData(CountryMasterFilter objFilter, bool prevFilter = false)
        {
            CountryDAL objCntDAL = null;

            try
            {
                objCntDAL = new CountryDAL();
                SetCountryFilter(objFilter, prevFilter);
                return(objCntDAL.Get(objFilter));
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objCntDAL = null;
            }
        }
示例#24
0
        public bool Save(Countries country)
        {
            try
            {
                CountryDAL countryDAL = new CountryDAL();

                if (IsNameExist(country))
                {
                    throw new Exception("Name already exist.");
                }
                else
                {
                    return(countryDAL.Save(country));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static List <Country> GetAllCountry()
        {
            List <Country> CountryList = new List <Country>();

            using (SqlDataReader reader = CountryDAL.GetAllCountry())
            {
                while (reader.Read())
                {
                    Country item = new Country();
                    item.CountryId = Convert.ToInt32(reader["CountryId"]);
                    item.Name      = reader["Name"].ToString();
                    item.Code      = reader["Code"].ToString();
                    item.Visible   = Convert.ToBoolean(reader["Visible"]);
                    item.OrderNo   = Convert.ToInt32(reader["OrderNo"]);
                    CountryList.Add(item);
                }
            }

            return(CountryList);
        }
示例#26
0
 ///// <summary>
 ///// Date Create:    15/08/2011
 ///// Create By:      Josephine Gad
 ///// (description)   Get Region List
 ///// </summary>
 //public static DataTable RegionList()
 //{
 //    DataTable RegionDataTable = null;
 //    try
 //    {
 //        RegionDataTable = CountryDAL.RegionList();
 //        return RegionDataTable;
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //    finally
 //    {
 //        if (RegionDataTable != null)
 //        {
 //            RegionDataTable.Dispose();
 //        }
 //    }
 //}
 /// <summary>
 /// Date Create:    15/08/2011
 /// Create By:      Josephine Gad
 /// (description)   Get Region List By UserID
 /// ----------------------------------
 /// Date Modified:   25/05/2012
 /// Modified By:     Josephine Gad
 /// (description)    Remove Country parameter
 ///                  Change Datatable to List
 /// </summary>
 /// </summary>
 public static List <RegionList> RegionListByUser(string UserID)
 {
     return(CountryDAL.RegionListByUser(UserID));
     //DataTable RegionDataTable = null;
     //try
     //{
     //    RegionDataTable = CountryDAL.RegionListByUser(UserID, CountryID);
     //    return RegionDataTable;
     //}
     //catch (Exception ex)
     //{
     //    throw ex;
     //}
     //finally
     //{
     //    if (RegionDataTable != null)
     //    {
     //        RegionDataTable.Dispose();
     //    }
     //}
 }
示例#27
0
        /// <summary>
        /// Date Created:  15/08/2011
        /// Created By:    Josephine Gad
        /// (description)  Get Country List by user
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static DataTable CountryListByUser(string UserID)
        {
            DataTable CountryDataTable = null;

            try
            {
                CountryDataTable = CountryDAL.CountryListByUser(UserID);
                return(CountryDataTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (CountryDataTable != null)
                {
                    CountryDataTable.Dispose();
                }
            }
        }
示例#28
0
        /// <summary>
        /// Date Created:   15/07/2011
        /// Created By:     Ryan Bautista
        /// (description)   Selecting Country List
        /// ========================================
        /// Date Modified:  15/08/2011
        /// Modified By:    Josephine Gad
        /// (description)   Dispose DataTable
        /// </summary>
        /// </summary>
        public static DataTable CountryList()
        {
            DataTable CityDataTable = null;

            try
            {
                CityDataTable = CountryDAL.CountryList();
                return(CityDataTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (CityDataTable != null)
                {
                    CityDataTable.Dispose();
                }
            }
        }
示例#29
0
        /// <summary>
        /// Date Created:    23/09/2011
        /// Created By:      Josephine Gad
        /// (description)    Get Country List by Region ID
        /// </summary>
        /// <param name="RegionID"></param>
        /// <returns></returns>
        public static DataTable CountryListByRegion(string RegionID, string CountryName)
        {
            DataTable CountryDataTable = null;

            try
            {
                CountryDataTable = CountryDAL.CountryListByRegion(RegionID, CountryName);
                return(CountryDataTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (CountryDataTable != null)
                {
                    CountryDataTable.Dispose();
                }
            }
        }
示例#30
0
        public async Task <ICountryModel> SaveAsync(HttpContext context, ICountryModel model, CancellationToken cancellationToken)
        {
            _dal = new CountryDAL();

            model.UserId = userId;

            if (model.CountryId > 0)
            {
                context.Items[Constant.QuerySuccess] = Convert.ToBoolean(await _dal.UpdateAsync(model, cancellationToken));
                context.Items[Constant.FormTitle]    = "EDIT Country";
            }
            else
            {
                model.CountryId = await _dal.SaveAsync(model, cancellationToken);

                context.Items[Constant.QuerySuccess] = Convert.ToBoolean(model.CountryId);
                context.Items[Constant.FormTitle]    = "ADD Country";
            }
            await PoulateDropDownListAsync(model, cancellationToken);

            return(model);
        }