public int SelectAllCount(string keyword)
        {
            keyword = keyword.Replace(" ", "+");
            DataTable tbl = null;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Course_SearchCount",
                                             new object[] { keyword },
                                             new string[] { "@keyword" },
                                             true);
            }
            return(tbl != null?Convert.ToInt32(tbl.Rows[0][0]) : 0);
        }
        ///  SelectOne ChannelResponse-------------------------------------------------------
        public ChannelResponse SelectOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_ChannelResponse_SelectOne", new object[] { ChannelResponse_ID }, new string[] { "@ChannelResponse_ID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        public CourseLog SelectOneByCourseID(int courseID)
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_CourseLog_SelectOneByCourseID", new object[] { courseID }, new string[] { "@Course_ID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        public List <Question> SelectAllSearchByUser(int pageSize, int pageIndex, string keyword, int idCourse, string user)
        {
            List <Question> ls = new List <Question>();

            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_Question_SearchByUser", new object[] { pageIndex, pageSize, keyword, idCourse, user }, new string[] { "@pageIndex", "@pageSize", "@keyword", "@courseID", "@user" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
        ///  SelectAllSearch ChannelResponse-------------------------------------------------------
        public List <ChannelResponse> SelectAllBySourseIDActive(int sourseID)
        {
            List <ChannelResponse> ls = new List <ChannelResponse>();

            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_ChannelResponse_SelectAllBySourseIDActive", new object[] { sourseID }, new string[] { "@sourse_ID" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
        public int SelectAllStatusCount(string keyword, int courseID, int status)
        {
            keyword = keyword.Replace(" ", "+");
            DataTable tbl = null;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Question_SearchStatusCount",
                                             new object[] { keyword, courseID, status },
                                             new string[] { "@keyword", "@courseID", "@status" },
                                             true);
            }
            return(tbl != null?Convert.ToInt32(tbl.Rows[0][0]) : 0);
        }
        ///  SelectOne DatMuaBanTinVang-------------------------------------------------------
        public DatMuaBanTinVang SelectOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_DatMuaBanTinVang_SelectOne", new object[] { UserID }, new string[] { "@UserID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        ///  SelectOne Adv_Position-------------------------------------------------------
        public Adv_Position SelectOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Adv_Position_SelectOne", new object[] { PosID }, new string[] { "@PosID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        ///  Insert Gallery-------------------------------------------------------
        public int Insert()
        {
            int result = 0;

            using (MainDB db = new MainDB())
            {
                DataTable tbl = db.CallStoredProcedure("CMS_Gallery_Insert", new object[] { Name }, new string[] { "@Name" }, true) as DataTable;
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    result = (int)tbl.Rows[0]["ID"];
                }
            }
            return(result);
        }
        ///  SelectOne Gallery-------------------------------------------------------
        public Gallery SelectOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = (DataTable)db.CallStoredProcedure("CMS_Gallery_SelectOne", new object[] { ID }, new[] { "@ID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        /// SelectAll Adv_Page_Position-------------------------------------------------------
        public List <Adv_Page_Position> SelectAllByAdvID(int advID)
        {
            List <Adv_Page_Position> ls = new List <Adv_Page_Position>();

            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_Adv_Page_Position_SelectAllByAdvID", new object[] { advID }, new string[] { "@advID" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
Exemple #12
0
        public List <Vote_Item> SelectAllByVoteID(int voteID)
        {
            List <Vote_Item> ls = new List <Vote_Item>();

            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_Vote_Item_SelectByVoteID", new object[] { voteID }, new string[] { "@Vote_ID" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
Exemple #13
0
        ///  SelectOne Vote_Item-------------------------------------------------------
        public Vote_Item SelectOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Vote_Item_SelectOne", new object[] { VoteIt_ID }, new string[] { "@VoteIt_ID" }, true);
                if (tbl != null && tbl.Rows.Count > 0)
                {
                    return(MapObject(tbl.Rows[0]));
                }
            }
            return(null);
        }
        public List <CourseLog> SelectAllByCourseID(int courseID)
        {
            List <CourseLog> ls = new List <CourseLog>();

            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_CourseLog_SelectAllByCourseID", new object[] { courseID }, new string[] { "@Course_ID" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
Exemple #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="commentType"></param>
        /// <param name="commentApproved"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public int Count(int commentType, int commentApproved, string keyword)
        {
            keyword = keyword.Replace(" ", "+");
            DataTable tbl = null;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Comment_Search_Count",
                                             new object[] { commentType, commentApproved, keyword },
                                             new string[] { "@Comment_Type", "@Comment_Approved", "@keyword" },
                                             true);
            }

            return(tbl != null?Convert.ToInt32(tbl.Rows[0][0]) : 0);
        }
Exemple #16
0
        ///  SelectAllSearch WebLink-------------------------------------------------------
        public List <WebLink> SelectAllSearch(int pageSize, int pageIndex, string keyword)
        {
            List <WebLink> ls = new List <WebLink>();

            keyword = "%" + keyword.Trim() + "%";
            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_WebLink_Search", new object[] { pageIndex, pageSize, keyword }, new string[] { "@pageIndex", "@pageSize", "@keyword" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
Exemple #17
0
        ///  SelectAllSearch ReportPageView-------------------------------------------------------
        public List <ReportPageView> SelectAllSearch(int pageSize, int pageIndex, string keyword)
        {
            List <ReportPageView> ls = new List <ReportPageView>();

            keyword = keyword.Replace(" ", "+");
            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_ReportPageView_Search", new object[] { pageIndex, pageSize, keyword }, new string[] { "@pageIndex", "@pageSize", "@keyword" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
        /// SelectAll Advertisments-------------------------------------------------------
        public List <Advertisments> SelectAllLikeByPagePosition(string keyword, int page, int position)
        {
            List <Advertisments> ls = new List <Advertisments>();

            keyword = keyword.Replace('"', ' ');
            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_Advertisments_SelectAllLikeByPagePosition", new object[] { keyword, page, position }, new string[] { "@keyword", "@page", "@position" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
        /// SelectAll Adv_Position-------------------------------------------------------
        public List <Adv_Position> SelectAllLike(string keyword)
        {
            List <Adv_Position> ls = new List <Adv_Position>();

            keyword = keyword.Replace('"', ' ');
            using (MainDB db = new MainDB())
            {
                DataTable dt = db.CallStoredProcedure("CMS_Adv_Position_SelectAllLike", new object[] { keyword }, new string[] { "@keyword" }, true);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ls.Add(MapObject(dt.Rows[i]));
                }
            }
            return(ls);
        }
        public static string GetTempIDByNewsID(Int64 news_id)
        {
            string    strReturn = "";
            DataTable dt;

            using (MainDB objDb = new MainDB())
            {
                dt = (DataTable)objDb.CallStoredProcedure("be_GetTempIDByNewsID", new object[] { news_id, HttpContext.Current.User.Identity.Name }, new string[] { "@news_id", "@username" }, true);
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                strReturn = dt.Rows[0]["temp_id"].ToString();
            }

            return(strReturn);
        }
Exemple #21
0
        public static DataTable List(string catIDs, string fromDate, string toDate, string newsTitle, int focus, int type, int pageSize, int startRow, string sortExpression)
        {
            newsTitle = CoreBO.Utils.SQL.HandleParamFTS(newsTitle);

            string dateField = "News_ModifiedDate";

            if (HttpContext.Current.Request["cpmode"] == "publishedlist")
            {
                dateField = "News_PublishDate";
            }

            using (MainDB objdb = new MainDB()) {
                return((DataTable)objdb.CallStoredProcedure("s_ListNews",
                                                            new object[] { catIDs, fromDate, toDate, newsTitle, focus.ToString(), type.ToString(), sortExpression, dateField, (startRow + 1).ToString(), (startRow + pageSize).ToString() },
                                                            new string[] { "@catIDs", "@fromDate", "@toDate", "@newsTitle", "@focus", "@type", "@sortExpression", "@dateField", "@startRow", "@endRow" }, true));
            }
        }
        public static bool CheckExistTempID(Int64 temp_id)
        {
            int k;

            using (MainDB objDb = new MainDB())
            {
                k = Convert.ToInt32(((DataTable)objDb.CallStoredProcedure("[be_CheckExistTempID]", new object[] { temp_id }, new string[] { "temp_id" }, true)).Rows[0][0]);
            }
            if (k > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }

            return(false);
        }
Exemple #23
0
        //CMS_Comment_GetOne

        public Comment GetOne()
        {
            DataTable tbl;

            using (MainDB db = new MainDB())
            {
                tbl = db.CallStoredProcedure("CMS_Comment_GetOne",
                                             new object[] { this.Comment_ID },
                                             new string[] { "@Comment_ID" },
                                             true);
            }

            if (tbl != null && tbl.Rows.Count > 0)
            {
                return(MapObject(tbl.Rows[0]));
            }

            return(null);
        }
Exemple #24
0
 public static bool SetTieuDiem(long newsID, bool tieudiem)
 {
     using (MainDB db = new MainDB()) {
         return((int)db.CallStoredProcedure("CMS_News_SetTieuDiem", new object[] { newsID, tieudiem }, new string[] { "@News_ID", "@News_isFocus" }, false) == 1);
     }
 }
Exemple #25
0
 public static bool SetLoaiTin(long newsID, int loaitin)
 {
     using (MainDB db = new MainDB()) {
         return((int)db.CallStoredProcedure("CMS_News_SetLoaiTin", new object[] { newsID, loaitin }, new string[] { "@News_ID", "@News_Mode" }, false) == 1);
     }
 }
Exemple #26
0
 public static DataTable GetUsersByPermission(int permissionID)
 {
     using (MainDB db = new MainDB())
         return(db.CallStoredProcedure("s_GetUsersByPermission", new object[] { permissionID }, new string[] { "@permissionID" }, true));
 }
Exemple #27
0
 public static void SynchronizeNhuanBut()
 {
     using (MainDB db = new MainDB())
         db.CallStoredProcedure("s_SynchronizeNhuanBut", new object[] { }, new string[] { }, false);
 }