Ejemplo n.º 1
0
        private string GetMenu(MenuItem _item)
        {

            IList<MenuItem> colMenus = MenuItemManager.GetAll().Where(t => t.ID == _item.MenuID).ToList();
            if (colMenus.Count == 0)
                return _builder.ToString();
            for (int i = colMenus.Count - 1; i >= 0; i--)
            {
                _builder.Insert(0, "<a href='" + ResolveUrl("~/Userpages/Menudetails.aspx?MenuID=") + colMenus[i].ID + "'>" + colMenus[i].Name + ">>");

                _builder.Insert(0, "</a>");

                if (null != colMenus[i])
                    GetMenu(colMenus[i]);
            }
            return _builder.ToString();
        }
Ejemplo n.º 2
0
        public void PopulateMenuItem(SqlDataReader _dtr, MenuItem obj)
        {
            int columnIndex = 0;
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.ID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_NAME);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Name = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_DESCRIPTION);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Description = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_DETAILS);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Details = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_TYPE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Type = (TG.ExpressCMS.DataLayer.Enums.RootEnums.MenuItemURLtype)_dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_CATEGORYID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.CategoryId = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_URL);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Url = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_ORDERNUMBER);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.OrderNumber = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_MENUID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.MenuID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_IMAGE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Image = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_CREATIONDATE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.CreationDate = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_CREATEDBY);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.CreatedBy = Convert.ToInt32(_dtr.GetString((columnIndex)));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_CREATIONTIME);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.CreationTime = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_PUBLISHFROM);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.PublishFrom = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_PUBLISHTO);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.PublishTo = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_ISDELETED);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.IsDeleted = _dtr.GetBoolean((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.CN_LANG_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.LangID = _dtr.GetInt32((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.PN_REF_LANG);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.RefLangID = _dtr.GetInt32((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(MenuItemDataMapper.PN_IS_PUBLISHED);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.IsPublished = _dtr.GetBoolean((columnIndex));
            }
        }
Ejemplo n.º 3
0
        public static void Update(MenuItem obj)
        {
            MenuItemDataMapper objCaller = new MenuItemDataMapper();

            objCaller.Update(obj);
        }
Ejemplo n.º 4
0
        public static int Add(MenuItem obj)
        {
            MenuItemDataMapper objCaller = new MenuItemDataMapper();

            return objCaller.Add(obj);
        }
Ejemplo n.º 5
0
 public MenuItem GetMenuItem(SqlDataReader _dtr, IList<MenuItem> colobj)
 {
     MenuItem obj = colobj.Where(t => t.ID == Convert.ToInt32(_dtr[CN_ID].ToString())).SingleOrDefault();
     if (null == obj)
     {
         obj = new MenuItem();
         colobj.Add(obj);
     }
     return obj;
 }
Ejemplo n.º 6
0
        public IList<MenuItem> Search(string keyword)
        {

            MenuItem obj = new MenuItem();

            IList<MenuItem> colobj = new List<MenuItem>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "[usp_SelectMenuItemsSearch]";

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter("KEYWORD", SqlDbType.NVarChar);
            parameterID.Value = keyword;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {

                        while (_dtreader.Read())
                        {
                            obj = GetMenuItem(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Ejemplo n.º 7
0
        public int Add(MenuItem obj)
        {
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = INSERTMenuItem;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = obj.ID;
            parameterID.Direction = ParameterDirection.Output;
            _command.Parameters.Add(parameterID);
            SqlParameter parameterName = new SqlParameter(PN_NAME, SqlDbType.NVarChar);
            parameterName.Value = obj.Name;
            parameterName.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterName);
            SqlParameter parameterDescription = new SqlParameter(PN_DESCRIPTION, SqlDbType.NVarChar);
            parameterDescription.Value = obj.Description;
            parameterDescription.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterDescription);
            SqlParameter parameterDetails = new SqlParameter(PN_DETAILS, SqlDbType.NVarChar);
            parameterDetails.Value = obj.Details;
            parameterDetails.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterDetails);
            SqlParameter parameterType = new SqlParameter(PN_TYPE, SqlDbType.Int);
            parameterType.Value = obj.Type;
            parameterType.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterType);
            SqlParameter parameterCategoryId = new SqlParameter(PN_CATEGORYID, SqlDbType.Int);
            parameterCategoryId.Value = obj.CategoryId;
            parameterCategoryId.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterCategoryId);
            SqlParameter parameterUrl = new SqlParameter(PN_URL, SqlDbType.NVarChar);
            parameterUrl.Value = obj.Url;
            parameterUrl.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterUrl);
            SqlParameter parameterOrderNumber = new SqlParameter(PN_ORDERNUMBER, SqlDbType.Int);
            parameterOrderNumber.Value = obj.OrderNumber;
            parameterOrderNumber.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterOrderNumber);
            SqlParameter parameterMenuID = new SqlParameter(PN_MENUID, SqlDbType.Int);
            parameterMenuID.Value = obj.MenuID;
            parameterMenuID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterMenuID);
            SqlParameter parameterImage = new SqlParameter(PN_IMAGE, SqlDbType.NVarChar);
            parameterImage.Value = obj.Image;
            parameterImage.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterImage);
            SqlParameter parameterCreationDate = new SqlParameter(PN_CREATIONDATE, SqlDbType.NVarChar);
            parameterCreationDate.Value = obj.CreationDate;
            parameterCreationDate.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterCreationDate);
            SqlParameter parameterCreatedBy = new SqlParameter(PN_CREATEDBY, SqlDbType.Int);
            parameterCreatedBy.Value = obj.CreatedBy;
            parameterCreatedBy.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterCreatedBy);
            SqlParameter parameterCreationTime = new SqlParameter(PN_CREATIONTIME, SqlDbType.NVarChar);
            parameterCreationTime.Value = obj.CreationTime;
            parameterCreationTime.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterCreationTime);
            SqlParameter parameterPublishFrom = new SqlParameter(PN_PUBLISHFROM, SqlDbType.NVarChar);
            parameterPublishFrom.Value = "1/1/1900";
            parameterPublishFrom.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterPublishFrom);
            SqlParameter parameterPublishTo = new SqlParameter(PN_PUBLISHTO, SqlDbType.NVarChar);
            parameterPublishTo.Value = "1/1/1900"; ;
            parameterPublishTo.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterPublishTo);
            SqlParameter parameterIsDeleted = new SqlParameter(PN_ISDELETED, SqlDbType.Int);
            parameterIsDeleted.Value = obj.IsDeleted;
            parameterIsDeleted.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterIsDeleted);

            SqlParameter paramLangId = new SqlParameter(PN_LANG_ID, SqlDbType.Int);
            paramLangId.Value = obj.LangID;
            paramLangId.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramLangId);

            SqlParameter RefLangID = new SqlParameter(PN_REF_LANG, SqlDbType.Int);
            RefLangID.Value = obj.RefLangID;
            RefLangID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(RefLangID);


            SqlParameter pIsPublished = new SqlParameter(PN_IS_PUBLISHED, SqlDbType.Bit);
            pIsPublished.Value = obj.IsPublished;
            pIsPublished.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pIsPublished);
            #endregion;

            _connection.Open();
            _command.ExecuteNonQuery();
            _connection.Close();
            obj.ID = Convert.ToInt32(parameterID.Value);
            return obj.ID;
        }
