Пример #1
0
 public Metadata(string name, int position, string format, FieldValueType type)
 {
     Name = name;
     Position = position;
     Format = format;
     FieldValueType = type;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position">Posición de la columna zero-based</param>
 /// <param name="headerName">Nombre de la columna</param>
 /// <param name="typeValue">Tipo de dato en la cual se representará el valor</param>
 public ExportableAttribute(int position, string headerName, FieldValueType typeValue)
 {
     Position = position;
     HeaderName = headerName;
     TypeValue = typeValue;
     Format = string.Empty;
 }
Пример #3
0
		public FieldValue(TableFieldValues parent, string fieldName, object val, bool unique, FieldValueType type)
		{
			Parent = parent;
			FieldName = fieldName;
			Value = val;
			UniqueField = unique;
			Type = type;
		}
Пример #4
0
 /// <summary></summary>
 public MultInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType,DefCat defCategory,ReportFKType fKType)
 {
     PromptingText=promptingText;
     ValueType=valueType;
     CurrentValues=currentValues;
     EnumerationType=enumerationType;
     DefCategory=defCategory;
     FKType=fKType;
 }
Пример #5
0
 ///<summary>Overload for ValueKind Enum.</summary>
 public ParameterField(string thisName,FieldValueType thisValueType,ArrayList theseDefaultValues,string thisPromptingText,string thisSnippet,EnumType thisEnumerationType)
 {
     name=thisName;
     valueType=thisValueType;
     defaultValues=theseDefaultValues;
     promptingText=thisPromptingText;
     snippet=thisSnippet;
     enumerationType=thisEnumerationType;
     defCategory=DefCat.AccountColors;//arbitrary
     fKeyType=ReportFKType.None;
 }
Пример #6
0
 ///<summary>This is how parameters are generally added.  The currentValues and outputValue will be determined during the Report.SubmitQuery call.</summary>
 public ParameterField(string thisName,FieldValueType thisValueType,object thisDefaultValue,string thisPromptingText,string thisSnippet)
 {
     name=thisName;
     valueType=thisValueType;
     defaultValues=new ArrayList();
     defaultValues.Add(thisDefaultValue);
     promptingText=thisPromptingText;
     snippet=thisSnippet;
     enumerationType=EnumType.ApptStatus;//arbitrary
     defCategory=DefCat.AccountColors;//arbitrary
     fKeyType=ReportFKType.None;
 }
Пример #7
0
 ///<summary>Currently only used for page numbers.</summary>
 public ReportObject(string name, AreaSectionType sectionType, Point location, Size size, FieldValueType fieldValueType, SpecialFieldType specialType, Font font, ContentAlignment contentAlignment, string stringFormat)
 {
     _name             = name;
     _sectionType      = sectionType;
     _location         = location;
     _size             = size;
     _font             = font;
     _contentAlignment = contentAlignment;
     _stringFormat     = stringFormat;
     _fieldDefKind     = FieldDefKind.SpecialField;
     _fieldValueType   = fieldValueType;
     _specialFieldType = specialType;
     //defaults:
     _foreColor        = Color.Black;
     _reportObjectType = ReportObjectType.FieldObject;
 }
Пример #8
0
        /// <summary>Adds all the objects necessary for a typical column, including the textObject for column header and the fieldObject for the data.  Does not add lines or shading. If the column is type Double, then the alignment is set right and a total field is added. Also, default formatstrings are set for dates and doubles.</summary>
        /// <param name="dataField">The name of the column title as well as the dataField to add.</param>
        /// <param name="width"></param>
        /// <param name="valueType"></param>
        public void AddColumn(string dataField, int width, FieldValueType valueType)
        {
            dataFields.Add(dataField);
            //FormReport FormR=new FormReport();
            //Graphics grfx=FormR.CreateGraphics();
            Font             font;
            Size             size;
            ContentAlignment textAlign;

            if (valueType == FieldValueType.Number)
            {
                textAlign = ContentAlignment.MiddleRight;
            }
            else
            {
                textAlign = ContentAlignment.MiddleLeft;
            }
            string formatString = "";

            if (valueType == FieldValueType.Number)
            {
                formatString = "n";
            }
            if (valueType == FieldValueType.Date)
            {
                formatString = "d";
            }
            if (sections["Page Header"] == null)
            {
                sections.Add(new Section(AreaSectionKind.PageHeader, 0));
            }
            //add textobject for column header
            font = new Font("Tahoma", 8, FontStyle.Bold);
            size = new Size((int)(grfx.MeasureString(dataField, font).Width / grfx.DpiX * 100 + 2)
                            , (int)(grfx.MeasureString(dataField, font).Height / grfx.DpiY * 100 + 2));
            if (sections["Page Header"].Height == 0)
            {
                sections["Page Header"].Height = size.Height;
            }
            int xPos = 0;

            //find next available xPos
            foreach (ReportObject reportObject in reportObjects)
            {
                if (reportObject.SectionName != "Page Header")
                {
                    continue;
                }
                if (reportObject.Location.X + reportObject.Size.Width > xPos)
                {
                    xPos = reportObject.Location.X + reportObject.Size.Width;
                }
            }
            ReportObjects.Add(new ReportObject("Page Header"
                                               , new Point(xPos, 0), new Size(width, size.Height), dataField, font, textAlign));
            //add fieldObject for rows in details section
            font = new Font("Tahoma", 9);
            size = new Size((int)(grfx.MeasureString(dataField, font).Width / grfx.DpiX * 100 + 2)
                            , (int)(grfx.MeasureString(dataField, font).Height / grfx.DpiY * 100 + 2));
            if (sections["Detail"].Height == 0)
            {
                sections["Detail"].Height = size.Height;
            }
            reportObjects.Add(new ReportObject("Detail"
                                               , new Point(xPos, 0), new Size(width, size.Height)
                                               , dataField, valueType
                                               //,new FieldDef(dataField,valueType)
                                               , font, textAlign, formatString));
            //add fieldObject for total in ReportFooter
            if (valueType == FieldValueType.Number)
            {
                font = new Font("Tahoma", 9, FontStyle.Bold);
                //use same size as already set for otherFieldObjects above
                if (sections["Report Footer"] == null)
                {
                    sections.Add(new Section(AreaSectionKind.ReportFooter, 0));
                }
                if (sections["Report Footer"].Height == 0)
                {
                    sections["Report Footer"].Height = size.Height;
                }
                reportObjects.Add(new ReportObject("Report Footer"
                                                   , new Point(xPos, 0), new Size(width, size.Height)
                                                   , SummaryOperation.Sum, dataField
                                                   //,new FieldDef("Sum"+dataField,SummaryOperation.Sum
                                                   //,GetLastRO(ReportObjectKind.FieldObject).DataSource)
                                                   , font, textAlign, formatString));
            }
            //tidy up
            //grfx.Dispose();
            //FormR.Dispose();
            return;
        }
