Ejemplo n.º 1
0
        private List <ColsOperations> BuildDefaultColsOperations(List <string> FieldsToConsidier = null, List <Operations> NonAvaliableOperations = null)
        {
            try
            {
                var GridColumns   = RelatedGrid.DisplayLayout.Bands[0].Columns;
                var colsOperation = new List <ColsOperations>();

                foreach (UltraGridColumn Col in GridColumns)
                {
                    var ColCase = new ColsOperations();
                    if (FieldsToConsidier == null)
                    {
                        ColCase.ColName  = Col.Key;
                        ColCase.TypeName = Col.DataType.ToString();
                    }


                    if (FieldsToConsidier != null && FieldsToConsidier.Contains(Col.Key.ToString()))
                    {
                        ColCase.ColName  = Col.Key;
                        ColCase.TypeName = Col.DataType.ToString();
                    }

                    if (NonAvaliableOperations == null)
                    {
                        ColCase.AvaliableOperations = new DefaultOperations().GetListByType(Col.DataType.ToString());
                    }

                    if (NonAvaliableOperations != null)
                    {
                        var LstOp = new DefaultOperations().GetListByType(Col.DataType.ToString());
                        foreach (Operations Op in NonAvaliableOperations)
                        {
                            LstOp.Remove(Op);
                        }
                        ColCase.AvaliableOperations = LstOp;
                    }
                    colsOperation.Add(ColCase);
                    colsOperation = colsOperation.Where(Op => Op.ColName != null).ToList();
                }
                return(colsOperation);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public virtual List <Summarizer.Operations> GetListByType(string TypeOfColumns)
        {
            switch (TypeOfColumns)
            {
            case "System.Decimal":
                return(DefaultOperations.GetDefaultNumericosOperations());

            case "System.String":
                return(DefaultOperations.GetDefaultStringOperations());

            case "System.Int32":
                return(DefaultOperations.GetDefaultNumericosOperations());

            case "System.Boolean":
                return(DefaultOperations.GetDefaultBooleanOperations());

            case "System.DateTime":
                return(DefaultOperations.GetDefaultDateOperations());
            }
            return(null);
        }