Example #1
0
        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();
                }
            }
        }
Example #2
0
        public SqlQueryDataSetField(SqlQueryDataSet dataSet, SqlQuerySelectAttribute attr, SqlQuerySummaryFunction grouping = SqlQuerySummaryFunction.None)
            : base(dataSet)
        {
            AttrIndex = dataSet.Reader.Query.Attributes.IndexOf(attr);
            AttrDef   = attr.Def;
            if (AttrDef == null)
            {
                Ident = attr.Ident;
            }
            Control  = null;
            Grouping = grouping;

            var comboBoxValueProvider = dataSet.GetComboBoxEnumProvider();

            if (AttrDef != null && (Grouping == SqlQuerySummaryFunction.None || Grouping == SqlQuerySummaryFunction.Group))
            {
                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();
                }
            }
        }