Example #1
0
        public bool CreateRecord(Object Sizeobj)
        {
            Boolean flag = false;
            PropertySizeMaster Size = (PropertySizeMaster)Sizeobj;
            try
            {
                PropertySize _Size = new PropertySize();
                if (Size.PropertySize != null)
                {
                    _Size.PropertySize1 = Size.PropertySize.Trim();
                }

                if (Size.ClientID != null)
                {
                    _Size.ClientID = Size.ClientID;
                }

                if (Size.SiteID != null)
                {
                    _Size.SiteID = Size.SiteID;
                }
                _Size.CreateBy = Size.CreateBy;
                _Size.CreateDate = DateTime.Now;
                if (_Size.PropertySize1 != null)
                {
                    flag = DAL.DALPropertySize.CreatePropertySize(_Size);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Example #2
0
        public static Boolean UpdatePropertySize(PropertySize Size)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertySizes.Where(c => c.ID == Size.ID);
                       foreach (PropertySize p in Update)
                       {
                           if (Size.PropertySize1 != null)
                           {
                               p.PropertySize1 = Size.PropertySize1;
                           }
                           if (Size.SiteID != null)
                           {
                               p.SiteID = Size.SiteID;
                           }

                           if (Size.ClientID != null)
                           {
                               p.ClientID = Size.ClientID;
                           }
                           p.ModifyBy = Size.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
        }
Example #3
0
 public static bool IsExistingPropertySize(PropertySize Size)
 {
     using (var context = new SycousCon())
        {
        try
        {
            PropertySize objSize = context.PropertySizes.SingleOrDefault(p => p.PropertySize1.ToUpper() == Size.PropertySize1.ToUpper()
                && p.ClientID == Size.ClientID && p.SiteID == Size.SiteID);
            if (objSize != null)
            { return true; }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
 }
Example #4
0
 public static PropertySize EditPropertySize(Int32 SizeID)
 {
     PropertySize Size = new PropertySize();
        using (var context = new SycousCon())
        {
        try
        {
            Size = context.PropertySizes.SingleOrDefault(s => s.ID == SizeID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return Size;
 }
Example #5
0
        public static Boolean CreatePropertySize(PropertySize Size)
        {
            Boolean flag = false;
               if (!(IsExistingPropertySize(Size)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.PropertySizes.AddObject(Size);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
Example #6
0
        public bool UpdateRecord(Object Sizeobj)
        {
            Boolean flag = false;
            PropertySizeMaster size = (PropertySizeMaster)Sizeobj;
            try
            {
                PropertySize _Size = new PropertySize();
                _Size.ID = Convert.ToInt32(size.ID);
                if (size.PropertySize != null)
                {
                    _Size.PropertySize1 = size.PropertySize.Trim();
                }

                if (size.ClientID != null)
                {
                    _Size.ClientID = size.ClientID;
                }

                if (size.SiteID != null)
                {
                    _Size.SiteID = size.SiteID;
                }
                 _Size.ModifyBy = size.modifyBy;
                _Size.ModifyDate = DateTime.Now;
                if (_Size.ID != null)
                {
                    flag = DAL.DALPropertySize.UpdatePropertySize(_Size);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
 /// <summary>
 /// Create a new PropertySize object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static PropertySize CreatePropertySize(global::System.Int32 id, global::System.Int32 isDeleted)
 {
     PropertySize propertySize = new PropertySize();
     propertySize.ID = id;
     propertySize.IsDeleted = isDeleted;
     return propertySize;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PropertySizes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPropertySizes(PropertySize propertySize)
 {
     base.AddObject("PropertySizes", propertySize);
 }