Пример #9
0
 private FieldValue(FieldValueType fieldValueType, object[] elements)
 {
     _fieldValueType = fieldValueType;
     _elements       = elements;
 }
Пример #10
0
 private FieldValue(FieldValueType fieldValueType, double doubleValue)
 {
     _fieldValueType = fieldValueType;
     _doubleValue    = doubleValue;
 }
Пример #11
0
		/// <summary>Overload for using Enum.</summary>
		public void AddInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType){
			if(currentValues==null)
				currentValues=new ArrayList();
			multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,enumerationType,DefCat.AccountColors,ReportFKType.None));
		}
Пример #12
0
 /**
  * Build out this field value with a type.
  *
  * @param type The type.
  * @return this.
  */
 public FieldValue SetType(FieldValueType type)
 {
     KnownType = type;
     return(this);
 }
Пример #13
0
 public DistributedFieldFixedCad(uint cadId, CadElementType cadElemType,
                                 FieldValueType valueType, IList <uint> fixedDofIndexs) :
     base(cadId, cadElemType, valueType, fixedDofIndexs)
 {
 }
Пример #14
0
		///<summary>Overload for SpecialField ReportObject</summary>
		public ReportObject(string name,string sectionName,Point location,Size size,FieldValueType fieldValueType,SpecialFieldType specialType,Font font,ContentAlignment contentAlignment,string stringFormat) {
			_name=name;
			_sectionName=sectionName;
			_location=location;
			_size=size;
			_font=font;
			_contentAlignment=contentAlignment;
			_stringFormat=stringFormat;
			_fieldDefKind=FieldDefKind.SpecialField;
			_fieldValueType=fieldValueType;
			_specialFieldType=specialType;
			//defaults:
			_foreColor=Color.Black;
			_reportObjectKind=ReportObjectKind.FieldObject;
		}
