public static Owner EditOwner(Int64 OwnerID) { Owner owner = new Owner(); using (var context = new SycousCon()) { try { owner = context.Owners.SingleOrDefault(s => s.ID == OwnerID); } catch (Exception ex) { context.Dispose(); throw; } } return owner; }
public static Boolean CreateOwner(Owner owner) { Boolean flag = false; using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.Owners.AddObject(owner); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } }// }// using return flag; }
public bool CreateRecord(Object ownerpobj) { Boolean flag = false; OwnerMaster owner = (OwnerMaster)ownerpobj; try { Owner _owner = new Owner(); if (owner.SiteID != null) { _owner.SiteID = owner.SiteID; } if (owner.propertyID != null) { _owner.PropertyID = owner.propertyID; } if (owner.ContactName != null) { _owner.ContactName = owner.ContactName.Trim(); } if (owner.StartDate != null) { _owner.StartDate = Common.DateGB(owner.StartDate); } if (owner.BankName != null) { _owner.BankName = owner.BankName.Trim(); } if (owner.BankSortCode != null) { _owner.BankSortCode = owner.BankSortCode.Trim(); } if (owner.BankAccountNo != null) { _owner.BankAccountNo = owner.BankAccountNo.Trim(); } if (owner.Address1 != null) { _owner.Address1 = owner.Address1.Trim(); } if (owner.Address2 != null) { _owner.Address2 = owner.Address2.Trim(); } if (owner.Corrs != null) { _owner.Corrs = owner.Corrs.Trim(); } if (owner.City != null) { _owner.City = owner.City.Trim(); } if (owner.County != null) { _owner.County = owner.County.Trim(); } if (owner.PostCode != null) { _owner.PostCode = owner.PostCode.Trim(); } if (owner.Email != null) { _owner.Email = owner.Email.Trim(); } if (owner.MailService != null) { _owner.MailService = owner.MailService; } if (owner.Telephone != null) { _owner.Telephone = owner.Telephone.Trim(); } if (owner.Mobile != null) { _owner.Mobile = owner.Mobile.Trim(); } if (owner.Agent != null) { _owner.Agent = owner.Agent.Trim(); } if (owner.AgentTelephone != null) { _owner.AgentTelephone = owner.AgentTelephone.Trim(); } if (owner.AgentEmail != null) { _owner.AgentEmail = owner.AgentEmail.Trim(); } if (owner.FirstName != null) { _owner.FirstName = owner.FirstName.Trim(); } if (owner.LastName!= null) { _owner.LastName = owner.LastName.Trim(); } if (owner.Notes != null) { _owner.Notes = owner.Notes.Trim(); } if (owner.ClientRefNo != null) { _owner.ClientRefNo = owner.ClientRefNo.Trim(); } if (owner.EndDate != null) { _owner.Enddate = Common.DateGB(owner.EndDate); } else { _owner.Enddate = null; } _owner.CreateBy = owner.CreateBy; _owner.CreateDate = DateTime.Now; if ((_owner.SiteID != null)&&(_owner.PropertyID!= null)) { flag = DAL.DALOwner.CreateOwner(_owner); } } catch (Exception ex) { throw; } return flag; }
public static Boolean UpdateOwner(Owner owner) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.Owners.Where(c => c.ID == owner.ID); foreach (Owner p in Update) { if (owner.ContactName != null) { p.ContactName = owner.ContactName; } if (owner.SiteID != null) { p.SiteID = owner.SiteID; } if (owner.PropertyID != null) { p.PropertyID = owner.PropertyID; } if (owner.Enddate != null) { p.Enddate = owner.Enddate; } else { p.Enddate = null; } if (owner.StartDate != null) { p.StartDate = owner.StartDate; } if (owner.BankName != null) { p.BankName = owner.BankName; } if (owner.BankSortCode != null) { p.BankSortCode = owner.BankSortCode; } if (owner.BankAccountNo != null) { p.BankAccountNo = owner.BankAccountNo; } if (owner.Address1 != null) { p.Address1 = owner.Address1; } if (owner.Address2 != null) { p.Address2 = owner.Address2; } if (owner.Corrs != null) { p.Corrs = owner.Corrs; } if (owner.City != null) { p.City = owner.City; } if (owner.County != null) { p.County = owner.County; } else { p.County = null; } if (owner.PostCode != null) { p.PostCode = owner.PostCode; } if (owner.Email != null) { p.Email = owner.Email; } if (owner.MailService != null) { p.MailService = owner.MailService; } if (owner.MailService != null) { p.MailService = owner.MailService; } if (owner.Telephone != null) { p.Telephone = owner.Telephone; } if (owner.Mobile != null) { p.Mobile = owner.Mobile; } if (owner.Agent != null) { p.Agent = owner.Agent; } if (owner.AgentTelephone != null) { p.AgentTelephone = owner.AgentTelephone; } else { p.AgentTelephone = null; } if (owner.AgentEmail != null) { p.AgentEmail = owner.AgentEmail; } else { p.AgentEmail = null; } if (owner.FirstName != null) { p.FirstName = owner.FirstName; } if (owner.LastName != null) { p.LastName = owner.LastName; } if (owner.Notes != null) { p.Notes = owner.Notes; } if (owner.ClientRefNo != null) { p.ClientRefNo = owner.ClientRefNo; } else { p.ClientRefNo = null; } p.ModifyDate = owner.ModifyDate; p.ModifyBy = owner.ModifyBy; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
/// <summary> /// Deprecated Method for adding a new object to the Owners EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOwners(Owner owner) { base.AddObject("Owners", owner); }
/// <summary> /// Create a new Owner object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static Owner CreateOwner(global::System.Int64 id, global::System.Int32 isDeleted) { Owner owner = new Owner(); owner.ID = id; owner.IsDeleted = isDeleted; return owner; }