/// <summary> /// Возвращает список документов попадающих в запрос /// </summary> /// <param name="queryDef">Запрос на выборку данных</param> /// <param name="pageNo">Номер страницы</param> /// <param name="pageSize">Количество строк на странице</param> /// <returns>Список идентификаторв документов</returns> public List <Guid> GetDocList(QueryDef queryDef, int pageNo, int pageSize) { /*using (var query = new DocQuery(queryDef, DataContext)) * { * return pageSize <= 0 * ? query.All().ToList() * : query.Take(pageNo * pageSize, pageSize).ToList(); * }*/ var sqb = _sqlQueryBuilderFactory.Create(); using (var query = sqb.Build(queryDef)) { query.AddAttribute("&Id"); using (var reader = _sqlQueryReaderFactory.Create(query)) { reader.Open(); var i = reader.GetAttributeIndex("&Id"); var result = new List <Guid>(); while (reader.Read()) { result.Add(reader.GetGuid(i)); } return(result); } } }
private SqlQueryDataSet CreateDataSet(SqlQuery query) { var reader = _sqlQueryReaderFactory.Create(query); //new SqlQueryReader(DataContext, query); return(Provider != null ? new SqlQueryDataSet(Provider, reader) : new SqlQueryDataSet(reader, UserId)); }
private SqlQueryReader GetReader() { return(_readerFactory.Create(Query)); //new SqlQueryReader(DataContext, Query); }
public List <EnumValue> GetEnumDocumentValues(BizComboBox combo, DocDef detailDocDef, Guid?userId) { var list = new List <EnumValue>(); if (detailDocDef == null) { return(list); } //var defRepo = new DocDefRepository(context); var docDef = _docDefRepo.DocDefById(detailDocDef.Id); AttrDef detailAttrDef; if (combo.DetailAttributeId != null) { detailAttrDef = docDef.Attributes.FirstOrDefault(ad => ad.Id == combo.DetailAttributeId); } else { detailAttrDef = docDef.Attributes.FirstOrDefault( ad => String.Equals(ad.Name, combo.DetailAttributeName, StringComparison.OrdinalIgnoreCase)); if (detailAttrDef == null) { detailAttrDef = docDef.Attributes.FirstOrDefault( ad => ad.Type.Id == (int)CissaDataType.Text); } } if (detailAttrDef == null) { return(list); } var sqb = _sqlQueryBuilderFactory.Create(); // using (var query = userId != null ? new SqlQuery(context, docDef, (Guid)userId) : new SqlQuery(context, docDef)) // using (var query = sqb.Build(docDef.Id, null, null)) using (var query = sqb.Build(combo, docDef.Id)) { query.AddAttribute("&Id"); query.AddAttribute(detailAttrDef.Id); query.AddOrderAttribute(detailAttrDef.Id); using (var reader = _sqlQueryReaderFactory.Create(query)) //new SqlQueryReader(context, query)) { while (reader.Read()) { var detail = !reader.IsDbNull(1) ? reader.GetString(1) : String.Empty; list.Add(new EnumValue { Id = reader.GetGuid(0), Value = detail, DefaultValue = detail }); } } } return(list); }
public SqlQueryReader CreateSqlReader(SqlQuery query) { return(_sqlQueryReaderFactory.Create(query)); // return new SqlQueryReader(DataContext, query); }