private void AdjustDocListForms(BizControl form) { if (form.Children != null) { foreach (var control in form.Children) { var listForm = control as BizDocumentListForm; if (listForm != null) { if (listForm.Children != null && listForm.Children.Count > 0) { _adjuster.AddTableForm(listForm); } else if (listForm.TableForm != null) { _adjuster.AddTableForm(listForm.TableForm); } } else { AdjustDocListForms(control); } } } }
public static SqlQuery BuildAttrList(BizControl form, Guid docId, Guid docDefId, Guid attrDefId, BizForm filter, IEnumerable <AttributeSort> sortAttrs, Guid userId, IDataContext dataContext) { var factory = AppServiceProviderFactoryProvider.GetFactory(); using (var provider = factory.Create(dataContext)) { var sqb = new SqlQueryBuilderTool(provider, dataContext, userId); return(sqb.BuildAttrList(form, docId, docDefId, attrDefId, filter, sortAttrs)); } /*var query = new SqlQuery(docDefId, docId, attrDefId, dataContext); * try * { * query.AddAttribute("&Id"); * AddFormAttributes(query, query.Source, form); * if (filter != null) * AddFormConditions(query, query.Source, filter); * * if (sortAttrs != null) * foreach (var attr in sortAttrs) * { * query.AddOrderAttribute(attr.AttributeId, attr.Asc); * } * else * AddFormSortOrders(query, query.Source, form); * * return query; * } * catch * { * query.Dispose(); * throw; * }*/ }
protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control) { if (control.Invisible) { return; } band.AddGroup(new XlsTextNode(control.Caption)); if (DataSet != null) { gridRow.AddDataField(new DocFormDataSetField(DataSet, control)); } else if (SqlDataSet != null) { if (!(control is BizDataControl)) { return; } var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty) ?? SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeName); if (attr != null) { gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control)); } } }
public static BaseDataType GetDataType(BizControl control) { if (control is BizEditInt) { return(BaseDataType.Int); } if (control is BizEditText) { return(BaseDataType.Text); } if (control is BizEditBool) { return(BaseDataType.Bool); } if (control is BizEditCurrency) { return(BaseDataType.Currency); } if (control is BizEditDateTime) { return(BaseDataType.DateTime); } if (control is BizEditFloat) { return(BaseDataType.Float); } if (control is BizComboBox) { return(BaseDataType.Text); } return(BaseDataType.Text); }
protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control, SqlQueryDataSet dataSet) { if (control.Invisible) { return; } var header = new XlsTextNode(control.Caption); band.AddGroup(header); var info = _adjuster.Find(control); var attr = dataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty); if (attr != null) { var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, attr, control)); if (info != null) { header.ColSpan = info.ColSpan; field.ColSpan = info.ColSpan; } } /* * var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, control)); * if (info != null) * { * header.ColSpan = info.ColSpan; * field.ColSpan = info.ColSpan; * // if (info.ColSpan == 1) * // field.Width = info.Size; * } */ }
protected void AddControlColumn(BizControl control) { if (control.Invisible) { return; } _columns.Add(new XlsTableFormControlAdjustInfo(control)); }
public SqlQueryDataSetField(SqlQueryDataSet dataSet, SqlQuerySelectAttribute attr, BizControl control) : base(dataSet) { AttrIndex = dataSet.Reader.Query.Attributes.IndexOf(attr); AttrDef = attr.Def; if (AttrDef == null) { Ident = attr.Ident; } Control = control; Grouping = SqlQuerySummaryFunction.None; SummaryValue = 0.0; var comboBoxValueProvider = dataSet.GetComboBoxEnumProvider(); if (AttrDef != null) { if (Control is BizComboBox) { switch (AttrDef.Type.Id) { case (short)CissaDataType.Enum: _enumItems = dataSet.GetEnumItems(AttrDef.EnumDefType.Id); break; case (short)CissaDataType.Organization: _enumItems = comboBoxValueProvider.GetEnumOrganizationValues(null); break; case (short)CissaDataType.User: _enumItems = comboBoxValueProvider.GetEnumUserValues(); break; case (short)CissaDataType.Doc: _enumItems = comboBoxValueProvider.GetEnumDocumentValues((BizComboBox)Control, AttrDef); break; } } else if (AttrDef.Type.Id == (short)CissaDataType.Enum && AttrDef.EnumDefType != null) { _enumItems = dataSet.GetEnumItems(AttrDef.EnumDefType.Id); } else if (AttrDef.Type.Id == (short)CissaDataType.Doc && AttrDef.DocDefType != null) { _enumItems = comboBoxValueProvider.GetEnumDocumentValues(AttrDef, "Name"); } else if (AttrDef.Type.Id == (short)CissaDataType.Organization) { _enumItems = comboBoxValueProvider.GetEnumOrganizationValues(null); } else if (AttrDef.Type.Id == (short)CissaDataType.User) { _enumItems = comboBoxValueProvider.GetEnumUserValues(); } } }
public XlsTableFormAdjustInfo(BizControl form) { FormId = form.Id; if (form.Children != null) { foreach (var control in form.Children) { AddControlBand(control); } } }
private static void IncludeDocControl(IQueryCondition cond, AttrDef attr, BizControl control) { // var exp = query.And(attr.Name); if (attr.DocDefType == null) { throw new ApplicationException(String.Format("Не могу сформировать запрос! Атрибут \"{0}\" не ссылается на класс документа", attr.Name)); } var docDef = attr.DocDefType; foreach (var ctrl in control.Children) { if (!(ctrl is BizDataControl) || ((BizDataControl)ctrl).AttributeDefId == null) { continue; } var attributeDefId = ((BizDataControl)ctrl).AttributeDefId; if (attributeDefId != null) { var attrId = (Guid)attributeDefId; var sub = docDef.Attributes.FirstOrDefault(a => a.Id == attrId); if (sub != null) { if (ctrl is BizDocumentControl) { IncludeDocControl(cond, sub, ctrl); continue; } if (((BizDataControl)ctrl).ObjectValue == null) { continue; } if (sub.Type.Id == (short)CissaDataType.Text) { var txt = ((BizDataControl)ctrl).ObjectValue.ToString(); if (!String.IsNullOrEmpty(txt)) { cond.Include(sub.Name).Contains(txt); } } else { cond.Include(sub.Name).Eq(((BizDataControl)ctrl).ObjectValue); } } } } }
public BizControl FindControlIn(BizControl control, Guid controlId) { if (control == null) { return(null); } if (control.Id == controlId) { return(control); } if (control.Children != null) { foreach (var child in control.Children) { if (child.Id == controlId) { return(child); } var docControl = child as BizDocumentControl; if (docControl != null && docControl.DocForm != null) { var docControlSub = FindControlIn(docControl.DocForm, controlId); if (docControlSub != null) { return(docControlSub); } } else { var docListControl = child as BizDocumentListForm; if (docListControl != null && docListControl.TableForm != null) { var docListControlSub = FindControlIn(docListControl.TableForm, controlId); if (docListControlSub != null) { return(docListControlSub); } } } var sub = FindControlIn(child, controlId); if (sub != null) { return(sub); } } } return(null); }
public TControl Find <TControl>(BizControl form, Guid id) where TControl : BizControl { if (form != null && form.Id == id) { return(form as TControl); } if (form != null && form.Children != null) { var control = FindControlById(id, form.Children); return(control as TControl); } return(null); }
public void SetRowForm(BizControl row) { Columns = new List <Column>(); /*foreach (var control in row.Children) * { * if (control.Invisible) continue; * if (control is BizTableColumn) AddColumnChildren(null, control); * else if (control is BizDocumentControl && control.Children != null && * control.Children.Count > 0) * AddColumnChildren(null, control); * else * Columns.Add(new Column {Control = control, Id = control.Id}); * }*/ AddColumnChildren(null, row); }
private void AddColumnChildren(ManagedTableForm.Column parent, BizControl control) { if (control.Children != null) { foreach (var child in control.Children) { if (child.Invisible || child.Options.HasFlag(BizControlOptionFlags.Hidden)) { continue; } if (child is BizTableColumn) { AddColumnChildren(parent, child); } else if (child is BizDocumentControl && child.Children != null && child.Children.Count > 0) { AddColumnChildren(parent, child); } else if (child is BizPanel && ((BizPanel)child).LayoutId == 2 && child.Children != null && child.Children.Count > 0) { var panelColumn = new ManagedTableForm.Column { Control = child, Id = child.Id }; Columns.Add(panelColumn); AddColumnChildren(panelColumn, child); } else { var childColumn = new ManagedTableForm.Column { Control = child, Id = child.Id }; if (parent == null) { Columns.Add(childColumn); } else { parent.Children.Add(childColumn); } } } } }
public DocFormDataSet(IDataContext dataContext, IEnumerable <Guid> docs, BizControl form, Guid userId) { DocList = new List <Guid>(docs); Form = form; if (dataContext == null) { DataContext = new DataContext(); _ownDataContext = true; } else { DataContext = dataContext; } FormRepo = new FormRepository(DataContext, userId); DocRepo = new DocRepository(DataContext, userId); }
// public XlsControlLayoutType Layout { get; private set; } // public int ColSpan { get; internal set; } // public int CaptionColSpan { get; internal set; } // public int DividerColSpan { get; internal set; } // public int ColumnNo { get; internal set; } // public int CaptionColumnNo { get; internal set; } // public int DividerColumnNo { get; internal set; } public XlsTableFormControlAdjustInfo(BizControl column) : base(column) { Control = column; Id = column.Id; Caption = column.Caption; CaptionSize = GetMaxWordLength(Caption); ValueSize = GetDataTypeSize(GetDataType(column)); // if (isTable) // { Size = Math.Max(ValueSize, CaptionSize); // } // else // { // CaptionSize = Math.Max(30, CaptionSize); // Size = CaptionSize + ValueSize; // } }
protected void AddControlBand(XlsGroup band, XlsRow gridRow, BizControl control) { if (control.Invisible) { return; } if (control is BizPanel /*control is BizTableColumn || * control is BizDocumentControl || control is BizDocumentListForm*/) { var node = new XlsTextNode(control.Caption); band.AddGroup(node); foreach (var child in control.Children) { AddControlBand(node, gridRow, child); } } else if (control is BizTableColumn || control is BizDocumentControl || control is BizDocumentListForm) { if (control.Children != null) { foreach (var child in control.Children) { AddControlBand(band, gridRow, child); } } } else if (control is BizDataControl) { AddControlColumn(band, gridRow, control); } else if (control.Children != null) { foreach (var child in control.Children) { AddControlBand(band.AddGroup(new XlsTextNode(child.Caption)), gridRow, child); } } }
protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control) { if (control.Invisible) { return; } var header = new XlsTextNode(control.Caption); band.AddGroup(header); var info = _adjuster.Find(control); if (DataSet != null) { var field = gridRow.AddDataField(new DocFormDataSetField(DataSet, control)); if (info != null) { header.ColSpan = info.ColSpan; field.ColSpan = info.ColSpan; } } else if (SqlDataSet != null) { if (!(control is BizDataControl)) { return; } var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty); if (attr != null) { var field = gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control)); if (info != null) { header.ColSpan = info.ColSpan; field.ColSpan = info.ColSpan; } } } }
protected void AddControlBand(BizControl control) { if (control.Invisible) { return; } if (control is BizPanel) { foreach (var child in control.Children) { AddControlBand(child); } } else if (control is BizTableColumn || control is BizDocumentControl || control is BizDocumentListForm) { if (control.Children != null) { foreach (var child in control.Children) { AddControlBand(child); } } } else if (control is BizDataControl) { AddControlColumn(control); } else if (control.Children != null) { foreach (var child in control.Children) { AddControlBand(child); } } }
public DocFormDataSetField(DocFormDataSet dataSet, BizControl control) : base(dataSet) { Control = control; }
public DocFormDataSet(IEnumerable <Guid> docs, BizControl form, Guid userId) : this(null, docs, form, userId) { }
/// <summary> /// Записывает значение атрибута документа в контрол /// </summary> /// <param name="control">Контрол</param> /// <param name="document">Документ</param> /// <returns></returns> public void SetControlData(BizControl control, Doc document) { return; }
public void AddTableForm(BizControl form) { Forms.Add(new XlsTableFormAdjustInfo(form)); }
public Doc GetFormDoc(BizControl form, Doc document) { throw new NotImplementedException(); }
private void AdjustDocListForms(BizControl form) { Headers.ForEach(_adjuster.AddReportSection); _adjuster.AddTableForm(form); Footers.ForEach(_adjuster.AddReportSection); }
// public void SetDoc(Guid docId) // { // SetDoc(_docManager.DocumentLoad(docId)); // } // // public void SetDoc(Doc doc) // { // Form = (BizTableForm) _presentationManager.SetFormDoc(Form, doc); // // Columns = new List<Column>(); // foreach (var control in Form.Children) // { // if (control.Invisible) continue; // if (control is BizTableColumn) AddColumnChildren(control); // else if (control is BizDocumentControl && control.Children != null && control.Children.Count > 0) // AddColumnChildren(control); // else // Columns.Add(new Column {Control = control, Id = control.Id}); // } // } internal void AddColumnChildren(Column parent, BizControl control, int nestCount = 1) { if (control.Children != null) { if (HeaderRowCount < nestCount) { HeaderRowCount = nestCount; } foreach (var child in control.Children) { if (child.Invisible || child.Options.HasFlag(BizControlOptionFlags.Hidden)) { continue; } if (child is BizTableColumn) { AddColumnChildren(parent, child, nestCount); } else if (child is BizDocumentControl && child.Children != null && child.Children.Count > 0) { AddColumnChildren(parent, child, nestCount); } else if (child is BizDocumentListForm && child.Children != null && child.Children.Count > 0) { AddColumnChildren(parent, child, nestCount); } else if (child is BizPanel && (((BizPanel)child).LayoutId == 2 || ((BizPanel)child).LayoutId == 0) && child.Children != null && child.Children.Count > 0) { var panelColumn = new Column { Control = child, Id = child.Id, RowNo = nestCount - 1 }; if (parent == null) { Columns.Add(panelColumn); } else { parent.Children.Add(panelColumn); } AddColumnChildren(panelColumn, child, nestCount + 1); } else { var childColumn = new Column { Control = child, Id = child.Id, RowNo = nestCount - 1 }; if (parent == null) { Columns.Add(childColumn); } else { parent.Children.Add(childColumn); } } } SetColumnRowSpans(Columns, HeaderRowCount); } }
public List <BizControl> CheckFormFields(BizControl form) { var result = new List <BizControl>(); if (form != null && form.Children != null) { foreach (var control in form.Children) { if (control is BizDataControl) { var dataControl = (BizDataControl)control; if ((dataControl.DocNotNull || dataControl.FormNotNull) && !dataControl.ReadOnly) { if (dataControl is BizEditBool) { if (((BizEditBool)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizEditInt) { if (((BizEditInt)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizEditFloat) { if (((BizEditFloat)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizEditCurrency) { if (((BizEditCurrency)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizEditText) { if (((BizEditText)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizEditDateTime) { if (((BizEditDateTime)dataControl).Value == null) { result.Add(dataControl); } } else if (dataControl is BizComboBox) { if (((BizComboBox)dataControl).Value == null) { result.Add(dataControl); } } } } if (control.Children != null && control.Children.Count > 0) { result.AddRange(CheckFormFields(control)); } } } return(result); }
//"Данное поле не может быть пустым! Введите значение."; public bool AddFieldValue(out string message, BizForm bizForm, Guid controlId, object value, bool onlyCheck) { //if (value == null) return; message = ""; var ok = true; BizControl control = FindControlById(controlId, bizForm.Children); if (control is BizEditInt) { var edit = (BizEditInt)control; if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { edit.Value = null; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { int result; if (Int32.TryParse(value.ToString(), out result)) { if (!onlyCheck) { edit.Value = result; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { message = Resources.Form.InvalidNumberFormat /*"Число передано в неверном формате"*/; ok = false; } } } else if (control is BizEditCurrency) { var edit = (BizEditCurrency)control; //edit.Attribute.Value = decimal.Parse(value.ToString()); if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { edit.Value = null; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { decimal result; if (decimal.TryParse(value.ToString(), out result)) { if (!onlyCheck) { edit.Value = result; } } else { message = Resources.Form.InvalidNumberFormat /*"Число передано в неверном формате"*/; ok = false; } } } else if (control is BizEditFloat) { var edit = (BizEditFloat)control; //edit.Attribute.Value = float.Parse(value.ToString()); if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { edit.Value = null; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { float result; if (float.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Value = result; } } else { message = Resources.Form.InvalidNumberFormat /*"Число передано в неверном формате"*/; ok = false; } } } else if (control is BizEditText) { var edit = (BizEditText)control; //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Value = value != null?value.ToString() : null; } if (!onlyCheck && String.IsNullOrEmpty(edit.Value) && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else if (control is BizEditDateTime) { var edit = (BizEditDateTime)control; //edit.Attribute.Value = decimal.Parse(value.ToString()); if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { edit.Value = null; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { DateTime result; if (DateTime.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Value = result; } } else { message = Resources.Form.InvalidDateTimeFormat /*"Дата передана в неверном формате"*/; ok = false; } } } else if (control is BizEditBool) { var edit = (BizEditBool)control; //edit.Attribute.Value = decimal.Parse(value.ToString()); if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { edit.Value = null; } if (!onlyCheck && (edit.DocNotNull || edit.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { bool result; if (value.ToString() == "true,false") { string temp = value.ToString(); value = temp.Substring(0, 4); } if (bool.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Value = result; } } else { message = Resources.Form.InvalidFormat /*"Значение передано в неверном формате"*/; ok = false; } } } else if (control is BizComboBox) { var combo = (BizComboBox)control; if (value == null || String.IsNullOrEmpty(value.ToString())) { if (!onlyCheck) { combo.Value = null; } if (!onlyCheck && (combo.DocNotNull || combo.FormNotNull)) { message = FieldCannotBeNull; ok = false; } } else { Guid result; if (Guid.TryParse(value.ToString(), out result)) { if (!onlyCheck) { combo.Value = result; } else { message = Resources.Form.InvalidFormat /*"Значение передано в неверном формате"*/; ok = false; } } } } //TODO: Дописать метод обновления для других обновляемых полей return(ok); }
public Doc GetFormDoc(BizControl form, Doc document) { // TODO: Вынести метод из репоизитария в Service/Helper класс return(_repositories.First().GetFormDoc(form, document)); }
public void AddFieldValue(Guid controlId, object value, bool onlyCheck) { BizControl control = FindControlById(controlId, BizForm.Children); if (control is BizEditInt) { var edit = (BizEditInt)control; int result; if (Int32.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Attribute.Value = result; } } else { throw new ApplicationException("Число передано в неверном формате"); } } if (control is BizEditCurrency) { var edit = (BizEditCurrency)control; //edit.Attribute.Value = decimal.Parse(value.ToString()); decimal result; if (decimal.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Attribute.Value = result; } } else { throw new ApplicationException("Число передано в неверном формате"); } } if (control is BizEditFloat) { var edit = (BizEditFloat)control; //edit.Attribute.Value = float.Parse(value.ToString()); float result; if (float.TryParse(value.ToString(), out result)) { //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Attribute.Value = result; } } else { throw new ApplicationException("Число передано в неверном формате"); } } if (control is BizEditText) { var edit = (BizEditText)control; //TODO: дописить тут различные проверки для аттрибута (ограничения загружены в сам аттрибут) if (!onlyCheck) { edit.Attribute.Value = value.ToString(); } } if (control is BizComboBox) { var combo = (BizComboBox)control; combo.Attribute.Value = Guid.Parse(value.ToString()); } //TODO: Дописать метод обновления для других обновляемых полей }
private void AddControlRow(XlsDef def, /*XlsGroup band,*/ BizControl control) { if (control.Invisible || control is BizButton) { return; } if (control is BizPanel || control is BizDocumentControl) { var cell = def.AddArea().AddRow().AddText(control.Caption); //band.AddGroup(new XlsRow()).AddText(control.Caption); cell.Style.FontStyle = FontStyle.Bold; cell.ColSpan = _adjuster.ColumnCount; cell.Style.FontColor = IndexedColors.DARK_BLUE.Index; // 18; cell.Style.HAlign = HAlignment.Center; cell.Style.AutoHeight = true; cell.Style.BgColor = IndexedColors.GREY_25_PERCENT.Index; foreach (var child in control.Children) { AddControlRow(def, /*band,*/ child); } } else if (control is BizDocumentListForm) { var docListForm = (BizDocumentListForm)control; var cell = def.AddArea().AddRow().AddText(control.Caption); cell.Style.FontStyle = FontStyle.Bold; cell.ColSpan = _adjuster.ColumnCount; cell.Style.FontColor = IndexedColors.DARK_BLUE.Index; // 18; cell.Style.HAlign = HAlignment.Center; cell.Style.AutoHeight = true; cell.Style.BgColor = IndexedColors.GREY_25_PERCENT.Index; var tableForm = docListForm.Children != null && docListForm.Children.Count > 0 ? docListForm : (BizControl)docListForm.TableForm; var docDefId = docListForm.TableForm != null ? docListForm.TableForm.DocumentDefId ?? Guid.Empty : Guid.Empty; SqlQueryDataSet dataSet; var sqb = _sqlQueryBuilderFactory.Create(); if (docListForm.AttributeDefId != null) { /*using ( * var query = SqlQueryExBuilder.BuildAttrList(tableForm, * docListForm.DocumentId ?? Guid.Empty, docDefId, (Guid) docListForm.AttributeDefId, null, * null, * UserId, DataContext))*/ /*using (*/ var query = sqb.BuildAttrList(tableForm, docListForm.DocumentId ?? Guid.Empty, docDefId, (Guid)docListForm.AttributeDefId, null, null);//) { query.WithNoLock = true; dataSet = CreateDataSet(query); } } else if (docListForm.FormAttributeDefId != null) { /*using ( * var query = SqlQueryExBuilder.BuildRefList(tableForm, * docListForm.DocumentId ?? Guid.Empty, docDefId, (Guid) docListForm.FormAttributeDefId, null, * null, * UserId, DataContext))*/ //using ( var query = sqb.BuildRefList(tableForm, docListForm.DocumentId ?? Guid.Empty, docDefId, (Guid)docListForm.FormAttributeDefId, null, null);//) { dataSet = CreateDataSet(query); } } else { throw new ApplicationException( "Недостаточно данных для формирования Excel-файла. Ошибка в данных формы!"); } /*int count; * var docs = docRepo.DocAttrListById(out count, docListForm.DocumentId ?? Guid.Empty, * docListForm.AttributeDefId ?? Guid.Empty, 0, 0); * * dataSet = new DocFormDataSet(docs, tableForm, UserId, DataContext);*/ var hRow = def.AddArea().AddRow(); hRow.ShowAllBorders(true); hRow.Style.FontStyle = FontStyle.Bold; hRow.Style.HAlign = HAlignment.Center; hRow.Style.BgColor = IndexedColors.BLUE_GREY.Index; //48; hRow.Style.FontColor = IndexedColors.WHITE.Index; hRow.Style.WrapText = true; var dRow = def.AddGrid(dataSet).AddRow(); dRow.ShowAllBorders(true); if (tableForm.Children != null) { foreach (var child in tableForm.Children) { AddControlBand(hRow, dRow, child, dataSet); } } } else { var row = def.AddArea().AddRow();//band.AddGroup(new XlsRow()); var cell = row.AddText(control.Caption); cell.ColSpan = _captionColSpan; cell.Style.HAlign = HAlignment.Right; cell.Style.WrapText = true; if (control is BizDataControl && ((BizDataControl)control).ObjectValue != null) { var value = GetDataControlValue((BizDataControl)control); var dataCell = row.AddText(value); dataCell.ColSpan = _valueColSpan; dataCell.Style.FontColor = IndexedColors.DARK_BLUE.Index; dataCell.Style.WrapText = true; } else { var emptyCell = row.AddEmptyCell(); emptyCell.ColSpan = _valueColSpan; } } }