public bool CreateRecord(Object shipobj) { Boolean flag = false; PropertyOwnerShipMaster Ship = (PropertyOwnerShipMaster)shipobj; try { PropertyOwnershipType _owner = new PropertyOwnershipType(); if (Ship.OwnershipType != null) { _owner.OwnershipType = Ship.OwnershipType.Trim(); } if (Ship.ClientID != null) { _owner.ClientID = Ship.ClientID; } if (Ship.SiteID != null) { _owner.SiteID = Ship.SiteID; } _owner.CreateBy = Ship.CreateBy; _owner.CreateDate = DateTime.Now; if( (_owner.OwnershipType != null)&&(_owner.ClientID != null)&&(_owner.SiteID != null)) { flag = DAL.DALPropertyOwnership.CreatePropertyOwnership(_owner); } } catch (Exception ex) { throw; } return flag; }
public static Boolean UpdatePropertyOwership(PropertyOwnershipType ownership) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.PropertyOwnershipTypes.Where(c => c.ID == ownership.ID); foreach (PropertyOwnershipType p in Update) { if (ownership.OwnershipType != null) { p.OwnershipType = ownership.OwnershipType; } if (ownership.ClientID != null) { p.ClientID = ownership.ClientID; } if (ownership.SiteID != null) { p.SiteID = ownership.SiteID; } p.ModifyBy = ownership.ModifyBy; p.ModifyDate = DateTime.Now; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
public static bool IsExistingPropertyOwnership(PropertyOwnershipType ownership) { using (var context = new SycousCon()) { try { PropertyOwnershipType objownership = context.PropertyOwnershipTypes.SingleOrDefault(p => p.OwnershipType.ToUpper() == ownership.OwnershipType.ToUpper() && p.SiteID == ownership.SiteID && p.ClientID == ownership.ClientID); if (objownership != null) { return true; } else { return false; } } catch (Exception ex) { context.Dispose(); throw; } } }
public static PropertyOwnershipType EditPropertyOwnership(Int32 ownershipID) { PropertyOwnershipType ownership = new PropertyOwnershipType(); using (var context = new SycousCon()) { try { ownership = context.PropertyOwnershipTypes.SingleOrDefault(s => s.ID == ownershipID); } catch (Exception ex) { context.Dispose(); throw; } } return ownership; }
public static Boolean CreatePropertyOwnership(PropertyOwnershipType ownership) { Boolean flag = false; if (!(IsExistingPropertyOwnership(ownership))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.PropertyOwnershipTypes.AddObject(ownership); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } }// }// using }//if return flag; }
/// <summary> /// Create a new PropertyOwnershipType object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static PropertyOwnershipType CreatePropertyOwnershipType(global::System.Int32 id, global::System.Int32 isDeleted) { PropertyOwnershipType propertyOwnershipType = new PropertyOwnershipType(); propertyOwnershipType.ID = id; propertyOwnershipType.IsDeleted = isDeleted; return propertyOwnershipType; }
/// <summary> /// Deprecated Method for adding a new object to the PropertyOwnershipTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPropertyOwnershipTypes(PropertyOwnershipType propertyOwnershipType) { base.AddObject("PropertyOwnershipTypes", propertyOwnershipType); }
public bool UpdateRecord(Object ownershipobj) { Boolean flag = false; PropertyOwnerShipMaster owner = (PropertyOwnerShipMaster)ownershipobj; try { PropertyOwnershipType _owner = new PropertyOwnershipType(); _owner.ID = Convert.ToInt32(owner.ID); if (owner.OwnershipType != null) { _owner.OwnershipType = owner.OwnershipType.Trim(); } if (owner.ClientID != null) { _owner.ClientID = owner.ClientID; } if (owner.SiteID != null) { _owner.SiteID = owner.SiteID; } _owner.ModifyBy = owner.modifyBy; _owner.ModifyDate = DateTime.Now; if (_owner.ID != null) { flag = DAL.DALPropertyOwnership.UpdatePropertyOwership(_owner); } } catch (Exception ex) { throw; } return flag; }