Ejemplo n.º 1
0
 private void BindingData()
 {
     try
     {
         sizeCollection col = null;
         col = this.LoadData(txtSearch.Text.Trim());
         if (col == null)
         {
             col                = new sizeCollection();
             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);
     }
 }
Ejemplo n.º 2
0
    private sizeCollection GetSubData(sizeCollection Source, int start, int end)
    {
        int            iTotalRecord = Source.Count;
        sizeCollection subSource    = new sizeCollection();

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

        try
        {
            size obj = new size();
            obj.DataObject = objdata;
            col            = obj.GetAll();
        }
        catch (Exception ex)
        {
            Global.WriteLogError("LoadData()" + ex);
        }
        finally
        {
            objdata.DeConnect();
        }
        return(col);
    }