예제 #1
0
        public List <UserSessionFilterEntity> Adapt(DataTable dt)
        {
            List <UserSessionFilterEntity> results = new List <UserSessionFilterEntity>();

            foreach (DataRow rw in dt.Rows)
            {
                UserSessionFilterEntity session = new UserSessionFilterEntity();
                session = AdaptItem(rw, dt);
                results.Add(session);
            }
            return(results);
        }
예제 #2
0
        public UserSessionFilterEntity AdaptItem(DataRow rw, DataTable dt)
        {
            UserSessionFilterEntity result = new UserSessionFilterEntity();

            if (dt.Columns.Contains("UserId"))
            {
                result.UserId = SafeHelper.GetSafeint(rw["UserId"]);
            }

            if (dt.Columns.Contains("SrcRecordId"))
            {
                result.SrcRecordId = SafeHelper.GetSafestring(rw["SrcRecordId"]);
            }

            if (dt.Columns.Contains("CompanyName"))
            {
                result.CompanyName = SafeHelper.GetSafestring(rw["CompanyName"]);
            }

            if (dt.Columns.Contains("City"))
            {
                result.City = SafeHelper.GetSafestring(rw["City"]);
            }

            if (dt.Columns.Contains("State"))
            {
                result.State = SafeHelper.GetSafestring(rw["State"]);
            }

            if (dt.Columns.Contains("CountryISOAlpha2Code"))
            {
                result.CountryISOAlpha2Code = SafeHelper.GetSafestring(rw["CountryISOAlpha2Code"]);
            }

            if (dt.Columns.Contains("CountryISOAlpha2Code"))
            {
                result.CountryISOAlpha2Code = SafeHelper.GetSafestring(rw["CountryISOAlpha2Code"]);
            }

            if (dt.Columns.Contains("OrderByColumn"))
            {
                result.OrderByColumn = SafeHelper.GetSafestring(rw["OrderByColumn"]);
            }

            if (dt.Columns.Contains("FilterText"))
            {
                result.FilterText = SafeHelper.GetSafestring(rw["FilterText"]);
            }

            if (dt.Columns.Contains("FilterExists"))
            {
                result.FilterExists = SafeHelper.GetSafebool(rw["FilterExists"]);
            }

            if (dt.Columns.Contains("Tag"))
            {
                result.Tag = SafeHelper.GetSafestring(rw["Tag"]);
            }

            if (dt.Columns.Contains("CountryGroupId"))
            {
                result.CountryGroupId = SafeHelper.GetSafeint(rw["CountryGroupId"]);
            }

            if (dt.Columns.Contains("ImportProcess"))
            {
                result.ImportProcess = SafeHelper.GetSafestring(rw["ImportProcess"]);
            }

            if (dt.Columns.Contains("ErrorCode"))
            {
                result.ErrorCode = SafeHelper.GetSafestring(rw["ErrorCode"]);
            }

            return(result);
        }