• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EcommercePlatformDataContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EcommercePlatformDataContext的典型用法代码示例。如果您正苦于以下问题:C# EcommercePlatformDataContext类的具体用法?C# EcommercePlatformDataContext怎么用?C# EcommercePlatformDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EcommercePlatformDataContext类属于命名空间,在下文中一共展示了EcommercePlatformDataContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetGeoLocation

        public static GeocodingResponse GetGeoLocation(string city, int stateID, string zip, string countryCode = "US", string StateProvidence = "") {
            try {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                string abbr = "";
                if (stateID != 0) {
                    State state = db.States.Where(x => x.stateID.Equals(stateID)).FirstOrDefault();
                    abbr = state.abbr;
                    countryCode = state.Country.abbr;
                } else {
                    abbr = StateProvidence;
                }

                string url = "https://maps.googleapis.com/maps/api/geocode/json?address=";
                url += HttpUtility.UrlEncode(city + ", " + abbr + " " + zip + " " + countryCode);
                url += "&sensor=false";

                WebClient wc = new WebClient();
                wc.Proxy = null;
                string resp = wc.DownloadString(url);
                GeocodingResponse geo = new JavaScriptSerializer().Deserialize<GeocodingResponse>(resp);

                return geo;
            } catch (Exception) {
                return new GeocodingResponse();
            }
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:26,代码来源:Geocoding.cs


示例2: GetAll

 public static List<PrettyLocation> GetAll() {
     List<PrettyLocation> locs = new List<PrettyLocation>();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     locs = (from l in db.Locations
             join s in db.States on l.stateID equals s.stateID
             select new PrettyLocation {
                 locationID = l.locationID,
                 name = l.name,
                 phone = l.phone,
                 fax = l.fax,
                 email = l.email,
                 address = l.address,
                 city = l.city,
                 stateID = l.stateID,
                 zip = l.zip,
                 isPrimary = l.isPrimary,
                 latitude = l.latitude,
                 longitude = l.longitude,
                 places_id = l.places_id,
                 places_reference = l.places_reference,
                 places_status = l.places_status,
                 foursquare_id = l.foursquare_id,
                 abbr = s.abbr,
                 state = s.state1,
                 Services = (from serv in db.Services
                             join ls in db.LocationServices on serv.ID equals ls.serviceID
                             where ls.locationID.Equals(l.locationID)
                             select serv).ToList<Service>()
             }).OrderBy(x => x.locationID).ToList<PrettyLocation>();
     return locs;
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:31,代码来源:Location.cs


示例3: Get

        public static CommentWithPost Get(int id = 0)
        {
            try
            {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                CommentWithPost comment = new CommentWithPost();

                comment = (from c in db.Comments
                           where c.commentID.Equals(id)
                           select new CommentWithPost
                           {
                               commentID = c.commentID,
                               blogPostID = c.blogPostID,
                               name = c.name,
                               email = c.email,
                               comment_text = c.comment_text,
                               createdDate = c.createdDate,
                               approved = c.approved,
                               active = c.active,
                               post = (from p in db.BlogPosts where p.blogPostID.Equals(c.blogPostID) select p).First<BlogPost>()
                           }).First<CommentWithPost>();

                return comment;
            }
            catch {
                return new CommentWithPost();
            }
        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:28,代码来源:BlogComment.cs


示例4: GetAll

        public static List<CommentWithPost> GetAll()
        {
            try
            {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                List<CommentWithPost> comments = new List<CommentWithPost>();

                comments = (from c in db.Comments
                        where c.active.Equals(true)
                        orderby c.approved, c.createdDate
                        select new CommentWithPost
                        {
                            commentID = c.commentID,
                            blogPostID = c.blogPostID,
                            name = c.name,
                            email = c.email,
                            comment_text = c.comment_text,
                            createdDate = c.createdDate,
                            approved = c.approved,
                            active = c.active,
                            post = (from p in db.BlogPosts where p.blogPostID.Equals(c.blogPostID) select p).First<BlogPost>()
                        }).ToList<CommentWithPost>();

                return comments;
            }
            catch {
                return new List<CommentWithPost>();
            }
        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:29,代码来源:BlogComment.cs


示例5: allowConnection

        public static bool allowConnection(string ipaddress) {
            bool hasPermission = false;
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            hasPermission = db.FTPFirewalls.Where(x => x.ipaddress.Equals(ipaddress.Trim())).Count() > 0;

            return hasPermission;
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:7,代码来源:Firewall.cs


示例6: AddTask

        public ActionResult AddTask(string name = "", string runtime = "", int interval = 0,string url = "")
        {
            try {
                if (url.Trim() == "") {
                    throw new Exception("Task must have a path.");
                }
                if (runtime.Trim() == "" && interval < 1) {
                    throw new Exception("Task must have a run time or an interval greater than 5 minutes.");
                }

                ScheduledTask s = new ScheduledTask {
                    name = name,
                    url = url
                };
                if (runtime.Trim() != "") {
                    DateTime rtime = Convert.ToDateTime(runtime).ToUniversalTime();
                    s.runtime = rtime;
                } else if(interval > 1) {
                    s.interval = interval;
                }
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                db.ScheduledTasks.InsertOnSubmit(s);
                db.SubmitChanges();
            } catch {}
            return RedirectToAction("index");
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:26,代码来源:SchedulerController.cs


示例7: GetAll

        public static List<PostWithCategories> GetAll()
        {
            try {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                List<PostWithCategories> posts = new List<PostWithCategories>();

                posts = (from p in db.BlogPosts
                        where p.active.Equals(true)
                        orderby p.publishedDate, p.createdDate
                        select new PostWithCategories {
                            blogPostID = p.blogPostID,
                            post_title = p.post_title,
                            slug = p.slug,
                            profileID = p.profileID,
                            post_text = p.post_text,
                            publishedDate = p.publishedDate,
                            createdDate = p.createdDate,
                            lastModified = p.lastModified,
                            meta_title = p.meta_title,
                            meta_description = p.meta_description,
                            active = p.active,
                            author = GetAuthor(p.profileID),
                            categories = (from c in db.BlogCategories join pc in db.BlogPost_BlogCategories on c.blogCategoryID equals pc.blogCategoryID where pc.blogPostID.Equals(p.blogPostID) select c).ToList<BlogCategory>(),
                            comments = (from cm in db.Comments where cm.blogPostID.Equals(p.blogPostID) && cm.approved.Equals(true) && cm.active.Equals(true) select cm).ToList<Comment>(),
                            mod_comments = (from cm in db.Comments where cm.blogPostID.Equals(p.blogPostID) && cm.approved.Equals(false) && cm.active.Equals(true) select cm).ToList<Comment>()
                        }).ToList<PostWithCategories>();

                return posts;
               } catch (Exception e) {
                return new List<PostWithCategories>();
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:32,代码来源:BlogPost.cs


示例8: Get

        public static PostWithCategories Get(string date = "", string title = "")
        {
            try {
                DateTime post_date = Convert.ToDateTime(date);
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                PostWithCategories post = new PostWithCategories();
                post = (from p in db.BlogPosts
                         where p.slug.Equals(title) && Convert.ToDateTime(p.publishedDate).Day.Equals(post_date.Day)
                         && Convert.ToDateTime(p.publishedDate).Year.Equals(post_date.Year) && Convert.ToDateTime(p.publishedDate).Month.Equals(post_date.Month)
                         select new PostWithCategories
                         {
                             blogPostID = p.blogPostID,
                             post_title = p.post_title,
                             post_text = p.post_text,
                             slug = p.slug,
                             publishedDate = p.publishedDate,
                             createdDate = p.createdDate,
                             lastModified = p.lastModified,
                             meta_title = p.meta_title,
                             meta_description = p.meta_description,
                             active = p.active,
                             author = GetAuthor(p.profileID),
                             categories = (from c in db.BlogCategories join pc in db.BlogPost_BlogCategories on c.blogCategoryID equals pc.blogCategoryID where pc.blogPostID.Equals(p.blogPostID) select c).ToList<BlogCategory>(),
                             comments = (from cm in db.Comments where cm.blogPostID.Equals(p.blogPostID) && cm.active.Equals(true) && cm.approved.Equals(true) select cm).ToList<Comment>()
                         }).First<PostWithCategories>();

                return post;
            } catch (Exception e) {
                return new PostWithCategories();
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:31,代码来源:Post.cs


示例9: GetAllPublished

        public static List<PostWithCategories> GetAllPublished(int page = 1, int pageSize = 5)
        {
            try
            {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                List<PostWithCategories> posts = new List<PostWithCategories>();

                posts = (from p in db.BlogPosts
                         where p.publishedDate.Value <= DateTime.UtcNow && p.active.Equals(true)
                         orderby p.publishedDate descending
                         select new PostWithCategories
                         {
                             blogPostID = p.blogPostID,
                             post_title = p.post_title,
                             post_text = p.post_text,
                             slug = p.slug,
                             publishedDate = p.publishedDate,
                             createdDate = p.createdDate,
                             lastModified = p.lastModified,
                             keywords = p.keywords,
                             meta_title = p.meta_title,
                             meta_description = p.meta_description,
                             active = p.active,
                             author = GetAuthor(p.profileID),
                             categories = (from c in db.BlogCategories join pc in db.BlogPost_BlogCategories on c.blogCategoryID equals pc.blogCategoryID where pc.blogPostID.Equals(p.blogPostID) select c).ToList<BlogCategory>(),
                             comments = (from cm in db.Comments where cm.blogPostID.Equals(p.blogPostID) && cm.active.Equals(true) && cm.approved.Equals(true) select cm).ToList<Comment>()
                         }).Skip((page - 1) * pageSize).Take(pageSize).ToList();

                return posts;
            }
            catch {
                return new List<PostWithCategories>();
            }
        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:34,代码来源:Post.cs


示例10: GetMonths

        public static List<Archive> GetMonths()
        {
            try {
                EcommercePlatformDataContext db = new EcommercePlatformDataContext();
                List<Archive> archives = new List<Archive>();

                archives = (from p in db.BlogPosts
                            where p.publishedDate.Value != null && p.publishedDate.Value <= DateTime.Now && p.active.Equals(true)
                            orderby p.publishedDate.Value.Year descending, p.publishedDate.Value.Month descending
                            select new Archive
                            {
                                monthnum = Convert.ToInt16(Convert.ToDateTime(p.publishedDate).Month.ToString()),
                                month = Convert.ToDateTime(p.publishedDate).Month.ToString(),
                                year = Convert.ToDateTime(p.publishedDate).Year.ToString()
                            }).Distinct().ToList<Archive>();

                archives = (from a in archives
                            orderby a.year descending, a.monthnum
                            select a).Distinct().ToList<Archive>();

                return archives;
            } catch {
                return new List<Archive>();
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:25,代码来源:Archive.cs


示例11: Populate

 internal Dictionary<string, string> Populate()
 {
     Dictionary<string, string> settings = new Dictionary<string, string>();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     settings = db.Settings.Select(p => new { p.name, p.value }).AsEnumerable().ToDictionary(kvp => kvp.name, kvp => kvp.value);
     return settings;
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:7,代码来源:Settings.cs


示例12: GetAll

 internal static List<Newsletter> GetAll() {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         return db.Newsletters.ToList<Newsletter>();
     } catch (Exception) {
         return new List<Newsletter>();
     }
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:8,代码来源:NewsletterFunctions.cs


示例13: CountAll

 public static int CountAll() {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         return db.Testimonials.Where(x => x.active == true).Where(x => x.approved == true).Count();
     } catch {
         return 0;
     }
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:8,代码来源:Testimonials.cs


示例14: Index

 public ActionResult Index()
 {
     List<FTPFirewall> ipaddresses = new List<FTPFirewall>();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     ipaddresses = db.FTPFirewalls.ToList<FTPFirewall>();
     ViewBag.ipaddresses = ipaddresses;
     return View();
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:8,代码来源:FTPController.cs


示例15: GetAll

 public static List<Testimonial> GetAll(int page = 1, int pageSize = 10) {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         return db.Testimonials.Where(x => x.active == true).Where(x => x.approved == true).OrderByDescending(x => x.dateAdded).Skip((page - 1) * pageSize).Take(pageSize).ToList<Testimonial>();
     } catch {
         return new List<Testimonial>();
     }
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:8,代码来源:Testimonials.cs


示例16: GetProfile

 public static Profile GetProfile(string username = "", string pass = "")
 {
     Profile p = new Profile();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     string encpass = EncryptString(pass);
     p = db.Profiles.Where(x => x.username.Equals(username) && x.password.Equals(encpass)).First<Profile>();
     return p;
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:8,代码来源:Profiles.cs


示例17: GetPage

 internal static ContentPage GetPage(int id) {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         return db.ContentPages.Where(x => x.ID.Equals(id)).FirstOrDefault<ContentPage>();
     } catch (Exception) {
         return new ContentPage();
     }
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:8,代码来源:ContentManagement.cs


示例18: GetSitemap

 internal static List<ContentPage> GetSitemap() {
     List<ContentPage> pages = new List<ContentPage>();
     List<string> excluded = new List<string> { "about us", "contact", "faq", "homepage", "privacy policy", "newsletter", "sitemap" };
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         pages = db.ContentPages.Where(x => x.visible.Equals(true) && !excluded.Contains(x.Title.Trim().ToLower())).AsParallel().OrderBy(x => x.Title).ToList();
     } catch { };
     return pages;
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:9,代码来源:ContentManagement.cs


示例19: ClearParents

        internal static void ClearParents(int id)
        {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            List<ContentNesting> parents = new List<ContentNesting>();

            parents = db.ContentNestings.Where(x => x.pageID.Equals(id)).ToList<ContentNesting>();
            db.ContentNestings.DeleteAllOnSubmit<ContentNesting>(parents);
            db.SubmitChanges();
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:9,代码来源:ContentManagement.cs


示例20: Delete

        internal static void Delete(int id)
        {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            DistributionCenter dc = new DistributionCenter();
            dc = db.DistributionCenters.Where(x => x.ID.Equals(id)).FirstOrDefault<DistributionCenter>();

            db.DistributionCenters.DeleteOnSubmit(dc);
            db.SubmitChanges();
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:9,代码来源:DC.cs



注:本文中的EcommercePlatformDataContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Edge类代码示例发布时间:2022-05-24
下一篇:
C# EcasAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap