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


C# DeneysanContext.SaveChanges方法代码示例

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


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

示例1: AddReference

        public static bool AddReference(References record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    if (!record.TimeCreated.HasValue)
                        record.TimeCreated = DateTime.Now;
                    record.Deleted = false;
                    record.Online = true;
                    db.References.Add(record);
                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.Referans.ToString();
                    logkeeper.Message = LogMessages.ReferenceAdded;
                    logkeeper.User = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data = record.ReferenceName;
                    logkeeper.AddInfoLog(logger);


                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:31,代码来源:ReferenceManager.cs

示例2: EditInstituional

        public static bool EditInstituional(Institutional record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    Institutional editrecord = db.Institutional.SingleOrDefault(d => d.TypeId == record.TypeId && d.Language == record.Language);

                    if (editrecord == null)
                    {
                        editrecord = new Institutional();
                        editrecord.TimeUpdated = DateTime.Now;
                        editrecord.TypeId = record.TypeId;
                        editrecord.Language = record.Language;
                        editrecord.Content = record.Content;
                        db.Institutional.Add(editrecord);
                    }
                    else
                    {
                        editrecord.TimeUpdated = DateTime.Now;
                        editrecord.Content = record.Content;
                    }

                    db.SaveChanges();

                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
                
            }
        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:34,代码来源:InstituionalManager.cs

示例3: DeleteGroup

        public static bool DeleteGroup(int id)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    var record = db.ProjectGroup.FirstOrDefault(d => d.ProjectGroupId == id);
                    db.ProjectGroup.Remove(record);

                    db.SaveChanges();

                    //LogtrackManager logkeeper = new LogtrackManager();
                    //logkeeper.LogDate = DateTime.Now;
                    //logkeeper.LogProcess = EnumLogType.DokumanGrup.ToString();
                    //logkeeper.Message = LogMessages.ProjectGroupDeleted;
                    //logkeeper.User = HttpContext.Current.User.Identity.Name;
                    //logkeeper.Data = record.GroupName;
                    //logkeeper.AddInfoLog(logger);

                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
            }
        }
开发者ID:cemelma,项目名称:argem,代码行数:27,代码来源:ProductManager.cs

示例4: AddBankInfo

        public static bool AddBankInfo(BankInfo record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    
                    record.Online = true;
                    db.BankInfo.Add(record);
                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.BankaBilgisi.ToString();
                    logkeeper.Message = LogMessages.BankAdded;
                    logkeeper.User = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data = record.BankName;
                    logkeeper.AddInfoLog(logger);


                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:29,代码来源:BankManager.cs

示例5: Delete

        public static bool Delete(int id)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    var record = db.News.FirstOrDefault(d => d.NewsId == id);
                    record.Deleted = true;

                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.Haber.ToString();
                    logkeeper.Message = LogMessages.NewsDeleted;
                    logkeeper.User = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data = record.Header;
                    logkeeper.AddInfoLog(logger);

                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
            }
        }
开发者ID:cemelma,项目名称:argem,代码行数:27,代码来源:NewsManager.cs

示例6: AddProduct

        public static bool AddProduct(Product record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {

                    record.TimeCreated = DateTime.Now;
                    record.Deleted = false;

                    record.Online = true;
                    record.SortNumber = 9999;
                    db.Product.Add(record);
                    db.SaveChanges();

                    //LogtrackManager logkeeper = new LogtrackManager();
                    //logkeeper.LogDate = DateTime.Now;
                    //logkeeper.LogProcess = EnumLogType.Dokuman.ToString();
                    //logkeeper.Message = LogMessages.ProductAdded;
                    //logkeeper.User = HttpContext.Current.User.Identity.Name;
                    //logkeeper.Data = record.Name;
                    //logkeeper.AddInfoLog(logger);

                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
开发者ID:cemelma,项目名称:argem,代码行数:31,代码来源:ProductManager.cs

示例7: EditUser

 public static bool EditUser(User model)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         try
         {
             User record = db.User.Where(d => d.UserId == model.UserId).SingleOrDefault();
             if (record != null)
             {
                 record.FullName = model.FullName;
                 record.Email = model.Email;
                 if(model.Password != "") record.Password = model.Password;
                 record.Institution = model.Institution;
                 record.Contact = model.Contact;
                 db.SaveChanges();
                 return true;
             }
             else return false;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }
开发者ID:cemelma,项目名称:argem,代码行数:25,代码来源:UserManager.cs

示例8: ChangePassword

 public static bool ChangePassword(string password, string email)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         User record = db.User.SingleOrDefault(d => d.Email == email);
         if (record != null)
         {
             record.Password = password;
             db.SaveChanges();
             return true;
         }
         else return false;
     }
 }
