Esempio n. 1
0
    private DataTable dataSource()
    {
        DiamondProcessCode _db = new DiamondProcessCode();

        try
        {
            string[] ids      = Request.QueryString["code"].Split(',');
            string   idString = Request.QueryString["code"];
            if (ids.Length > 1)
            {
                idString = ids[0];
            }
            string[] sKey = idString.Split('-');
            if (sKey.Length > 0)
            {
                idString = "";
                for (int i = 1; i < sKey.Length; i++)
                {
                    idString += sKey[i] + "-";
                }
            }

            return(_db.GetTopPost(10, idString, true));
        }
        catch
        {
            return(_db.GetListPost("", null, null, true));
        }
    }
Esempio n. 2
0
    private string getPostForMenu(string linkURL)
    {
        string htmlNews = "";

        DiamondProcessCode _diamond = new DiamondProcessCode();

        DataRow infoCategory = _diamond.GetSingleCategory(null, linkURL.Replace(".hxml", ""), true);

        if (infoCategory != null)
        {
            int idCategory = BaseView.GetIntFieldValue(infoCategory, "isPatient");
            if (idCategory == 0)
            {
                idCategory = BaseView.GetIntFieldValue(infoCategory, "id");
            }
            DataTable dataNews  = _diamond.GetListPost("", idCategory, null, true);
            int       rowsCount = 0;
            rowsCount = dataNews.Rows.Count < 8 ? dataNews.Rows.Count : 8;
            for (int i = 0; i < rowsCount; i++)
            {
                DataRow infoNews = dataNews.Rows[i];
                htmlNews += "<div class='col-md-3' style='padding: 5px;'>";
                string hinh = BaseView.GetStringFieldValue(infoNews, "HinhAnh");
                if (hinh.IndexOf("http") == -1 && hinh.Trim() != "")
                {
                    hinh = BaseView.pathImagesPost() + hinh;
                }

                htmlNews += "<div class='practise-area'>";
                htmlNews += "<div class='thumb-top'>";
                htmlNews += "<a href='" + BaseView.GetStringFieldValue(infoNews, "id_tt") + "'>";
                htmlNews += "<img  src='" + hinh + "' alt='" + BaseView.GetStringFieldValue(infoNews, "TieuDe") + "' /></a>";
                htmlNews += "</div>";
                htmlNews += "<div class=''>";
                htmlNews += "<p class='details'>" + BaseView.GetStringFieldValue(infoNews, "TieuDe") + "</p>";
                //htmlNews += "<a href='" + BaseView.UrlServer() + "/" + BaseView.GetStringFieldValue(infoNews, "id_tt") + "'>Xem thêm <i class='fa fa-arrow-circle-right'></i></a>";
                htmlNews += "</div>";
                htmlNews += "</div>";
                htmlNews += "</div>";
            }
        }

        return(htmlNews);
    }
    void BindItemsList()
    {
        //Process data here
        string code = "";

        if (!String.IsNullOrEmpty(Request.QueryString["code"]))
        {
            code = Request.QueryString["code"];
        }
        DataTable          data         = new DataTable();
        DiamondProcessCode _dm          = new DiamondProcessCode();
        DataRow            infoCategory = _dm.GetSingleCategory(null, code, true);

        if (infoCategory != null)
        {
            int idCategory = BaseView.GetIntFieldValue(infoCategory, "id");
            data = _dm.GetListPost("", idCategory, null, true);
        }
        //fill dataTable from Database

        _PageDataSource.DataSource  = data.DefaultView;
        _PageDataSource.AllowPaging = true;
        _PageDataSource.PageSize    = 8;


        _PageDataSource.CurrentPageIndex = CurrentPage;
        ViewState["TotalPages"]          = _PageDataSource.PageCount;
        this.dataPost.DataSource         = _PageDataSource;
        this.dataPost.DataBind();
        if (dataPost.Items.Count > 0)
        {
            this.doPaging();
        }
        else
        {
            //Message.Visible = true;
            //ShowMessage.Visible = true;
            //Message.Text = "Sorry,There is No Products yet !.";
        }
    }