Exemplo n.º 1
0
        /// <summary>
        /// p.s mapping column use hard code ,remember to rewrite this scope-ok
        /// p.s maybe can use Polytype to solve parse diffrent table by excel
        /// p.s use DI container put this class abstact-ok
        /// p.s maybe can use Polytype to solve parse dirffrent typ by txt excel csv-ok
        /// put error message in list and response it on web page
        /// </summary>
        /// <param name="filePath"></param>
        private IQueryable <Pos> parse(string filePath)
        {
            string   _Ext   = Path.GetExtension(filePath);
            int      _Model = HttpContext.Current.Request["Model"].ToString() != "" ? Convert.ToInt32(HttpContext.Current.Request["Model"].ToString()) : 0;
            FileBase _Base  = _fileAdapterFactory.CreateFileAdapter(_Ext);
            // IQueryable<PosData> _PosData = _Base.Parse(_Model, filePath);
            IQueryable <Pos> _Pos = _Base.ParsePos(_Model, filePath);

            if (_Base.ListError.Count() != 0)
            {
                string _Error = string.Join("\r\n", _Base.ListError.ToArray());
                throw new Exception(_Error);
            }
            return(_Pos);
        }