本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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)
{
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}