Exemplo n.º 1
0
        public IList<Sawtyyat> GetAllByType(RootEnums.AudioVideoType _rootEnums, int from, int to, ref int totalrows, int catid, string keyword)
        {

            Sawtyyat obj = null;

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

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_TYPE, SqlDbType.Int);
            parameterID.Value = Convert.ToInt32(_rootEnums);
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);

            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 pTotalRows = new SqlParameter("TotalRows", SqlDbType.Int);
            pTotalRows.Value = 0;
            pTotalRows.Direction = ParameterDirection.Output;
            _command.Parameters.Add(pTotalRows);

            SqlParameter pcatID = new SqlParameter("CategoryID", SqlDbType.Int);
            pcatID.Value = catid;
            pcatID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pcatID);

            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)
                    {
                        obj = new Sawtyyat();
                        colobj = new List<Sawtyyat>();
                        while (_dtreader.Read())
                        {
                            obj = GetSawtyyat(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                totalrows = Convert.ToInt32(pTotalRows.Value);
                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Exemplo n.º 2
0
        public XmlDocument GetAllByTypeAsXml(RootEnums.AudioVideoType _rootEnums, int _catid)
        {
            XmlDocument xDoc = new XmlDocument();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "dbo.SawtyyatGetByTypeasXml";



            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_TYPE, SqlDbType.Int);
            parameterID.Value = Convert.ToInt32(_rootEnums);
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);

            SqlParameter _catID = new SqlParameter(PN_CATEGORY_ID, SqlDbType.Int);
            _catID.Value = Convert.ToInt32(_catid);
            _catID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(_catID);
            #endregion;

            string _xml = "<Data>";

            _connection.Open();
            XmlReader _reader = null;
            try
            {
                using (_reader = _command.ExecuteXmlReader())
                {
                    _reader.Read();
                    while (_reader.ReadState != ReadState.EndOfFile)
                    {
                        _xml += _reader.ReadOuterXml();
                      
                    }
                    _xml = _xml.Replace("dbo.", "");
                    _xml += "</Data>";
                    xDoc.LoadXml(_xml);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _reader.Close();
                _connection.Close();
            }

            return xDoc;
        }
Exemplo n.º 3
0
        public IList<Sawtyyat> GetAllByType(RootEnums.AudioVideoType _rootEnums)
        {

            Sawtyyat obj = null;

            IList<Sawtyyat> colobj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTALLSawtyyat;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_TYPE, SqlDbType.Int);
            parameterID.Value = Convert.ToInt32(_rootEnums);
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new Sawtyyat();
                        colobj = new List<Sawtyyat>();
                        while (_dtreader.Read())
                        {
                            obj = GetSawtyyat(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

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

            return colobj;
        }
Exemplo n.º 4
0
        public static IList<Sawtyyat> GetAllByType(RootEnums.AudioVideoType type, int from, int to, ref int totalrows, string keyword, int catid)
        {
            SawtyyatDataMapper objCaller = new SawtyyatDataMapper();

            return objCaller.GetAllByType(type, from, to, ref totalrows, catid, keyword);
        }
Exemplo n.º 5
0
        public static XmlDocument GetAllByTypeAsXml(RootEnums.AudioVideoType type, int catid)
        {
            SawtyyatDataMapper objCaller = new SawtyyatDataMapper();

            return objCaller.GetAllByTypeAsXml(type, catid);
        }
Exemplo n.º 6
0
        public static IList<Sawtyyat> GetAllByType(RootEnums.AudioVideoType type)
        {
            SawtyyatDataMapper objCaller = new SawtyyatDataMapper();

            return objCaller.GetAllByType(type);
        }