Beispiel #1
0
        public static Boolean UpdatePropertyBand(PropertyBand Band)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertyBands.Where(c => c.ID == Band.ID);
                       foreach (PropertyBand p in Update)
                       {
                           if (Band.PropertyBand1 != null)
                           {
                               p.PropertyBand1 = Band.PropertyBand1;
                           }
                           if (Band.PropertyLevel != null)
                           {
                               p.PropertyLevel = Band.PropertyLevel;
                           }
                           if (Band.PropertySize != null)
                           {
                               p.PropertySize = Band.PropertySize;
                           }
                           if (Band.PropertyType != null)
                           {
                               p.PropertyType = Band.PropertyType;
                           }
                           if (Band.PropertyOwnershipType != null)
                           {
                               p.PropertyOwnershipType = Band.PropertyOwnershipType;
                           }

                           if (Band.ClientID != null)
                           {
                               p.ClientID = Band.ClientID;
                           }
                           if (Band.SiteID!= null)
                           {
                               p.SiteID = Band.SiteID;
                           }
                           p.ModifyBy = Band.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
        }
Beispiel #2
0
 public static bool IsExistingPropertyBand(PropertyBand band)
 {
     using (var context = new SycousCon())
        {
        try
        {
            PropertyBand objband = context.PropertyBands.SingleOrDefault(p => p.PropertyBand1.ToUpper() == band.PropertyBand1.ToUpper() && p.ClientID == band.ClientID && p.SiteID == band.SiteID);
            if (objband != null)
            { return true; }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
 }
Beispiel #3
0
 public static PropertyBand EditPropertyBand(Int32 bandID)
 {
     PropertyBand band = new PropertyBand();
        using (var context = new SycousCon())
        {
        try
        {
            band = context.PropertyBands.SingleOrDefault(s => s.ID == bandID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return band;
 }
Beispiel #4
0
        public static Boolean CreatePropertyBand(PropertyBand  band)
        {
            Boolean flag = false;

               if (!(IsExistingPropertyBand(band)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.PropertyBands.AddObject(band);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
 /// <summary>
 /// Create a new PropertyBand object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static PropertyBand CreatePropertyBand(global::System.Int32 id, global::System.Int32 isDeleted)
 {
     PropertyBand propertyBand = new PropertyBand();
     propertyBand.ID = id;
     propertyBand.IsDeleted = isDeleted;
     return propertyBand;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PropertyBands EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPropertyBands(PropertyBand propertyBand)
 {
     base.AddObject("PropertyBands", propertyBand);
 }