当前位置: 首页>>代码示例>>C#>>正文


C# EcommercePlatformDataContext.SubmitChanges方法代码示例

本文整理汇总了C#中EcommercePlatformDataContext.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# EcommercePlatformDataContext.SubmitChanges方法的具体用法?C# EcommercePlatformDataContext.SubmitChanges怎么用?C# EcommercePlatformDataContext.SubmitChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EcommercePlatformDataContext的用法示例。


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

示例1: Delete

 public static string Delete(int id = 0) {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         List<BlogPost_BlogCategory> postcats = db.BlogPost_BlogCategories.Where(x => x.blogCategoryID.Equals(id)).ToList<BlogPost_BlogCategory>();
         db.BlogPost_BlogCategories.DeleteAllOnSubmit(postcats);
         db.SubmitChanges();
         BlogCategory category = (from c in db.BlogCategories
                                  where c.blogCategoryID.Equals(id)
                                  select c).FirstOrDefault<BlogCategory>();
         db.BlogCategories.DeleteOnSubmit(category);
         db.SubmitChanges();
         return "";
     } catch (Exception e) {
         return e.Message;
     }
 }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:16,代码来源:BlogCategory.cs

示例2: 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

示例3: 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

示例4: 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

示例5: Delete

 public ActionResult Delete(int id)
 {
     if (id > 0) {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         FTPFirewall ipaddress = db.FTPFirewalls.Where(x => x.ID.Equals(id)).FirstOrDefault<FTPFirewall>();
         db.FTPFirewalls.DeleteOnSubmit(ipaddress);
         db.SubmitChanges();
     }
     return RedirectToAction("Index");
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:10,代码来源:FTPController.cs

示例6: Unsubscribe

        internal static void Unsubscribe(Guid unsub) {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();

            if (unsub == null) { throw new Exception("Invalid reference to a subscription."); }
            Newsletter nw = db.Newsletters.Where(x => x.Unsubscribe.Equals(unsub)).FirstOrDefault<Newsletter>();
            if (nw == null) { throw new Exception("No subscription found."); }

            db.Newsletters.DeleteOnSubmit(nw);
            db.SubmitChanges();
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:10,代码来源:NewsletterFunctions.cs

示例7: FirstUse

 public ActionResult FirstUse() {
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     try {
         Profile p = db.Profiles.Where(x => x.username.Equals("admin")).First<Profile>();
         if (p.password == "") {
             p.password = Crypto.EncryptString("admin");
             db.SubmitChanges();
         }
     } catch { };
     return RedirectToAction("Index");
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:11,代码来源:AuthController.cs

示例8: Save

 public ActionResult Save() {
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     List<Setting> settinglist = db.Settings.ToList<Setting>();
     foreach (Setting s in settinglist) {
         try {
             s.value = Request.Form[s.name].Trim();
         } catch {};
     }
     db.SubmitChanges();
     return RedirectToAction("index");
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:11,代码来源:SettingsController.cs

示例9: DeleteGroup

 public string DeleteGroup(int id = 0) {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         SettingGroup g = db.SettingGroups.Where(x => x.settingGroupID.Equals(id)).First<SettingGroup>();
         db.SettingGroups.DeleteOnSubmit(g);
         db.SubmitChanges();
         return "";
     } catch (Exception e) {
         return e.Message;
     }
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:11,代码来源:SettingsController.cs

示例10: DeleteTask

 public string DeleteTask(int id = 0)
 {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         ScheduledTask t = db.ScheduledTasks.Where(x => x.ID.Equals(id)).First<ScheduledTask>();
         db.ScheduledTasks.DeleteOnSubmit(t);
         db.SubmitChanges();
         return "";
     } catch (Exception e) {
         return e.Message;
     }
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:12,代码来源:SchedulerController.cs

示例11: Add

        internal static ContentPage Add(ContentPage page)
        {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();

            if (page == null) { throw new Exception("Page is null."); }
            if (page.Title == null || page.Title.Length == 0) { throw new Exception("Page title is required."); }
            if (page.ID > 0) {
                ContentPage existing = db.ContentPages.Where(x => x.ID.Equals(page.ID)).FirstOrDefault<ContentPage>();
                existing.Title = page.Title;
                existing.content = page.content;
                existing.metaTitle = page.metaTitle;
                existing.metaDescription = page.metaDescription;
                existing.visible = page.visible;
                db.SubmitChanges();
                page = existing;
            } else {
                db.ContentPages.InsertOnSubmit(page);
                db.SubmitChanges();
            }
            return page;
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:21,代码来源:ContentManagement.cs

示例12: Delete

 public static void Delete(int id = 0)
 {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         List<BlogPost_BlogCategory> postcats = db.BlogPost_BlogCategories.Where(x => x.blogPostID.Equals(id)).ToList<BlogPost_BlogCategory>();
         db.BlogPost_BlogCategories.DeleteAllOnSubmit(postcats);
         BlogPost p = db.BlogPosts.Where(x => x.blogPostID == id).FirstOrDefault<BlogPost>();
         p.active = false;
         db.SubmitChanges();
     } catch (Exception e) {
         throw e;
     }
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:13,代码来源:BlogPost.cs

示例13: Delete

 public static void Delete(int id = 0)
 {
     try
     {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         BlogPost p = db.BlogPosts.Where(x => x.blogPostID == id).FirstOrDefault<BlogPost>();
         p.active = false;
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:14,代码来源:Post.cs

示例14: CheckFixed

 internal static void CheckFixed() {
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     foreach (string title in fixed_pages) {
         ContentPage page = db.ContentPages.Where(x => x.Title.ToLower().Equals(title.ToLower())).FirstOrDefault<ContentPage>();
         if (page == null) {
             page = new ContentPage {
                 Title = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(title),
                 content = ""
             };
             db.ContentPages.InsertOnSubmit(page);
         }
     }
     db.SubmitChanges();
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:14,代码来源:ContentManagement.cs

示例15: Delete

 public static void Delete(int id = 0)
 {
     try
     {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         Comment c = db.Comments.Where(x => x.commentID == id).FirstOrDefault<Comment>();
         c.active = false;
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:14,代码来源:BlogComment.cs


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