开发者ID:cemelma,项目名称:argem,代码行数:14,代码来源:UserManager.cs

示例9: EditContact

        public static dynamic EditContact(Contact record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    Contact contact = db.Contact.Where(d => d.Language == record.Language).SingleOrDefault();
                    if (contact == null)
                    {
                        contact = new Contact();
                        contact.Address = record.Address;
                        contact.Phone = record.Phone;
                        contact.Fax = record.Fax;
                        contact.Taxnumber = record.Taxnumber;
                        contact.Taxoffice = record.Taxoffice;
                        contact.Email = record.Email;
                        contact.Language = record.Language;
                        db.Contact.Add(contact);
                    }
                    else
                    {
                        contact.Address = record.Address;
                        contact.Phone = record.Phone;
                        contact.Fax = record.Fax;
                        contact.Taxnumber = record.Taxnumber;
                        contact.Taxoffice = record.Taxoffice;
                        contact.Email = record.Email;
                    }

                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.Contact.ToString();
                    logkeeper.Message = LogMessages.ContactEdited;
                    logkeeper.User = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data = record.Address;
                    logkeeper.AddInfoLog(logger);


                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:48,代码来源:ContactManager.cs

示例10: AddApplication

 public static bool AddApplication(Application record)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         try
         {
             db.Application.Add(record);
             db.SaveChanges();
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
开发者ID:cemelma,项目名称:argem,代码行数:16,代码来源:ContactManager.cs

示例11: DeleteProjectImage

        public void DeleteProjectImage(int id)
        {
            using (DeneysanContext db = new DeneysanContext())
              {
            try
            {
              var record = db.ProjectsGallery.FirstOrDefault(d => d.ProjeId == id);
              db.ProjectsGallery.Remove(record);
              db.SaveChanges();

            }
            catch (Exception)
            {

            }
              }
        }
开发者ID:cemelma,项目名称:argem,代码行数:17,代码来源:ProjectController.cs

示例12: AddUsers

 public static bool AddUsers(User record)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         try
         {
             record.isActive = true;
             db.User.Add(record);
             db.SaveChanges();
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }
开发者ID:cemelma,项目名称:argem,代码行数:17,代码来源:UserManager.cs

示例13: AddMailUsers

        public static bool AddMailUsers(MailUsers record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    db.MailUsers.Add(record);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:17,代码来源:MailManager.cs

示例14: Delete

 public static bool Delete(int id)
 {
     using (DeneysanContext db = new DeneysanContext())
     {
         try
         {
             var record = db.Application.FirstOrDefault(d => d.ApplicationId == id);
             db.Application.Remove(record);
             db.SaveChanges();
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }
开发者ID:cemelma,项目名称:argem,代码行数:17,代码来源:ContactManager.cs

示例15: ChangeProjectStatus

        public bool ChangeProjectStatus(int id, int status)
        {
            bool returnValue = false;
              using (DeneysanContext db = new DeneysanContext())
              {
            if (db.Projects.Any(d => d.ProjeId == id))
            {
              Projects record = db.Projects.FirstOrDefault(d => d.ProjeId == id);
              record.Status = status;
              db.SaveChanges();
            return true;
            }
            else
            {
              return returnValue;
            }

              }
        }
开发者ID:cemelma,项目名称:argem,代码行数:19,代码来源:ProjectController.cs


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