Exemplo n.º 1
0
 private void BindingData()
 {
     try
     {
         ctCollection col = null;
         col = this.LoadData(txtSearch.Text.Trim());
         if (col == null)
         {
             col                = new ctCollection();
             lblcount.Text      = "Có 0" + " record";
             rptData.DataSource = col;
             rptData.DataBind();
         }
         else
         {
             lblcount.Text          = "Có " + col.Count.ToString() + " record";
             lblcount.ForeColor     = System.Drawing.Color.Blue;
             anpPager.RecordCount   = col.Count;
             anpPager.PageSize      = Convert.ToInt32(ddlPageSize.SelectedValue);
             anpPager.ShowFirstLast = false;
             col = this.GetSubData(col, anpPager.StartRecordIndex - 1, anpPager.EndRecordIndex);
             rptData.DataSource = col;
             rptData.DataBind();
         }
     }
     catch (Exception ex)
     {
         Global.WriteLogError("BindingData()" + ex);
     }
 }
Exemplo n.º 2
0
    private ctCollection GetSubData(ctCollection Source, int start, int end)
    {
        int          iTotalRecord = Source.Count;
        ctCollection subSource    = new ctCollection();

        if (Source != null)
        {
            for (int i = start; i < end; i++)
            {
                subSource.Add(Source[i]);
            }
        }
        return(subSource);
    }
Exemplo n.º 3
0
    private ctCollection LoadData(string stextsearch)
    {
        Data         objdata = new Data(Global.ConnectionSql);
        ctCollection col     = null;

        try
        {
            ct obj = new ct();
            obj.DataObject = objdata;
            col            = obj.Getlist(stextsearch);
        }
        catch (Exception ex)
        {
            Global.WriteLogError("LoadCategory()" + ex);
        }
        finally
        {
            objdata.DeConnect();
        }
        return(col);
    }