示例#1
0
 public bool CreateRecord(Object levelobj)
 {
     Boolean flag = false;
     PropertyLevelMaster Level = (PropertyLevelMaster)levelobj;
     try
     {
         PropertyLevel _Level = new PropertyLevel();
         if (Level.LevelName != null)
         {
             _Level.LevelName = Level.LevelName.Trim();
         }
         if (Level.ClientID != null)
         {
             _Level.ClientID = Level.ClientID;
         }
         if (Level.SiteID != null)
         {
             _Level.SiteID = Level.SiteID;
         }
         _Level.CreateBy = Level.CreateBy;
         _Level.CreateDate = DateTime.Now;
         if (_Level.LevelName != null)
         {
             flag = DAL.DALPropertyLevel.CreatePropertyLevel(_Level);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }
示例#2
0
 public static bool IsExistingPropertyLevel(PropertyLevel level)
 {
     using (var context = new SycousCon())
     {
         try
         {
      PropertyLevel objlevel = context.PropertyLevels.SingleOrDefault(p => p.LevelName.ToUpper() == level.LevelName.ToUpper() && p.ClientID == level.ClientID && p.SiteID == level.SiteID);
             if (objlevel != null)
             { return true; }
             else
             {
                 return false;
             }
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
 }
示例#3
0
 public static PropertyLevel EditPropertyLevel(Int32 LevelID)
 {
     PropertyLevel level = new PropertyLevel();
     using (var context = new SycousCon())
     {
         try
         {
             level = context.PropertyLevels.SingleOrDefault(s => s.ID == LevelID);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return level;
 }
示例#4
0
        public static Boolean CreatePropertyLevel(PropertyLevel level)
        {
            Boolean flag = false;
            if (!(IsExistingPropertyLevel(level)))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.PropertyLevels.AddObject(level);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using
            }//if

            return flag;
        }
示例#5
0
        public static Boolean UpdatePropertyLevel(PropertyLevel Level)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.PropertyLevels.Where(c => c.ID == Level.ID);
                        foreach (PropertyLevel p in Update)
                        {
                            if (Level.LevelName != null)
                            {
                                p.LevelName = Level.LevelName;
                            }
                            if (Level.SiteID != null)
                            {
                                p.SiteID = Level.SiteID;
                            }

                            if (Level.ClientID != null)
                            {
                                p.ClientID = Level.ClientID;
                            }
                            p.ModifyBy = Level.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
        }
示例#6
0
        public bool UpdateRecord(Object Typeobj)
        {
            Boolean flag = false;
            PropertyLevelMaster Level = (PropertyLevelMaster)Typeobj;
            try
            {
                PropertyLevel _Level = new PropertyLevel();
                _Level.ID = Convert.ToInt32(Level.ID);
                if (Level.LevelName != null)
                {
                    _Level.LevelName = Level.LevelName.Trim();
                }
                if (Level.ClientID != null)
                {
                    _Level.ClientID = Level.ClientID;
                }

                if (Level.SiteID != null)
                {
                    _Level.SiteID = Level.SiteID;
                }

                _Level.ModifyBy = Level.modifyBy;
                _Level.ModifyDate = DateTime.Now;
                if (_Level.ID != null)
                {
                    flag = DAL.DALPropertyLevel.UpdatePropertyLevel(_Level);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
 /// <summary>
 /// Create a new PropertyLevel object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static PropertyLevel CreatePropertyLevel(global::System.Int32 id, global::System.Int32 isDeleted)
 {
     PropertyLevel propertyLevel = new PropertyLevel();
     propertyLevel.ID = id;
     propertyLevel.IsDeleted = isDeleted;
     return propertyLevel;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PropertyLevels EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPropertyLevels(PropertyLevel propertyLevel)
 {
     base.AddObject("PropertyLevels", propertyLevel);
 }