Пример #1
0
        public IEnumerable <VideoNew> GetAll()
        {
            {
                Func <IEnumerable <VideoNew> > func = new Func <IEnumerable <VideoNew> >(() =>
                {
                    var result = _entity.VideoNew.Where(e => e.StatVoid == 0)
                                 .ToList();
                    return(result);

                    //var result = _entity.VideoNew.Where(e => e.StatVoid == 0)
                    //.Select(e =>  new VideoNew {
                    //    Num=e.Num,
                    //    CreateBy=e.CreateBy,
                    //    Demo=e.Demo,
                    //    DtCreate=e.DtCreate,
                    //    DtUpdate=e.DtUpdate,
                    //    Title=e.Title,
                    //    UpdateBy=e.UpdateBy,
                    //    Uptime=e.Uptime,
                    //    Url=e.Url,
                    //    StatVoid=e.StatVoid}).ToList();
                    //return result;
                });

                return(_adapter.Catch <IEnumerable <VideoNew> >(func));
            }
        }
Пример #2
0
        public SolutionNew Get(int num)
        {
            Func <SolutionNew> func = new Func <SolutionNew>(() => {
                var result = _entity.SolutionNew
                             .Where(e => e.Num == num &&
                                    e.StatVoid == 0).ToList().FirstOrDefault();
                return(result);
            });

            return(_adapter.Catch <SolutionNew>(func));
        }
Пример #3
0
        /// <summary>
        /// 後臺用
        /// </summary>
        /// <param name="lang_type"></param>
        /// <returns></returns>
        public IEnumerable <carousel_present> GetAll(int lang_type)
        {
            {
                Func <IEnumerable <carousel_present> > func = new Func <IEnumerable <carousel_present> >(() => {
                    var result = _entity.CarouselNew.Where(
                        e => e.StatVoid == 0 &&
                        e.LangType == lang_type

                        ).OrderBy(e => e.Sort).
                                 Select(e => new carousel_present
                    {
                        num          = e.Num,
                        slogan       = e.Slogan,
                        pic1         = e.Pic1,
                        sort         = (int)e.Sort,
                        url_type     = (int)e.UrlType,
                        link         = e.Link,
                        youtbue_code = e.YoutubeCode,
                        popup_img    = e.PopupImg,
                        popup_link   = e.PopupLink,
                    }).ToList();

                    return(result);
                });

                return(_adapter.Catch <IEnumerable <carousel_present> >(func));
            }
        }
Пример #4
0
        public AdminNew GetEmp(string emp_no)
        {
            using (entity)
            {
                Func <AdminNew> func = new Func <AdminNew>(() => {
                    //entity._optionsBuilder.UseSqlServer(Location);

                    var result = entity.AdminNew.Where(e => e.UId == emp_no && e.StatVoid == 0).ToList().FirstOrDefault();
                    return(result);
                });

                return(_adapter.Catch <AdminNew>(func));
            }
        }
Пример #5
0
        public NewsNew Get(int num)
        {
            {
                Func <NewsNew> func = new Func <NewsNew>(() =>
                {
                    var result = _entity.NewsNew.Where(e => e.Num == num && e.StatVoid == 0).FirstOrDefault();

                    return(result);
                });

                return(_adapter.Catch <NewsNew>(func));
            }
        }
Пример #6
0
        public IEnumerable <news_kind_present> GetAllCategory(int lang_type)
        {
            {
                Func <IEnumerable <news_kind_present> > func = new Func <IEnumerable <news_kind_present> >(() =>
                {
                    var result = _entity.NewsKindNew
                                 .Where(e => e.StatVoid == 0 && e.LangType == lang_type && e.Root == 0)
                                 .OrderBy((e) => e.Range)
                                 .Select(e => new news_kind_present()
                    {
                        num  = e.Num,
                        kind = e.Kind
                    })
                                 .ToList();
                    return(result);
                });

                return(_adapter.Catch <IEnumerable <news_kind_present> >(func));
            }
        }
Пример #7
0
        /// <summary>
        /// 首頁的產品分類
        /// </summary>
        /// <param name="lang"></param>
        /// <returns></returns>
        public IEnumerable <solution_kind_present> GetAllCategory(int lang_type)
        {
            //
            //{
            Func <IEnumerable <solution_kind_present> > func = new Func <IEnumerable <solution_kind_present> >(() =>
            {
                //_entity._optionsBuilder = new DbContextOptionsBuilder();

                //_entity._optionsBuilder.UseSqlServer(this._adapter.DbString);

                var result = _entity.SolutionKindNew
                             .Where(e => e.StatVoid == 0 &&
                                    e.LangType == lang_type &&
                                    e.Root == 0 &&
                                    e.StatVoid == 0)
                             .OrderBy((e) => e.Range)
                             .Select(e => new solution_kind_present()
                {
                    num  = e.Num,
                    kind = e.Kind
                }).ToList();
                return(result);
            });

            return(_adapter.Catch <IEnumerable <solution_kind_present> >(func));
            //}
        }
Пример #8
0
        /// <summary>
        /// 首頁的產品分類
        /// </summary>
        /// <param name="lang"></param>
        /// <returns></returns>
        public IEnumerable <pro_kind_present> GetAllCategory(int lang_type)
        {
            {
                Func <IEnumerable <pro_kind_present> > func = new Func <IEnumerable <pro_kind_present> >(() =>
                {
                    var result = _entity.ProKindNew
                                 .Where(e => e.StatVoid == 0 &&
                                        e.LangType == lang_type && e.Root == 0)
                                 .OrderBy((e) => e.Range)
                                 .Select(e => new pro_kind_present()
                    {
                        num       = e.Num,
                        kind      = e.Kind,
                        ispresent = (e.Ispresent == null) ? 0 : (int)e.Ispresent,
                        pic       = e.Pic1,
                    })
                                 .ToList();
                    return(result);
                });

                return(_adapter.Catch <IEnumerable <pro_kind_present> >(func));
            }
        }