Exemplo n.º 1
0
        public bool CreateRecord(Object Typeobj)
        {
            Boolean flag = false;
            PropertyTypeMaster Type = (PropertyTypeMaster)Typeobj;
            try
            {
                PropertyType _Type = new PropertyType();
                if (Type.PropertyType != null)
                {
                    _Type.PropertyType1 = Type.PropertyType.Trim();
                }

                if (Type.ClientID != null)
                {
                    _Type.ClientID = Type.ClientID;
                }

                if (Type.SiteID != null)
                {
                    _Type.SiteID = Type.SiteID;
                }

                _Type.CreateBy = Type.CreateBy;
                _Type.CreateDate = DateTime.Now;
                if ((_Type.PropertyType1 != null) &&( _Type.ClientID != null)&&(Type.SiteID != null))
                {
                    flag = DAL.DALPropertyType.CreatePropertyType(_Type);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Exemplo n.º 2
0
        public static Boolean UpdatePropertyType(PropertyType Type)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertyTypes.Where(c => c.ID == Type.ID);
                       foreach (PropertyType p in Update)
                       {
                           if (Type.PropertyType1 != null)
                           {
                               p.PropertyType1 = Type.PropertyType1;
                           }

                           if (Type.ClientID != null)
                           {
                               p.ClientID = Type.ClientID;
                           }
                           if (Type.SiteID != null)
                           {
                               p.SiteID = Type.SiteID;
                           }

                           p.ModifyBy = Type.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
        }
Exemplo n.º 3
0
 public static bool IsExistingPropertyType(PropertyType Type)
 {
     using (var context = new SycousCon())
        {
        try
        {
            PropertyType objType = context.PropertyTypes.SingleOrDefault(p => p.PropertyType1.ToUpper() == Type.PropertyType1.ToUpper() && p.SiteID == Type.SiteID && p.ClientID == Type.SiteID );
            if (objType != null)
            { return true; }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
 }
Exemplo n.º 4
0
 public static PropertyType EditPropertyType(Int32 TypeID)
 {
     PropertyType Type = new PropertyType();
        using (var context = new SycousCon())
        {
        try
        {
            Type = context.PropertyTypes.SingleOrDefault(s => s.ID == TypeID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return Type;
 }
Exemplo n.º 5
0
        public static Boolean CreatePropertyType(PropertyType Type)
        {
            Boolean flag = false;
               if (!(IsExistingPropertyType(Type)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.PropertyTypes.AddObject(Type);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
Exemplo n.º 6
0
        public bool UpdateRecord(Object Typeobj)
        {
            Boolean flag = false;
            PropertyTypeMaster type = (PropertyTypeMaster)Typeobj;
            try
            {
                PropertyType _Type = new PropertyType();
                _Type.ID = Convert.ToInt32(type.ID);
                if (type.PropertyType != null)
                {
                    _Type.PropertyType1 = type.PropertyType.Trim();
                }
                if (type.ClientID != null)
                {
                    _Type.ClientID = type.ClientID;
                }

                if (type.SiteID != null)
                {
                    _Type.SiteID = type.SiteID;
                }
                _Type.ModifyBy = type.modifyBy;
                _Type.ModifyDate = DateTime.Now;
                if (_Type.ID != null)
                {
                    flag = DAL.DALPropertyType.UpdatePropertyType(_Type);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Create a new PropertyType object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static PropertyType CreatePropertyType(global::System.Int32 id, global::System.Int32 isDeleted)
 {
     PropertyType propertyType = new PropertyType();
     propertyType.ID = id;
     propertyType.IsDeleted = isDeleted;
     return propertyType;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PropertyTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPropertyTypes(PropertyType propertyType)
 {
     base.AddObject("PropertyTypes", propertyType);
 }