Пример #15
0
        public static System.Data.DataTable ConvertFieldToType(System.Data.DataTable sourceDt, string fieldName, string fieldName1, FieldValueType fieldType, FieldValueType fieldType1)
        {
            try
            {
                if (fieldType == FieldValueType.非值文本)
                {
                    return(null);
                }
                if (!sourceDt.Columns.Contains(fieldName))
                {
                    MessageBox.Show("源表中未找到名为:" + fieldName + "的列");
                    return(null);
                }
                if (fieldType == FieldValueType.整数 || fieldType == FieldValueType.小数)
                {
                    return(sourceDt);
                }


                //当字段值是整数型文本或小数型文本时,执行字段值对应转换
                DataTable resultDt = sourceDt.Copy();
                resultDt.Columns.Remove(fieldName); //先删掉该列, 防止与新添加列同名冲突
                //根据待转换字段的类型,进行相应的转换
                if (fieldType == FieldValueType.整数文本)
                {
                    resultDt.Columns.Add(fieldName, typeof(int));
                    for (int i = 0; i < resultDt.Rows.Count; i++)
                    {
                        try
                        {
                            resultDt.Rows[i][fieldName] = Convert.ToInt32(sourceDt.Rows[i][fieldName]);
                        }
                        catch (System.Exception ex)
                        {
                            continue;
                        }
                    }
                }
                else if (fieldType == FieldValueType.小数文本)
                {
                    resultDt.Columns.Add(fieldName, typeof(double));
                    for (int i = 0; i < resultDt.Rows.Count; i++)
                    {
                        try
                        {
                            //将对应字段从文本转换为值
                            resultDt.Rows[i][fieldName] = Convert.ToDouble(sourceDt.Rows[i][fieldName]);
                        }
                        catch (System.Exception ex)
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    return(null);
                }

                return(resultDt);
            }
            catch (System.Exception ex)
            {
                return(null);
            }
        }
Пример #16
0
 public FilterFieldValue(string fieldValue, FieldValueType fieldValueType, bool isNull = false)
 {
     this.FiledValue = fieldValue;
     this.ValueType  = fieldValueType;
     IsNull          = isNull;
 }
Пример #17
0
        public static DataTable ConvertFieldToType2(System.Data.DataTable sourceDt, string fieldName1, string fieldName2, string fieldName3, string fieldName4, FieldValueType yFieldType1, FieldValueType yFieldType2, FieldValueType yFieldType3, FieldValueType yFieldType4)
        {
            try
            {
                if (yFieldType1 == FieldValueType.非值文本 || yFieldType2 == FieldValueType.非值文本)
                {
                    return(null);
                }
                if (yFieldType3 == FieldValueType.非值文本 || yFieldType4 == FieldValueType.非值文本)
                {
                    return(null);
                }
                if (!sourceDt.Columns.Contains(fieldName1) || !sourceDt.Columns.Contains(fieldName2) || !sourceDt.Columns.Contains(fieldName3) || !sourceDt.Columns.Contains(fieldName4))
                {
                    MessageBox.Show("源表中未找到该列");
                    return(null);
                }
                if (yFieldType1 == FieldValueType.整数 || yFieldType1 == FieldValueType.小数)
                {
                    return(sourceDt);
                }
                if (yFieldType2 == FieldValueType.整数 || yFieldType2 == FieldValueType.小数)
                {
                    return(sourceDt);
                }
                if (yFieldType3 == FieldValueType.整数 || yFieldType3 == FieldValueType.小数)
                {
                    return(sourceDt);
                }
                if (yFieldType4 == FieldValueType.整数 || yFieldType4 == FieldValueType.小数)
                {
                    return(sourceDt);
                }
                //当字段值是整数型文本或小数型文本时,执行字段值对应转换
                DataTable resultDt = sourceDt.Copy();
                resultDt.Columns.Remove(fieldName1); //先删掉该列, 防止与新添加列同名冲突
                resultDt.Columns.Remove(fieldName2);
                resultDt.Columns.Remove(fieldName3);
                resultDt.Columns.Remove(fieldName4);
                //根据待转换字段的类型,进行相应的转换
                if (yFieldType1 == FieldValueType.整数文本 || yFieldType2 == FieldValueType.整数文本 || yFieldType3 == FieldValueType.整数文本 || yFieldType4 == FieldValueType.整数文本)
                {
                    resultDt.Columns.Add(fieldName1, typeof(int));
                    for (int i = 0; i < resultDt.Rows.Count; i++)
                    {
                        try
                        {
                            resultDt.Rows[i][fieldName1] = Convert.ToInt32(sourceDt.Rows[i][fieldName1]);
                            resultDt.Rows[i][fieldName2] = Convert.ToInt32(sourceDt.Rows[i][fieldName2]);
                            resultDt.Rows[i][fieldName3] = Convert.ToInt32(sourceDt.Rows[i][fieldName3]);
                            resultDt.Rows[i][fieldName4] = Convert.ToInt32(sourceDt.Rows[i][fieldName4]);
                        }
                        catch (System.Exception ex)
                        {
                            continue;
                        }
                    }
                }
                else if (yFieldType1 == FieldValueType.小数文本 || yFieldType2 == FieldValueType.小数文本 || yFieldType4 == FieldValueType.小数文本 || yFieldType3 == FieldValueType.小数文本)
                {
                    resultDt.Columns.Add(fieldName1, typeof(double));
                    resultDt.Columns.Add(fieldName2, typeof(double));
                    resultDt.Columns.Add(fieldName3, typeof(double));
                    resultDt.Columns.Add(fieldName4, typeof(double));
                    for (int i = 0; i < resultDt.Rows.Count; i++)
                    {
                        try
                        {
                            //将对应字段从文本转换为值
                            resultDt.Rows[i][fieldName1] = Convert.ToDouble(sourceDt.Rows[i][fieldName1]);
                            resultDt.Rows[i][fieldName2] = Convert.ToDouble(sourceDt.Rows[i][fieldName2]);
                            resultDt.Rows[i][fieldName3] = Convert.ToDouble(sourceDt.Rows[i][fieldName3]);
                            resultDt.Rows[i][fieldName4] = Convert.ToDouble(sourceDt.Rows[i][fieldName4]);
                        }
                        catch (System.Exception ex)
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    return(null);
                }

                return(resultDt);
            }
            catch (System.Exception ex)
            {
                return(null);
            }
        }
Пример #18
0
 private FieldValue(FieldValueType type, double incrementValue = 0, object[] elements = null)
 {
     Type           = type;
     Elements       = elements;
     IncrementValue = incrementValue;
 }
Пример #19
0
        /// <summary>
        /// 將條件組合後加到ArrayList
        /// </summary>
        /// <param name="TSQLOperatorItem">TSQL運算子</param>
        /// <param name="FieldName">欄位名稱</param>
        /// <param name="LikeCheck">Like檢查</param>
        /// <param name="FieldOperatorItem">欄位運算子</param>
        /// <param name="FieldValueTypeItem">欄位值型態</param>
        /// <param name="FieldValue">欄位值</param>
        /// <param name="ConditionList">組合條件後回傳ArrayList</param>
        public static void AddConditionEntry(TSQLOperator TSQLOperatorItem,
                                             string FieldName,
                                             bool LikeCheck,
                                             FieldOperator FieldOperatorItem,
                                             FieldValueType FieldValueTypeItem,
                                             string FieldValue,
                                             ref ArrayList ConditionList
                                             )
        {
            //建立條件Entry
            QueryCondition ConditionEntry = new QueryCondition();

            //TSQL運算子
            ConditionEntry.ConditionTSQLOperator = TSQLOperatorItem;
            //欄位名稱
            ConditionEntry.ConditionField = FieldName;
            //欄位運算子
            ConditionEntry.ConditionFieldOperator = (LikeCheck) ? FieldOperator.LIKE : FieldOperatorItem;
            //欄位值屬性
            ConditionEntry.ConditionFieldValue.ValueType = (LikeCheck) ? FieldValueType.LIKESTRING : FieldValueTypeItem;
            //欄位值
            ConditionEntry.ConditionFieldValue.Value = FieldValue;
            //加入到ArrayList
            ConditionList.Add(ConditionEntry);
        }
Пример #20
0
		/// <summary>Overload for ValueKind defCat.</summary>
		public void AddParameter(string myName,FieldValueType myValueType
			,ArrayList myDefaultValues,string myPromptingText,string mySnippet,DefCat myDefCategory){
			_parameterFields.Add(new ParameterField(myName,myValueType,myDefaultValues,myPromptingText,mySnippet,myDefCategory));
		}
Пример #21
0
        /// <summary>
        /// Set value for this field.
        /// </summary>
        private void SetValue(string value, FieldValueType fieldValueType)
        {
            if (_range == null)
            {
                return;
            }

            switch (fieldValueType)
            {
            // Set converted value, add hyperlink to range
            case FieldValueType.PlainText:
            {
                _range.Text = (_converter == null) ? value : _converter.Convert(value, Direction.TfsToOther);
                if (!string.IsNullOrEmpty(Hyperlink))
                {
                    _range.Hyperlinks.Add(_range, Hyperlink);
                }

                break;
            }

            case FieldValueType.BasedOnFieldType:
            {
                if (ReferenceName.Equals(FieldReferenceNames.TestSteps))
                {
                    if (string.IsNullOrEmpty(value) == false)
                    {
                        var template =
                            _range.Application.ListGalleries[WdListGalleryType.wdNumberGallery].ListTemplates[1];
                        if (template != null)
                        {
                            _range.ListFormat.ApplyListTemplate(template, false);
                        }
                    }

                    _range.Text = value;
                }
                break;
            }

            case FieldValueType.DropDownList:
            {
                var contentControlsCache = _range.ContentControls;

                if (contentControlsCache.Count != 1)
                {
                    SyncServiceTrace.E("DropDownList value should be set but the field contains not exactly one FormField.");
                    return;
                }

                var dropDown        = contentControlsCache[1];
                var dropDownEntries = dropDown.DropdownListEntries.Cast <ContentControlListEntry>();

                // if we previously assigned allowed values, check the cache. If not read existing values from dropdown list
                var matchingEntry = dropDownEntries.FirstOrDefault(x => x.Value == value);
                if (matchingEntry == null)
                {
                    SyncServiceTrace.E("DropDownList value should be set but the value is not in the lists of possible values.");
                    return;
                }

                matchingEntry.Select();
                break;
            }

            case FieldValueType.HTML:
            {
                if (string.IsNullOrEmpty(value))
                {
                    // if the value is empty then do not use clipboard
                    _range.Text = value;
                }
                else
                {
                    // Fix for 15925. Editing html fields using vs or browser will not always surround text in tags.
                    // Word appears to only parse strings like "A&amp;B" correctly when they are surrounded with tags.
                    if (!(value.StartsWith("<", StringComparison.Ordinal) && value.EndsWith(">", StringComparison.Ordinal)))
                    {
                        value = $"<span>{value}</span>";
                        SyncServiceTrace.W("Automatically surrounded text with span tags");
                    }

                    value = HtmlHelper.AddMissingImageSizeAttributes(value);
                    // value = HtmlHelper.ShrinkImagesAllSamePercentage(value, 0.8f);

                    // Get the range to work with
                    Range range;
                    if (!string.IsNullOrEmpty(Configuration.WordBookmark))
                    {
                        // Set the Bookmarks
                        // If the Text of the range is empty, add some non blank space to help word with its Bookmarks
                        if (string.IsNullOrWhiteSpace(_range.Text))
                        {
                            _range.Text = "&nbsp;";
                        }

                        _range.Bookmarks.Add(Configuration.WordBookmark);
                        range = _range.Bookmarks[Configuration.WordBookmark].Range;
                    }
                    else
                    {
                        range = _range;
                    }

                    // Get the start of actual range to select whole pasted 'thing'
                    var startRange = range.Start;

                    try
                    {
                        WordHelper.PasteSpecial(range, value);
                    }
                    catch (COMException ce)
                    {
                        if (ce.ErrorCode == WordHelper.CommandFailedCode)
                        {
                            _range.Text = string.Empty;
                            SyncServiceTrace.I("HTML-content \"{0}\" was effectively empty and therefore it has been replaced by an empty string.", value);
                        }
                        else
                        {
                            throw;
                        }
                    }

                    // Set the start back to the previous position to set the pasted 'thing' into this range
                    range.Start = startRange;
                    var parser = new PasteStreamParser();
                    parser.ParseAndRepairAfterPaste(value, range);
                }
                break;
            }
            }

            RefreshBookmarks();
        }
Пример #22
0
 /// <summary>Overload for ValueKind defCat.</summary>
 public void AddParameter(string myName, FieldValueType myValueType
                          , ArrayList myDefaultValues, string myPromptingText, string mySnippet, DefCat myDefCategory)
 {
     parameterFields.Add(new ParameterField(myName, myValueType, myDefaultValues, myPromptingText, mySnippet, myDefCategory));
 }
        internal static FieldValue_internal DeserializeFieldValue_internal(JsonElement element)
        {
            FieldValueType type             = default;
            string         valueString      = default;
            string         valueDate        = default;
            string         valueTime        = default;
            string         valuePhoneNumber = default;
            float?         valueNumber      = default;
            int?           valueInteger     = default;
            IReadOnlyList <FieldValue_internal> valueArray = default;
            IReadOnlyDictionary <string, FieldValue_internal> valueObject = default;
            string text = default;
            IReadOnlyList <float> boundingBox = default;
            float?confidence = default;
            IReadOnlyList <string> elements = default;
            int?page = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString().ToFieldValueType();
                    continue;
                }
                if (property.NameEquals("valueString"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valueString = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valueDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valueDate = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valueTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valueTime = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valuePhoneNumber"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valuePhoneNumber = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valueNumber"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valueNumber = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("valueInteger"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    valueInteger = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("valueArray"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <FieldValue_internal> array = new List <FieldValue_internal>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DeserializeFieldValue_internal(item));
                    }
                    valueArray = array;
                    continue;
                }
                if (property.NameEquals("valueObject"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, FieldValue_internal> dictionary = new Dictionary <string, FieldValue_internal>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, DeserializeFieldValue_internal(property0.Value));
                    }
                    valueObject = dictionary;
                    continue;
                }
                if (property.NameEquals("text"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("boundingBox"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <float> array = new List <float>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetSingle());
                    }
                    boundingBox = array;
                    continue;
                }
                if (property.NameEquals("confidence"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    confidence = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("elements"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    elements = array;
                    continue;
                }
                if (property.NameEquals("page"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    page = property.Value.GetInt32();
                    continue;
                }
            }
            return(new FieldValue_internal(type, valueString, valueDate, valueTime, valuePhoneNumber, valueNumber, valueInteger, valueArray, valueObject, text, boundingBox, confidence, elements, page));
        }
Пример #24
0
		/// <summary>Overload for just one simple value.</summary>
		public void AddInputItem(string promptingText,FieldValueType valueType,object currentValue){
			ArrayList currentValues=new ArrayList();
			currentValues.Add(currentValue);
			//the enumtype and defcat are completely arbitrary.
			multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,EnumType.ApptStatus,DefCat.AccountColors,ReportFKType.None));
		}
Пример #25
0
 ///<summary></summary>
 public void AddInputItem(string myPromptingText, FieldValueType myValueType, ArrayList myCurrentValues, EnumType myEnumerationType, DefCat myDefCategory, ReportFKType myFKType)
 {
     MultInput2.AddInputItem(myPromptingText, myValueType, myCurrentValues, myEnumerationType, myDefCategory, myFKType);
 }
Пример #26
0
		///<summary>Adds all the objects necessary for a typical column, including the textObject for column header and the fieldObject for the data.  If the column is type Double, then the alignment is set right and a total field is added. Also, default formatstrings are set for dates and doubles.  Does not add lines or shading.</summary>
		public void AddColumn(string dataField,int width,FieldValueType fieldValueType,Font font) {
			Graphics grfx=Graphics.FromImage(new Bitmap(1,1));
			_arrDataFields.Add(dataField);
			Font fontHeader=new Font(font.FontFamily,font.Size-1,FontStyle.Bold);
			Font fontFooter=new Font(font.FontFamily,font.Size,FontStyle.Bold);
			ContentAlignment textAlign;
			if(fieldValueType==FieldValueType.Number) {
				textAlign=ContentAlignment.MiddleRight;
			}
			else {
				textAlign=ContentAlignment.MiddleLeft;
			}
			string formatString="";
			if(fieldValueType==FieldValueType.Number) {
				formatString="n";
			}
			if(fieldValueType==FieldValueType.Date) {
				formatString="d";
			}
			_queryWidth+=width;
			//add textobject for column header
			Size sizeHeader=new Size((int)grfx.MeasureString(dataField,fontHeader,(int)(width/grfx.DpiX*100+2)).Width,(int)grfx.MeasureString(dataField,fontHeader,(int)(width/grfx.DpiY*100+2)).Height);
			Size sizeDetail=new Size((int)grfx.MeasureString(dataField,font,(int)(width/grfx.DpiX*100+2)).Width,(int)grfx.MeasureString(dataField,font,(int)(width/grfx.DpiY*100+2)).Height);
			Size sizeFooter=new Size((int)grfx.MeasureString(dataField,fontFooter,(int)(width/grfx.DpiX*100+2)).Width,(int)grfx.MeasureString(dataField,fontFooter,(int)(width/grfx.DpiY*100+2)).Height);
			int xPos=0;
			//find next available xPos
			foreach(ReportObject reportObject in _reportObjects) {
				if(reportObject.SectionName!="Group Header") {
					continue;
				}
				if(reportObject.Location.X+reportObject.Size.Width > xPos) {
					xPos=reportObject.Location.X+reportObject.Size.Width;
				}
			}
			_reportObjects.Add(new ReportObject(dataField+"Header","Group Header"
				,new Point(xPos,0),new Size(width,sizeHeader.Height),dataField,fontHeader,textAlign));
			//add fieldObject for rows in details section
			_reportObjects.Add(new ReportObject(dataField+"Detail","Detail"
				,new Point(xPos,0),new Size(width,sizeDetail.Height)
				,dataField,fieldValueType
				,font,textAlign,formatString));
			//add fieldObject for total in ReportFooter
			if(fieldValueType==FieldValueType.Number) {
				//use same size as already set for otherFieldObjects above
				_reportObjects.Add(new ReportObject(dataField+"Footer","Group Footer"
					,new Point(xPos,0),new Size(width,sizeFooter.Height)
					,SummaryOperation.Sum,dataField
					,fontFooter,textAlign,formatString));
			}
			_exportTable.Columns.Add(dataField);
			grfx.Dispose();
			return;
		}
Пример #27
0
 public static bool IsVariable(this FieldValueType instance)
 {
     return(instance == FieldValueType.BasedOnSystemVariable || instance == FieldValueType.BasedOnVariable);
 }
Пример #28
0
 private FieldValue(FieldValueType fieldValueType)
 {
     _fieldValueType = fieldValueType;
 }
Пример #29
0
 /// <summary></summary>
 public void AddInputItem(string promptingText, FieldValueType valueType, ArrayList currentValues, EnumType enumerationType, DefCat defCategory, ReportFKType fKType)
 {
     multInputItems.Add(new MultInputItem(promptingText, valueType, currentValues, enumerationType, defCategory, fKType));
 }
Пример #30
0
 private FieldValue(FieldValueType fieldValueType, long longValue)
 {
     _fieldValueType = fieldValueType;
     _longValue      = longValue;
 }
Пример #31
0
        /*public void AddParameter(string name,ParameterValueKind valueKind){
            ParameterFields.Add(new ParameterFieldDefinition(name,valueKind));
        }*/
        ///<summary>Adds a parameterField which will be used in the query to represent user-entered data.</summary>
        ///<param name="myName">The unique formula name of the parameter.</param>
        ///<param name="myValueType">The data type that this parameter stores.</param>
        ///<param name="myDefaultValue">The default value of the parameter</param>
        ///<param name="myPromptingText">The text to prompt the user with.</param>
        ///<param name="mySnippet">The SQL snippet that this parameter represents.</param>
        public void AddParameter(string myName,FieldValueType myValueType
			,object myDefaultValue,string myPromptingText,string mySnippet)
        {
            parameterFields.Add(new ParameterField(myName,myValueType,myDefaultValue,myPromptingText,mySnippet));
        }
Пример #32
0
 public static string ToSerialString(this FieldValueType value) => value switch
 {
Пример #33
0
 /**
  * Build out this field value with a type.
  *
  * @param type The type.
  * @return this.
  */
 public FieldValue SetType(FieldValueType type)
 {
     KnownType = type;
     return this;
 }
Пример #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldValue"/> structure. This constructor
 /// is intended to be used for internal testing only.
 /// </summary>
 /// <param name="type">The field type.</param>
 internal FieldValue(FieldValueType type)
     : this()
 {
     ValueType   = type;
     _fieldValue = new FieldValue_internal(type);
 }
Пример #35
0
 /// <summary>Overload for ValueKind enum.</summary>
 public void AddParameter(string myName, FieldValueType myValueType
                          , ArrayList myDefaultValues, string myPromptingText, string mySnippet, EnumType myEnumerationType)
 {
     parameterFields.Add(new ParameterField(myName, myValueType, myDefaultValues, myPromptingText, mySnippet, myEnumerationType));
 }
Пример #36
0
		/// <summary>Overload for ValueKind enum.</summary>
		public void AddParameter(string myName,FieldValueType myValueType
			,ArrayList myDefaultValues,string myPromptingText,string mySnippet,EnumType myEnumerationType){
			_parameterFields.Add(new ParameterField(myName,myValueType,myDefaultValues,myPromptingText,mySnippet,myEnumerationType));
		}
Пример #37
0
		///<summary>Overload for SummaryField ReportObject</summary>
		public ReportObject(string name,string sectionName,Point location,Size size,SummaryOperation summaryOperation,string summarizedFieldName,Font font,ContentAlignment contentAlignment,string stringFormat) {
			_name=name;
			_sectionName=sectionName;
			_location=location;
			_size=size;
			_font=font;
			_contentAlignment=contentAlignment;
			_stringFormat=stringFormat;
			_fieldDefKind=FieldDefKind.SummaryField;
			_fieldValueType=FieldValueType.Number;
			_summaryOperation=summaryOperation;
			_summarizedFieldName=summarizedFieldName;
			//defaults:
			_foreColor=Color.Black;
			_reportObjectKind=ReportObjectKind.FieldObject;
		}
Пример #38
0
 /// <summary>Adds all the objects necessary for a typical column, including the textObject for column header and the fieldObject for the data.  Does not add lines or shading. If the column is type Double, then the alignment is set right and a total field is added. Also, default formatstrings are set for dates and doubles.</summary>
 /// <param name="dataField">The name of the column title as well as the dataField to add.</param>
 /// <param name="width"></param>
 /// <param name="valueType"></param>
 public void AddColumn(string dataField,int width,FieldValueType valueType)
 {
     dataFields.Add(dataField);
     //FormReport FormR=new FormReport();
     //Graphics grfx=FormR.CreateGraphics();
     Font font;
     Size size;
     ContentAlignment textAlign;
     if(valueType==FieldValueType.Number){
         textAlign=ContentAlignment.MiddleRight;
     }
     else{
         textAlign=ContentAlignment.MiddleLeft;
     }
     string formatString="";
     if(valueType==FieldValueType.Number){
         formatString="n";
     }
     if(valueType==FieldValueType.Date){
         formatString="d";
     }
     if(sections["Page Header"]==null){
         sections.Add(new Section(AreaSectionKind.PageHeader,0));
     }
     //add textobject for column header
     font=new Font("Tahoma",8,FontStyle.Bold);
     size=new Size((int)(grfx.MeasureString(dataField,font).Width/grfx.DpiX*100+2)
         ,(int)(grfx.MeasureString(dataField,font).Height/grfx.DpiY*100+2));
     if(sections["Page Header"].Height==0){
         sections["Page Header"].Height=size.Height;
     }
     int xPos=0;
     //find next available xPos
     foreach(ReportObject reportObject in reportObjects){
         if(reportObject.SectionName!="Page Header") continue;
         if(reportObject.Location.X+reportObject.Size.Width > xPos){
             xPos=reportObject.Location.X+reportObject.Size.Width;
         }
     }
     ReportObjects.Add(new ReportObject("Page Header"
         ,new Point(xPos,0),new Size(width,size.Height),dataField,font,textAlign));
     //add fieldObject for rows in details section
     font=new Font("Tahoma",9);
     size=new Size((int)(grfx.MeasureString(dataField,font).Width/grfx.DpiX*100+2)
         ,(int)(grfx.MeasureString(dataField,font).Height/grfx.DpiY*100+2));
     if(sections["Detail"].Height==0){
         sections["Detail"].Height=size.Height;
     }
     reportObjects.Add(new ReportObject("Detail"
         ,new Point(xPos,0),new Size(width,size.Height)
         ,dataField,valueType
         //,new FieldDef(dataField,valueType)
         ,font,textAlign,formatString));
     //add fieldObject for total in ReportFooter
     if(valueType==FieldValueType.Number){
         font=new Font("Tahoma",9,FontStyle.Bold);
         //use same size as already set for otherFieldObjects above
         if(sections["Report Footer"]==null){
             sections.Add(new Section(AreaSectionKind.ReportFooter,0));
         }
         if(sections["Report Footer"].Height==0){
             sections["Report Footer"].Height=size.Height;
         }
         reportObjects.Add(new ReportObject("Report Footer"
             ,new Point(xPos,0),new Size(width,size.Height)
             ,SummaryOperation.Sum,dataField
             //,new FieldDef("Sum"+dataField,SummaryOperation.Sum
             //,GetLastRO(ReportObjectKind.FieldObject).DataSource)
             ,font,textAlign,formatString));
     }
     //tidy up
     //grfx.Dispose();
     //FormR.Dispose();
     return;
 }
Пример #39
0
 public SimpleValueTestNode(Expression expr, FieldValueType type)
     : base(expr)
 {
     ValueType = type;
 }
Пример #40
0
        /// <summary>Overload for ValueKind defCat.</summary>
        public void AddParameter(string myName,FieldValueType myValueType
			,ArrayList myDefaultValues,string myPromptingText,string mySnippet,ReportFKType myReportFKType)
        {
            parameterFields.Add(new ParameterField(myName,myValueType,myDefaultValues,myPromptingText,mySnippet,myReportFKType));
        }
Пример #41
0
        ///<summary>Overload for SummaryField ReportObject</summary>
        public ReportObject(string thisSectionName,Point thisLocation,Size thisSize
			,SummaryOperation thisOperation,string thisSummarizedField
			,Font thisFont,ContentAlignment thisTextAlign,string thisFormatString)
        {
            sectionName=thisSectionName;
            location=thisLocation;
            size=thisSize;
            font=thisFont;
            textAlign=thisTextAlign;
            formatString=thisFormatString;
            fieldKind=FieldDefKind.SummaryField;
            valueType=FieldValueType.Number;
            operation=thisOperation;
            summarizedField=thisSummarizedField;
            //defaults:
            foreColor=Color.Black;
            objectKind=ReportObjectKind.FieldObject;
        }
Пример #42
0
		///<summary>Overload for ValueKind DefCat.</summary>
		public ParameterField(string thisName,FieldValueType thisValueType,ArrayList theseDefaultValues,string thisPromptingText,string thisSnippet,DefCat thisDefCategory){
			name=thisName;
			valueType=thisValueType;
			defaultValues=theseDefaultValues;
			promptingText=thisPromptingText;
			snippet=thisSnippet;
			enumerationType=EnumType.ApptStatus;//arbitrary
			defCategory=thisDefCategory;
			fKeyType=ReportFKType.None;
		}
Пример #43
0
        ///<summary>Overload for SpecialField ReportObject</summary>
        public ReportObject(string thisSectionName,Point thisLocation,Size thisSize
			,FieldValueType thisValueType,SpecialFieldType thisSpecialType
			,Font thisFont,ContentAlignment thisTextAlign,string thisFormatString)
        {
            sectionName=thisSectionName;
            location=thisLocation;
            size=thisSize;
            font=thisFont;
            textAlign=thisTextAlign;
            formatString=thisFormatString;
            fieldKind=FieldDefKind.SpecialField;
            valueType=thisValueType;
            specialType=thisSpecialType;
            //defaults:
            foreColor=Color.Black;
            objectKind=ReportObjectKind.FieldObject;
        }
Пример #44
0
 public FieldValueHolder(FieldValueType ftype)
 {
     this.ftype = ftype;
 }
Пример #45
0
        internal static FieldValue_internal DeserializeFieldValue_internal(JsonElement element)
        {
            FieldValueType            type             = default;
            Optional <string>         valueString      = default;
            Optional <DateTimeOffset> valueDate        = default;
            Optional <TimeSpan>       valueTime        = default;
            Optional <string>         valuePhoneNumber = default;
            Optional <float>          valueNumber      = default;
            Optional <long>           valueInteger     = default;
            Optional <IReadOnlyList <FieldValue_internal> > valueArray = default;
            Optional <IReadOnlyDictionary <string, FieldValue_internal> > valueObject = default;
            Optional <FieldValueSelectionMark> valueSelectionMark = default;
            Optional <string> text = default;
            Optional <IReadOnlyList <float> > boundingBox = default;
            Optional <float> confidence = default;
            Optional <IReadOnlyList <string> > elements = default;
            Optional <int> page = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString().ToFieldValueType();
                    continue;
                }
                if (property.NameEquals("valueString"))
                {
                    valueString = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valueDate"))
                {
                    valueDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("valueTime"))
                {
                    valueTime = property.Value.GetTimeSpan("T");
                    continue;
                }
                if (property.NameEquals("valuePhoneNumber"))
                {
                    valuePhoneNumber = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("valueNumber"))
                {
                    valueNumber = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("valueInteger"))
                {
                    valueInteger = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("valueArray"))
                {
                    List <FieldValue_internal> array = new List <FieldValue_internal>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DeserializeFieldValue_internal(item));
                    }
                    valueArray = array;
                    continue;
                }
                if (property.NameEquals("valueObject"))
                {
                    Dictionary <string, FieldValue_internal> dictionary = new Dictionary <string, FieldValue_internal>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, DeserializeFieldValue_internal(property0.Value));
                    }
                    valueObject = dictionary;
                    continue;
                }
                if (property.NameEquals("valueSelectionMark"))
                {
                    valueSelectionMark = new FieldValueSelectionMark(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("text"))
                {
                    text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("boundingBox"))
                {
                    List <float> array = new List <float>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetSingle());
                    }
                    boundingBox = array;
                    continue;
                }
                if (property.NameEquals("confidence"))
                {
                    confidence = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("elements"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    elements = array;
                    continue;
                }
                if (property.NameEquals("page"))
                {
                    page = property.Value.GetInt32();
                    continue;
                }
            }
            return(new FieldValue_internal(type, valueString.Value, Optional.ToNullable(valueDate), Optional.ToNullable(valueTime), valuePhoneNumber.Value, Optional.ToNullable(valueNumber), Optional.ToNullable(valueInteger), Optional.ToList(valueArray), Optional.ToDictionary(valueObject), Optional.ToNullable(valueSelectionMark), text.Value, Optional.ToList(boundingBox), Optional.ToNullable(confidence), Optional.ToList(elements), Optional.ToNullable(page)));
        }
