예제 #1
0
        public void AddColumn(FieldColumn Field)
        {
            DataGridViewCellStyle sty = new DataGridViewCellStyle();

            sty.Format    = GetFormat(Field.Type);
            sty.Alignment = GetAlingnment(Field.Type);

            DataGridViewColumn dvc = new DataGridViewColumn();

            dvc.DefaultCellStyle = sty;
            dvc.Name             = Field.Name;
            dvc.DataPropertyName = Field.Name;

            dvc.HeaderText = Field.Text;
            dvc.ReadOnly   = true;
            dvc.SortMode   = DataGridViewColumnSortMode.Automatic;
            dvc.Width      = (Field.Size == 0 ? GetSize(Field.Type) : Field.Size);

            if (Field.Type == enmFieldType.Bool)
            {
                dvc.CellTemplate = new DataGridViewCheckBoxCell();
            }
            else
            {
                dvc.CellTemplate = new DataGridViewTextBoxCell();
            }

            this.Columns.Add(dvc);
            Fields.Add(Field);
            //if (this.Rows.Count != 0)
            //{ this.Rows.Clear(); }
        }
예제 #2
0
        FrameworkElement ControlInterface.getPreview()
        {
            StackPanel s = new StackPanel();

            Label l = new Label {
                Content = ColHeader.Text, Background = ColHeader.Background, BorderBrush = Brushes.Gray, BorderThickness = new Thickness(1), FontSize = ColHeader.FontSize, Foreground = Brushes.White
            };

            s.Children.Add(l);
            StackPanel column = (StackPanel)FieldColumn.getPreview();

            s.Children.Add(column);
            if (HasTotal)
            {
                double sum = 0;
                int    i   = 0;
                foreach (Label lbl in column.Children)
                {
                    sum += Double.Parse(lbl.Content.ToString());
                }
                Label ltotal = new Label {
                    Content = sum.ToString()
                };
                ltotal.Background      = Brushes.LightGray;
                ltotal.BorderThickness = new Thickness(1);
                s.Children.Add(ltotal);
            }



            return(s);
        }
예제 #3
0
 public frmCfgQueryFields(DataTable Table) : this()
 {
     bs = new FieldColumn();
     cmbName.Items.Clear();
     for (int i = 0; i < Table.Columns.Count; i++)
     {
         cmbName.Items.Add(Table.Columns[i].ColumnName.ToUpper());
     }
 }
예제 #4
0
        public void CtorFeedsProperty(string columnName, string path)
        {
            // Arrange
            FieldColumn f = new FieldColumn(columnName);

            // Act
            JsonFieldColumn column = new JsonFieldColumn(f, path);

            // Assert
            column.Column.Should()
            .BeSameAs(f);
            column.Path.Should()
            .Be(path);
        }
예제 #5
0
        public void Clone_Performs_A_Deep_Clone()
        {
            // Arrange
            FieldColumn     f        = new FieldColumn("prop1");
            JsonFieldColumn original = new JsonFieldColumn(f, "path");

            // Act
            IColumn clone = original.Clone();

            // Assert
            clone.Should()
            .BeOfType <JsonFieldColumn>().And
            .NotBeSameAs(original).And
            .Be(original);
        }
예제 #6
0
 /// <summary>
 /// Applies <see cref="CountFunction"/> to <paramref name="column"/>.
 /// </summary>
 /// <param name="column">Column onto which apply <see cref="CountFunction"/>.</param>
 /// <returns></returns>
 public static CountFunction Count(FieldColumn column) => new CountFunction(column);
예제 #7
0
 /// <summary>
 /// Applies <see cref="NullFunction"/> to <paramref name="column"/>.
 /// </summary>
 /// <param name="column">Column onto which aoply <see cref="NullFunction"/>.</param>
 /// <param name="fallBackValue"></param>
 /// <param name="otherFallbackValues"></param>
 /// <param name="defaultValue">Result value to use if <paramref name="column"/>'s value is <c>null</c></param>
 /// <returns></returns>
 public static NullFunction Null(FieldColumn column, ColumnBase fallBackValue, params ColumnBase[] otherFallbackValues) => new NullFunction(column, fallBackValue, otherFallbackValues);
예제 #8
0
 public MaxColumn(FieldColumn column, string alias = null)
     : base(AggregateType.Max, column, alias)
 {
 }
예제 #9
0
 /// <summary>
 /// Builds a new <see cref="UpdateFieldValue"/> instance.
 /// </summary>
 /// <param name="destination">Column to update</param>
 /// <param name="source">value to set</param>
 public UpdateFieldValue(FieldColumn destination, ColumnBase source)
 {
     Destination = destination ?? throw new ArgumentNullException(nameof(destination));
     Source      = source;
 }
예제 #10
0
파일: Count.cs 프로젝트: candoumbe/Queries
 public Count(FieldColumn column, string alias = null)
     : base(column, alias)
 {
 }
예제 #11
0
 /// <summary>
 /// Builds a new <see cref="JsonFieldColumn"/> instance
 /// </summary>
 /// <param name="column">Column that holds the value</param>
 /// <param name="path">Path to the JSON property</param>
 /// <param name="renderAsString"><c>true</c>  if the field should be rendered as string</param>
 /// <exception cref="ArgumentNullException">either <paramref name="column"/> or <paramref name="path"/> is <c>null</c>.</exception>
 public JsonFieldColumn(FieldColumn column, string path, bool renderAsString = false)
 {
     Column         = column ?? throw new ArgumentNullException(nameof(column));
     Path           = path ?? throw new ArgumentNullException(nameof(path));
     RenderAsString = renderAsString;
 }
예제 #12
0
 public CountColumn(FieldColumn column, string alias = null)
     : base(AggregateType.Count, column, alias)
 {
 }
예제 #13
0
 /// <summary>
 /// Builds a new <see cref="CountFunction"/> instance
 /// </summary>
 /// <param name="column">column onto which the function will bne applied</param>
 /// <exception cref="ArgumentNullException">if <paramref name="column"/> is <c>null</c></exception>
 public CountFunction(FieldColumn column)
     : base(AggregateType.Count, column)
 {
 }
        private string MakeFullName(FieldColumn column)
        {
            string name = String.Format("{0}.{1}", column.Table, column.Field);

            return(name);
        }
예제 #15
0
        public XElement GetXml()
        {
            var col = new XElement(XMLCREATOR.TABLE_COLUMN, new XAttribute("TOT", HasTotal.ToString()), new XAttribute(XMLCREATOR.COLUMN_HEADER, ColHeader.Text), FieldColumn.GetXml());

            return(col);
        }
예제 #16
0
파일: Length.cs 프로젝트: candoumbe/Queries
 public Length(FieldColumn column, string alias = null)
     : base(column, alias)
 {
 }