Ejemplo n.º 8
0
        public IList<MenuItem> GetAllByCategoryandLang(string hash, int langid)
        {

            MenuItem obj = new MenuItem();

            IList<MenuItem> colobj = new List<MenuItem>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "[usp_SelectMenuItemByLangandHash]";

            #region [Parameters]
            SqlParameter paramhash = new SqlParameter(CategoryDataMapper.PN_HASH, SqlDbType.NVarChar);
            paramhash.Value = hash;
            paramhash.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramhash);

            SqlParameter paramLangID = new SqlParameter(CategoryDataMapper.PN_LANGUAGE_ID, SqlDbType.Int);
            paramLangID.Value = langid;
            paramLangID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramLangID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {

                        while (_dtreader.Read())
                        {
                            obj = GetMenuItem(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Ejemplo n.º 9
0
        public IList<MenuItem> GetAllPaging(int from, int to, ref int totalRows, string keyword)
        {

            MenuItem obj = new MenuItem();

            IList<MenuItem> colobj = new List<MenuItem>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "[DBO].[usp_SelectMenuItemsSearchPaging]";

            #region Paramters

            SqlParameter pTotalRows = new SqlParameter("TotalRows", SqlDbType.Int);
            pTotalRows.Value = totalRows;
            pTotalRows.Direction = ParameterDirection.Output;
            _command.Parameters.Add(pTotalRows);

            SqlParameter pFrom = new SqlParameter("From", SqlDbType.Int);
            pFrom.Value = from;
            pFrom.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pFrom);

            SqlParameter pTo = new SqlParameter("To", SqlDbType.Int);
            pTo.Value = to;
            pTo.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pTo);

            SqlParameter pKeyword = new SqlParameter("@Keyword", SqlDbType.NVarChar);
            pKeyword.Value = keyword;
            pKeyword.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pKeyword);

            #endregion

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {

                        while (_dtreader.Read())
                        {
                            obj = GetMenuItem(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                totalRows = Convert.ToInt32(pTotalRows.Value);
                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Ejemplo n.º 10
0
        public IList<MenuItem> GetAllPublishedSearchforAdmin(string keyword, int catid, int menuID)
        {

            MenuItem obj = new MenuItem();

            IList<MenuItem> colobj = new List<MenuItem>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "MenuGetallSearchforAdmin";

            #region [Parameters]
            SqlParameter parametercatID = new SqlParameter(PN_CATEGORYID, SqlDbType.Int);
            parametercatID.Value = catid;
            parametercatID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parametercatID);

            SqlParameter pkeyword = new SqlParameter("KEYWORD", SqlDbType.NVarChar);
            pkeyword.Value = keyword;
            pkeyword.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pkeyword);

            SqlParameter pMenuID = new SqlParameter(PN_MENUID, SqlDbType.Int);
            pMenuID.Value = menuID;
            pMenuID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pMenuID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {

                        while (_dtreader.Read())
                        {
                            obj = GetMenuItem(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Ejemplo n.º 11
0
        public IList<MenuItem> GetAllforLang()
        {

            MenuItem obj = new MenuItem();

            IList<MenuItem> colobj = new List<MenuItem>();
            _connection.ConnectionString = ConfigManager.GetConnectionSecondary();

            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTALLMenuItem;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {

                        while (_dtreader.Read())
                        {
                            obj = GetMenuItem(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Ejemplo n.º 12
0
 private void GetEntityFromReader(SqlDataReader _dtr, MenuItem obj)
 {
     PopulateMenuItem(_dtr, obj);
 }
Ejemplo n.º 13
0
        public MenuItem GetByID(int ID)
        {

            MenuItem obj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTMenuItem;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = ID;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new MenuItem();
                        if (_dtreader.Read())
                            GetEntityFromReader(_dtreader, obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return obj;
        }