Пример #46
0
		///<summary>Overload for GroupSummary ReportObject</summary>
		public ReportObject(string name,string sectionName,Point location,Size size,Color color,string summarizedFieldName,string datafield,Font font,SummaryOperation summaryOperation,int offSetX,int offSetY) {
			_name=name;
			_sectionName=sectionName;
			_location=location;
			_size=size;
			_dataFieldName=datafield;
			_font=font;
			_fieldDefKind=FieldDefKind.SummaryField;
			_fieldValueType=FieldValueType.Number;
			_summaryOperation=summaryOperation;
			_summarizedFieldName=summarizedFieldName;
			_offSetX=offSetX;
			_offSetY=offSetY;
			_foreColor=color;
			//defaults:
			_contentAlignment=ContentAlignment.MiddleRight;
			_reportObjectKind=ReportObjectKind.TextObject;
		}
Пример #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationFieldItem"/> class.
 /// </summary>
 /// <param name="referenceName">The field name of the destination field.</param>
 /// <param name="mappingName">The field name of the source field.</param>
 /// <param name="valueType">Determines whether the exported value should be plain text or html.</param>
 /// <param name="direction">Determines the copy direction of the field.</param>
 /// <param name="rowIndex">Table row index.</param>
 /// <param name="colIndex">Table column index.</param>
 /// <param name="testCaseStepDelimiter">Delimiter string for Test Case step between Title and Expected Result.</param>
 /// <param name="handleAsDocument">Flag whether field value is handled as document.</param>
 /// <param name="handleAsDocumentMode">Defines type for HandleAsDocument processing.</param>
 /// <param name="defaultValue">Default value of this field. Null means that no default value defined and don't configure this default value in GUI.</param>
 /// <param name="shapeOnlyWorkaroundMode">The mode used to work around the shape only restriction.</param>
 /// <param name="wordBookmark">a word Bookmark that is inserted at the corresponding field</param>
 public ConfigurationFieldItem(
     string referenceName, string mappingName, FieldValueType valueType, Direction direction, int rowIndex,
     int colIndex, string testCaseStepDelimiter, bool handleAsDocument, HandleAsDocumentType handleAsDocumentMode, string oLEMarkerField, string oLEMarkerValue, IConfigurationFieldItemDefaultValue defaultValue, ShapeOnlyWorkaroundMode shapeOnlyWorkaroundMode, string wordBookmark, string variableName, string dateTimeFormat)
     : this(referenceName, mappingName, valueType, direction, rowIndex, colIndex, testCaseStepDelimiter, handleAsDocument, handleAsDocumentMode, oLEMarkerField, oLEMarkerValue, defaultValue, shapeOnlyWorkaroundMode, true, wordBookmark, variableName, dateTimeFormat)
 {
 }
