Esempio n. 1
0
        public static SiteMap UpdateItem(SiteMap model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "SiteMap_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(model.NodeID, model.CompanyID));
        }
Esempio n. 2
0
 private static SqlParameter[] CreateSqlParameter(SiteMap model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@CompanyID", model.CompanyID),
         new SqlParameter("@Position", model.Position),
         new SqlParameter("@Title", model.Title),
         new SqlParameter("@Description", model.Description),
         new SqlParameter("@Url", model.Url),
         new SqlParameter("@Expanded", model.Expanded),
         new SqlParameter("@IsFolder", model.IsFolder),
         new SqlParameter("@ScreenID", model.ScreenID),
         new SqlParameter("@NodeID", model.NodeID),
         new SqlParameter("@ParentID", model.ParentID),
     });
 }
Esempio n. 3
0
        public static SiteMap GetItemByID(Guid NodeID, int CompanyID)
        {
            SiteMap item      = new SiteMap();
            var     sqlParams = new SqlParameter[]
            {
                new SqlParameter("@NodeID", NodeID),
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("SiteMap_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Esempio n. 4
0
        public static SiteMap AddItem(SiteMap model)
        {
            Guid result = Guid.Empty;

            try
            {
                using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "SiteMap_Add", CreateSqlParameter(model)))
                {
                    while (reader.Read())
                    {
                        result = (Guid)reader[0];
                    }
                }
            }
            catch (Exception ObjEx)
            {
            }
            return(GetItemByID(result, model.CompanyID));
        }
Esempio n. 5
0
        public static SiteMapCollection GetAllItem(int CompanyID)
        {
            SiteMapCollection collection = new SiteMapCollection();

            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("SiteMap_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    SiteMap obj = new SiteMap();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }