Example #1
0
        public void Insert(ref DBHelper dbInstance, IStateNews objNews, IImageDetail objImageDetail, IUsers user)
        {
            try
            {
                dbInstance.ClearAllParameters();
                dbInstance.AddInParameter("@EditorID", objNews.EditorID, DbType.String);
                dbInstance.AddInParameter("@DisplayOrder", objNews.DisplayOrder, DbType.Int32);
                dbInstance.AddInParameter("@Heading", objNews.Heading, DbType.String);
                dbInstance.AddInParameter("@ShortDescription", objNews.ShortDescription, DbType.String);
                dbInstance.AddInParameter("@NewsDescription", objNews.NewsDescription, DbType.String);
                dbInstance.AddInParameter("@LanguageID", objNews.LanguageID, DbType.Int32);
                dbInstance.AddInParameter("@StateCode", objNews.StateCode, DbType.String);
                dbInstance.AddInParameter("@IsTopNews", objNews.IsTopNews, DbType.Int32);
                dbInstance.AddInParameter("@ImageUrl", objImageDetail.ImageUrl, DbType.String);
                dbInstance.AddInParameter("@Caption", objImageDetail.Caption, DbType.String);
                dbInstance.AddInParameter("@CaptionLink", objImageDetail.CaptionLink, DbType.String);
                dbInstance.AddInParameter("@ImageType", objImageDetail.ImageType, DbType.Int32);
                dbInstance.AddInParameter("@IsFirst", objImageDetail.IsFirst, DbType.Int32);
                dbInstance.AddInParameter("@UserID", user.UserID, DbType.Int64);

                dbInstance.ExecuteNonQuery(ProcedureName.InsertStateNews, CommandType.StoredProcedure);
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
        }
Example #2
0
 public void MakeActive(ref DBHelper dbHelper, ITopNews objTopNews, IUsers user)
 {
     try
     {
         dbHelper.ClearAllParameters();
         dbHelper.AddInParameter("@TopNewsID", objTopNews.TopNewsID, DbType.String);
         dbHelper.AddInParameter("@IsActive", objTopNews.IsActive, DbType.Int32);
         dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64);
         dbHelper.ExecuteNonQuery(ProcedureName.MakeActiveTopNews, CommandType.StoredProcedure);
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
 }
Example #3
0
 public void GiveApproval(ref DBHelper dbHelper, IInterNews objNews, IUsers user)
 {
     try
     {
         dbHelper.ClearAllParameters();
         dbHelper.AddInParameter("@NewsID", objNews.NewsID, DbType.String);
         dbHelper.AddInParameter("@IsApproved", objNews.IsApproved, DbType.Int32);
         dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64);
         dbHelper.ExecuteNonQuery(ProcedureName.MakeApprovedInterNews, CommandType.StoredProcedure);
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
 }
Example #4
0
        internal void Update(ref DBHelper dbHelper, IStateNews news, IImageDetail image, IUsers user)
        {
            try
            {
                dbHelper.ClearAllParameters();
                dbHelper.AddInParameter("@NewsID", news.NewsID, DbType.String);
                dbHelper.AddInParameter("@EditorID", news.EditorID, DbType.String);
                dbHelper.AddInParameter("@DisplayOrder", news.DisplayOrder, DbType.Int32);
                dbHelper.AddInParameter("@Heading", news.Heading, DbType.String);
                dbHelper.AddInParameter("@ShortDescription", news.ShortDescription, DbType.String);
                dbHelper.AddInParameter("@NewsDescription", news.NewsDescription, DbType.String);
                dbHelper.AddInParameter("@LanguageID", news.LanguageID, DbType.Int32);
                dbHelper.AddInParameter("@StateCode", news.StateCode, DbType.String);
                dbHelper.AddInParameter("@IsActive", news.IsActive, DbType.Int32);
                dbHelper.AddInParameter("@IsApproved", news.IsApproved, DbType.Int32);
                dbHelper.AddInParameter("@IsTopNews", news.IsTopNews, DbType.Int32);
                dbHelper.AddInParameter("@ImageUrl", image.ImageUrl, DbType.String);
                dbHelper.AddInParameter("@Caption", image.Caption, DbType.String);
                dbHelper.AddInParameter("@CaptionLink", image.CaptionLink, DbType.String);
                dbHelper.AddInParameter("@ImageType", image.ImageType, DbType.Int32);
                dbHelper.AddInParameter("@IsFirst", image.IsFirst, DbType.Int32);
                dbHelper.AddInParameter("@IsActieImage", image.IsActive, DbType.Int32);
                dbHelper.AddInParameter("@UserID", user.UserID, DbType.Int64);

                dbHelper.ExecuteNonQuery(ProcedureName.UpdateStateNews, CommandType.StoredProcedure);
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
        }
Example #5
0
        // need to write
        internal IEnumerable<IStateNews> SelectForPartialNewsList(string StateCode, Int64 NextPageValue)
        {
            IDataReader objDataReader = null;
            List<IStateNews> objNewsList = null;
            IStateNews objNews = null;

            DBHelper dbHelper = new DBHelper();
            try
            {
                dbHelper.AddInParameter("@StateCode", StateCode, DbType.String);
                dbHelper.AddInParameter("@NextPageValue", NextPageValue, DbType.Int64);
                objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectPartialStateNewsListApi, CommandType.StoredProcedure);

                if (objDataReader != null)
                {
                    objNewsList = new List<IStateNews>();
                    do
                    {
                        while (objDataReader.Read())
                        {
                            objNews = new StateNews();

                            if (!objDataReader.IsDBNull(0))
                                objNews.NewsID = objDataReader.GetString(0);

                            if (!objDataReader.IsDBNull(1))
                                objNews.EditorID = objDataReader.GetString(1);

                            if (!objDataReader.IsDBNull(2))
                                objNews.DisplayOrder = objDataReader.GetInt32(2);

                            if (!objDataReader.IsDBNull(3))
                                objNews.Heading = objDataReader.GetString(3);

                            if (!objDataReader.IsDBNull(4))
                                objNews.ShortDescription = objDataReader.GetString(4);

                            if (!objDataReader.IsDBNull(5))
                                objNews.NewsDescription = objDataReader.GetString(5);

                            if (!objDataReader.IsDBNull(6))
                                objNews.LanguageID = objDataReader.GetInt32(6);

                            if (!objDataReader.IsDBNull(7))
                                objNews.StateCode = objDataReader.GetString(7);

                            if (!objDataReader.IsDBNull(8))
                                objNews.IsApproved = objDataReader.GetInt32(8);

                            if (!objDataReader.IsDBNull(9))
                                objNews.IsActive = objDataReader.GetInt32(9);

                            if (!objDataReader.IsDBNull(10))
                                objNews.IsTopNews = objDataReader.GetInt32(10);

                            if (!objDataReader.IsDBNull(11))
                                objNews.DttmCreated = objDataReader.GetDateTime(11);

                            if (!objDataReader.IsDBNull(12))
                                objNews.DttmModified = objDataReader.GetDateTime(12);

                            if (!objDataReader.IsDBNull(13))
                                objNews.ImageUrl = objDataReader.GetString(13);

                            if (!objDataReader.IsDBNull(14))
                                objNews.ImageCaption = objDataReader.GetString(14);

                            if (!objDataReader.IsDBNull(15))
                                objNews.ImageCaptionLink = objDataReader.GetString(15);

                            objNewsList.Add(objNews);
                        }

                    }
                    while (objDataReader.NextResult());
                }

                if (!objDataReader.IsClosed)
                    objDataReader.Close();
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            finally
            {
                dbHelper.ClearAllParameters();
                dbHelper.CloseConnection();
                dbHelper.Dispose();
            }

            return objNewsList;
        }
Example #6
0
        public List<ITopNews> SelectTopNewsForActivate()
        {
            IDataReader objDataReader = null;
            List<ITopNews> objTopNewsList = null;
            ITopNews objTopNews = null;

            DBHelper dbHelper = new DBHelper();
            try
            {
                objDataReader = dbHelper.ExecuteDataReader(ProcedureName.SelectAllTopNews, CommandType.StoredProcedure);

                if (objDataReader != null)
                {
                    objTopNewsList = new List<ITopNews>();
                    do
                    {
                        while (objDataReader.Read())
                        {
                            objTopNews = new TopNews();

                            if (!objDataReader.IsDBNull(0))
                                objTopNews.TopNewsID = objDataReader.GetString(0);

                            if (!objDataReader.IsDBNull(1))
                                objTopNews.EditorID = objDataReader.GetString(1);

                            if (!objDataReader.IsDBNull(2))
                                objTopNews.DisplayOrder = objDataReader.GetInt32(2);

                            if (!objDataReader.IsDBNull(3))
                                objTopNews.Heading = objDataReader.GetString(3);

                            if (!objDataReader.IsDBNull(4))
                                objTopNews.ShortDescription = objDataReader.GetString(4);

                            if (!objDataReader.IsDBNull(5))
                                objTopNews.NewsDescription = objDataReader.GetString(5);

                            if (!objDataReader.IsDBNull(6))
                                objTopNews.LanguageID = objDataReader.GetInt32(6);

                            if (!objDataReader.IsDBNull(7))
                                objTopNews.IsApproved = objDataReader.GetInt32(7);

                            if (!objDataReader.IsDBNull(8))
                                objTopNews.IsActive = objDataReader.GetInt32(8);

                            if (!objDataReader.IsDBNull(9))
                                objTopNews.DttmCreated = objDataReader.GetDateTime(9);

                            if (!objDataReader.IsDBNull(10))
                                objTopNews.DttmModified = objDataReader.GetDateTime(10);

                            if (!objDataReader.IsDBNull(11))
                                objTopNews.ImageUrl = objDataReader.GetString(11);

                            if (!objDataReader.IsDBNull(12))
                                objTopNews.ImageCaption = objDataReader.GetString(12);

                            objTopNewsList.Add(objTopNews);
                        }

                    }
                    while (objDataReader.NextResult());
                }

                if (!objDataReader.IsClosed)
                    objDataReader.Close();
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            finally
            {
                dbHelper.ClearAllParameters();
                dbHelper.CloseConnection();
                dbHelper.Dispose();
            }

            return objTopNewsList;
        }