Пример #48
0
		/// <summary></summary>
		public void AddInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType,DefCat defCategory,ReportFKType fKType){
			multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,enumerationType,defCategory,fKType));
		}
Пример #49
0
 internal FieldValue_internal(FieldValueType type)
 {
     Type = type;
 }
Пример #50
0
		/// <summary>Overload for using DefCat.</summary>
		public void AddInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,DefCat defCategory){
			if(currentValues==null)
				currentValues=new ArrayList();
			multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,EnumType.ApptStatus,defCategory,ReportFKType.None));
		}
Пример #51
0
 ///<summary>Adds a parameterField which will be used in the query to represent user-entered data.</summary>
 ///<param name="myName">The unique formula name of the parameter.</param>
 ///<param name="myValueType">The data type that this parameter stores.</param>
 ///<param name="myDefaultValue">The default value of the parameter</param>
 ///<param name="myPromptingText">The text to prompt the user with.</param>
 ///<param name="mySnippet">The SQL snippet that this parameter represents.</param>
 public void AddParameter(string myName, FieldValueType myValueType
                          , object myDefaultValue, string myPromptingText, string mySnippet)
 {
     _parameterFields.Add(new ParameterField(myName, myValueType, myDefaultValue, myPromptingText, mySnippet));
 }
Пример #52
0
		///<summary></summary>
		public void AddInputItem(string myPromptingText,FieldValueType myValueType,ArrayList myCurrentValues,EnumType myEnumerationType,DefCat myDefCategory,ReportFKType myFKType){
			MultInput2.AddInputItem(myPromptingText,myValueType,myCurrentValues,myEnumerationType,myDefCategory,myFKType);
		}
Пример #53
0
 /// <summary>Overload for ValueKind defCat.</summary>
 public void AddParameter(string myName, FieldValueType myValueType
                          , ArrayList myDefaultValues, string myPromptingText, string mySnippet, ReportFKType myReportFKType)
 {
     _parameterFields.Add(new ParameterField(myName, myValueType, myDefaultValues, myPromptingText, mySnippet, myReportFKType));
 }
Пример #54
0
		///<summary>Font default is Tahoma 9pt</summary>
		public void AddColumn(string dataField,int width,FieldValueType fieldValueType) {
			AddColumn(dataField,width,fieldValueType,new Font("Tahoma",9));
		}
Пример #55
0
 public FieldValueHolder(FieldValueType ftype)
 {
     this.ftype = ftype;
 }