예제 #1
0
    public static ListControl DBPopulate(this ListControl ddl, DBObject tableInfo,
                                         bool cacheDatasource = true,
                                         bool addSelect       = true, string chooseKey  = "seciniz", bool searchable        = false, int maxSelection = 0,
                                         string filter        = null, OrderBy sortOrder = OrderBy.Default, bool addIDPrefix = false)
    {
        DataTable dt = null;

        if (!cacheDatasource)
        {
            dt = GetLookupData(tableInfo, filter, sortOrder, addIDPrefix);
        }
        else
        {
            string cacheKey = string.Join(":", tableInfo.TableName, filter);
            dt = CacheManager.Get <DataTable>("dbpopulate", cacheKey, typeof(Populator), "GetLookupData", tableInfo, filter, sortOrder, addIDPrefix);
        }
        ddl.BindDatatable(dt, addSelect, addIDPrefix, chooseKey, tableInfo.NameColumn, tableInfo.IDColumn);
        if (searchable)
        {
            ddl.Chosen(chooseKey, maxSelection);
        }
        return(ddl);
    }