public override int GetHashCode() { unchecked { var hashCode = ByteField.GetHashCode(); hashCode = (hashCode * 397) ^ SByteField.GetHashCode(); hashCode = (hashCode * 397) ^ Int16Field.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16Field.GetHashCode(); hashCode = (hashCode * 397) ^ Int32Field; hashCode = (hashCode * 397) ^ (int)UInt32Field; hashCode = (hashCode * 397) ^ Int64Field.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64Field.GetHashCode(); hashCode = (hashCode * 397) ^ DecimalField.GetHashCode(); hashCode = (hashCode * 397) ^ SingleFiled.GetHashCode(); hashCode = (hashCode * 397) ^ DoubleField.GetHashCode(); hashCode = (hashCode * 397) ^ (StringField != null ? StringField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)MyEnumField; hashCode = (hashCode * 397) ^ BooleanField.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeField.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeOffsetField.GetHashCode(); hashCode = (hashCode * 397) ^ GuidField.GetHashCode(); hashCode = (hashCode * 397) ^ TimeSpanField.GetHashCode(); hashCode = (hashCode * 397) ^ (UrlField != null ? UrlField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NullField != null ? NullField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IntArrayField != null ? IntArrayField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (StringArrayField != null ? StringArrayField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (EmptyArrayField != null ? EmptyArrayField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NullArrayField != null ? NullArrayField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DictionaryArrayField != null ? DictionaryArrayField.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ObjectArrayField != null ? ObjectArrayField.GetHashCode() : 0); return(hashCode); } }
public void DefaultValTest() { BooleanField bf = new BooleanField(110); Assert.That(false, Is.EqualTo(bf.Obj)); Assert.That(110, Is.EqualTo(bf.Tag)); CharField cf = new CharField(300); Assert.That('\0', Is.EqualTo(cf.getValue())); Assert.That(300, Is.EqualTo(cf.Tag)); DateTimeField dtf = new DateTimeField(3); Assert.That(3, Is.EqualTo(dtf.Tag)); StringField sf = new StringField(32); Assert.That(32, Is.EqualTo(sf.Tag)); Assert.That("", Is.EqualTo(sf.Obj)); IntField ifld = new IntField(239); Assert.That(239, Is.EqualTo(ifld.Tag)); Assert.That(0, Is.EqualTo(ifld.Obj)); DecimalField df = new DecimalField(1); Assert.That(1, Is.EqualTo(df.Tag)); Assert.That(new Decimal(0.0), Is.EqualTo(df.Obj)); }
public void Test() { var fields = new FieldList(); fields.Add <Primitive>(x => x.Id("field1").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field2").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field3").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field4").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field5").DataType(SchemaDataType.Primitive).IsNullable().Build()); PrimitiveField field = Field.Builder <Decimal>() .Id("field3") .Precision(2) .Scale(5) .IsNullable() .Build(); Assert.AreEqual(5, fields.Count); PrimitiveField replaced = fields.Replace(2, field); Assert.AreEqual(5, fields.Count); DecimalField decimalField = fields[2].Cast <DecimalField>(); Assert.AreEqual(SchemaDataType.Decimal, decimalField.DataType); Assert.AreEqual("field3", decimalField.Id); Assert.AreEqual(2, decimalField.Precision); Assert.AreEqual(5, decimalField.Scale); }
public void SubsetSumLLLReductionAlgorithmConstructorTest() { var integerDomain = new IntegerDomain(); var decimalField = new DecimalField(); var vectorFactory = new ArrayVectorFactory <decimal>(); var decimalComparer = Comparer <decimal> .Default; var nearest = new DecimalNearestInteger(); // Permite calcular o produto escalar de vectores sobre o corpo de decimais. var scalarProd = new OrthoVectorScalarProduct <decimal>( decimalComparer, decimalField); // Permite converter um número decimal num inteiro, caso seja possível. var integerDecimalConverter = new IntegerDecimalConverter(); var subsetSumAlg = new SubsetSumLLLReductionAlgorithm <int, decimal>( vectorFactory, scalarProd, nearest, Comparer <decimal> .Default, integerDecimalConverter, decimalField); var vector = new[] { 366, 385, 392, 401, 422, 437 }; var result = subsetSumAlg.Run(vector, 1215, 3M / 4); var expected = new[] { 392, 401, 422 }; CollectionAssert.AreEquivalent(expected, result); }
/// <summary> /// Read the chart settings from the posted json /// </summary> void readSettings(JObject json) { if (json != null) { if (json["filters"] != null) { JObject fdata = (JObject)json["filters"]; foreach (Reports.Filter f in _filters) { JToken data = fdata[f.AsString("data")]; if (data == null) { continue; } f.Parse(data); } } JObject sdata = (JObject)json["parameters"]; if (sdata != null) { _settings = sdata.To <ChartSettings>(); } } _y = _fields.FirstOrDefault(f => f.Name == _settings.Y) ?? _fields.First(); _x1 = _series.FirstOrDefault(f => f.Name == _settings.X1) ?? _series.First(); _x2 = _series.FirstOrDefault(f => f.Name == _settings.X2); if (_x2 == _x1) { _x2 = null; } }
public void Verify_can_replace_by_id() { var fields = new FieldList(); fields.Add <Primitive>(x => x.Id("field1").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field2").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field3").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field4").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add <Primitive>(x => x.Id("field5").DataType(SchemaDataType.Primitive).IsNullable().Build()); PrimitiveField field = Field.Builder <Decimal>() .Id("field3A") .Precision(2) .Scale(5) .IsNullable() .Build(); Assert.AreEqual(5, fields.Count); Assert.IsTrue(fields.TryReplace("field3", field, out PrimitiveField replaced)); Assert.AreEqual(5, fields.Count); Assert.IsTrue(replaced.HasValue); Assert.AreEqual("field3", replaced.Id); Assert.AreEqual(SchemaDataType.Primitive, replaced.DataType); DecimalField f1 = fields[2].Cast <DecimalField>(); Assert.AreEqual("field3A", f1.Id); Assert.AreEqual(2, f1.Precision); Assert.AreEqual(5, f1.Scale); }
public void DefaultFieldTest() { DecimalField field = new DecimalField(200, new Decimal(101.0001)); fieldmap.SetField(field); string refield = fieldmap.GetString(200); Assert.That("101.0001", Is.EqualTo(refield)); }
public void DecimalFieldTest() { Decimal val = new Decimal(3.232535); Decimal newval = new Decimal(3.14159); DecimalField field = new DecimalField(200, val); Assert.That(field.Obj, Is.EqualTo(val)); Assert.That(field.getValue(), Is.EqualTo(val)); Assert.That(field.Tag, Is.EqualTo(200)); field.Obj = newval; Assert.That(field.Obj, Is.EqualTo(newval)); }
public void DecimalField_CastInteger_20677() { var decfield = new DecimalField(); var field = decfield.As <Field>(); int value = 10; var valueO = (object)value; var result = field.ValidateFieldValue(valueO); Assert.IsNull(result); }
public void FromFieldEntity_Decimal() { var f = new DecimalField(); f.DecimalPlaces = 5; ExprType res = ExprTypeHelper.FromFieldEntity(f); Assert.That(res.Type, Is.EqualTo(DataType.Decimal)); Assert.That(res.DecimalPlaces, Is.EqualTo(5)); }
public void Test() { DecimalField field = Field.Builder <Decimal>() .Id("field1") .Precision(2) .Scale(4) .Build(); Assert.AreEqual(2, field.Cast <DecimalField>().Precision); Assert.AreEqual(4, field.Cast <DecimalField>().Scale); }
/// <summary> /// Get an ExprType that's appropriate for a given field. /// </summary> /// <param name="fieldEntity"></param> /// <returns></returns> public static ExprType FromFieldEntity(IEntity fieldEntity) { DataType dataType = FieldHelper.ConvertToDataType(fieldEntity); ExprType exprType = new ExprType(dataType); DecimalField decimalField = fieldEntity.As <DecimalField>(); if (decimalField != null) { exprType.DecimalPlaces = decimalField.DecimalPlaces; } return(exprType); }
public void DecimalFieldTest() { DecimalField field = new DecimalField(200, new Decimal(101.0001)); DecimalField refield = new DecimalField(200); fieldmap.SetField(field); fieldmap.GetField(refield); Assert.That(101.0001, Is.EqualTo(refield.Obj)); field.setValue(new Decimal(101.0002)); fieldmap.SetField(field); fieldmap.GetField(refield); Assert.That(101.0002, Is.EqualTo(refield.Obj)); }
public void Test() { PrimitiveField spec1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec4 = Field.Builder <Primitive>() .Id("field4") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec5 = Field.Builder <Primitive>() .Id("field5") .DataType(SchemaDataType.Primitive) .Build(); DecimalField spec6 = Field.Builder <Decimal>() .Id("field6") .Precision(2) .Scale(4) .Build(); var schema = Schema.Builder() .Field(spec1) .Field(spec2) .Field(spec3) .Field(spec4) .Field(spec5) .Field(spec6) .Build(); int count = 0; foreach (var field in schema.Fields.ToEnumerable()) { count++; } Assert.AreEqual(6, count); }
public void Verify_can_access_list_with_multiple_field_types() { var fields = new FieldList(); fields.Add(Field.Builder <Primitive>().Id("field1").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field2").DataType(SchemaDataType.Map).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field3").DataType(SchemaDataType.List).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field4").DataType(SchemaDataType.Primitive).IsNullable().Build()); fields.Add(Field.Builder <Primitive>().Id("field5").DataType(SchemaDataType.Primitive).IsNullable().Build()); IReadOnlyFieldList temp = fields; for (int i = 0; i < temp.Count; i++) { switch (temp[i].DataType) { case SchemaDataType.None: break; case SchemaDataType.Primitive: PrimitiveField specification = temp[i]; Assert.IsNotNull(specification); Assert.That(specification.Id, Is.EqualTo("field1").Or.EqualTo("field4").Or.EqualTo("field5")); break; case SchemaDataType.Map: // MapField mapField = schema.Fields[i].Cast<MapField>(); // Assert.IsNotNull(mapField); // Assert.AreEqual("field2", mapField.Id); break; case SchemaDataType.List: // ListField listField = schema.Fields[i].Cast<ListField>(); // Assert.IsNotNull(listField); // Assert.AreEqual("field3", listField.Id); break; case SchemaDataType.Decimal: DecimalField spec = temp[i].Cast <DecimalField>(); Assert.IsNotNull(spec); Assert.AreEqual("field6", spec.Id); break; case SchemaDataType.Struct: break; default: throw new ArgumentOutOfRangeException(); } } }
public Entities.Forms.DecimalField ToEntity(DecimalField field) { return(new Entities.Forms.DecimalField { Description = field.Description, FieldName = field.FieldName, IsRequired = field.IsRequired, DefaultValue = field.DefaultValue, Min = field.Min, Max = field.Max, AllowFilter = field.AllowFilter, FieldType = GetFieldType(field), IsUnique = field.IsUnique, AllowSort = field.AllowSort, DisplayName = field.DisplayName }); }
public static Field[] ToFieldArray(this IEnumerable<ICustomFieldDefinition> items, ICollection<Field> collection, string namePrefix, Action<Field, ICustomFieldDefinition> initialize = null) { var result = new List<Field>(); foreach (var item in items) { var flags = item.IsRequired ? Required : NotRequired; var caption = ToLocalText(item.Title); var name = (namePrefix ?? "") + item.Name; Field field; switch (item.FieldType) { case CustomFieldType.Boolean: field = new BooleanField(collection, name, caption, 0, flags); break; case CustomFieldType.Date: field = new DateTimeField(collection, name, caption, 0, flags) { DateTimeKind = DateTimeKind.Unspecified }; break; case CustomFieldType.DateTime: field = new DateTimeField(collection, name, caption, 0, flags) { DateTimeKind = DateTimeKind.Local }; break; case CustomFieldType.Decimal: field = new DecimalField(collection, name, caption, item.Size, flags); break; case CustomFieldType.Int32: field = new Int32Field(collection, name, caption, item.Size, flags); break; case CustomFieldType.Int64: field = new Int64Field(collection, name, caption, item.Size, flags); break; default: field = new StringField(collection, name, caption, item.Size, flags); break; } field.DefaultValue = item.DefaultValue.TrimToNull(); result.Add(field); if (initialize != null) initialize(field, item); } return result.ToArray(); }
public void Verify_does_not_throw_when_cannot_return_field() { PrimitiveField spec1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec4 = Field.Builder <Primitive>() .Id("field4") .DataType(SchemaDataType.Primitive) .Build(); PrimitiveField spec5 = Field.Builder <Primitive>() .Id("field5") .DataType(SchemaDataType.Primitive) .Build(); DecimalField spec6 = Field.Builder <Decimal>() .Id("field6") .Precision(2) .Scale(4) .Build(); var schema = Schema.Builder() .Field(spec1) .Field(spec2) .Field(spec3) .Field(spec4) .Field(spec5) .Field(spec6) .Build(); Assert.IsNotNull(schema.Fields["field7"]); }
public void Verify_can_set_by_schema_builder() { var fields = new FieldList(); PrimitiveField field1 = Field.Builder <Primitive>() .Id("fieldA") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field1); PrimitiveField field2 = Field.Builder <Primitive>() .Id("fieldB") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field2); PrimitiveField field3 = Field.Builder <Primitive>() .Id("fieldC") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field3); DecimalField field4 = Field.Builder <Decimal>() .Id("field") .Precision(5) .Scale(2) .Build(); fields.Add(field4); var schema = Schema.Builder() .Field <Struct>(x => x.Id("fieldX").IsNullable().Fields(fields).Build()) .Build(); Assert.AreEqual(1, schema.Fields.Count); Assert.AreEqual(5, schema.Fields.SelectMany().Count); }
public void BuildDecimal(ExtensionItem extension) { DecimalField propField = (DecimalField)ObjectUtils.CreateCopy(modelDecimalField); propField.DynamicProperty = null; propField.ChildrenFields.Clear(); propField.EntityKey = currEntityKey; propField.Entity = currEntity; if (propField.UpdateActions != null) { propField.UpdateActions.Clear(); } // 必改属性,涉及到数据的加载 propField.Key = extension.Key; propField.FieldName = extension.Key.ToUpperInvariant(); propField.PropertyName = extension.Key; propField.Name = new LocaleValue(extension.Name); _currBusinessInfo.Add(propField); }
public void Test() { DecimalField spec = Field.Builder <Decimal>() .Id("field") .IsNullable() .Precision(2) .Scale(4) .Build(); var schema = Schema.Builder() .Field(spec) // .Field("field1", x => // { // x.SetPrecision(2); // x.SetScale(4); // }, true) .Build(); Assert.IsTrue(schema.Fields.HasValues); Assert.AreEqual(2, schema.Fields[0].Cast <DecimalField>().Precision); Assert.AreEqual(4, schema.Fields[0].Cast <DecimalField>().Scale); }
public void RunTest2() { var integerDomain = new IntegerDomain(); var decimalField = new DecimalField(); var vectorFactory = new ArrayVectorFactory <decimal>(); var decimalComparer = Comparer <decimal> .Default; var nearest = new DecimalNearestInteger(); var scalarProd = new OrthoVectorScalarProduct <decimal>( decimalComparer, decimalField); var integerDecimalConverter = new IntegerDecimalConverter(); var dim = 4; var vectorSet = new IMathVector <decimal> [dim]; var lllReductionAlg = new LLLBasisReductionAlgorithm <IMathVector <decimal>, decimal, int>( new VectorSpace <decimal>(dim, vectorFactory, decimalField), scalarProd, nearest, Comparer <decimal> .Default); vectorSet[0] = new ArrayMathVector <decimal>(new decimal[] { 1, 1, 7, 2 }); vectorSet[1] = new ArrayMathVector <decimal>(new decimal[] { 9, 8, 4, 6 }); vectorSet[2] = new ArrayMathVector <decimal>(new decimal[] { 1, 8, 5, 7 }); vectorSet[3] = new ArrayMathVector <decimal>(new decimal[] { 2, 3, 1, 1 }); var reduced = lllReductionAlg.Run(vectorSet, 3M / 4); var expected = new IMathVector <decimal> [dim]; expected[0] = new ArrayMathVector <decimal>(new decimal[] { 2, 3, 1, 1 }); expected[1] = new ArrayMathVector <decimal>(new decimal[] { 3, -1, 1, 3 }); expected[2] = new ArrayMathVector <decimal>(new decimal[] { -2, 2, 6, -1 }); expected[3] = new ArrayMathVector <decimal>(new decimal[] { -4, 1, -4, 3 }); this.AsserVectorLists(expected, reduced); }
public void RunTest1() { var integerDomain = new IntegerDomain(); var decimalField = new DecimalField(); var vectorFactory = new ArrayVectorFactory <decimal>(); var decimalComparer = Comparer <decimal> .Default; var nearest = new DecimalNearestInteger(); var scalarProd = new OrthoVectorScalarProduct <decimal>( decimalComparer, decimalField); var integerDecimalConverter = new IntegerDecimalConverter(); var lllReductionAlg = new LLLBasisReductionAlgorithm <IMathVector <decimal>, decimal, int>( new VectorSpace <decimal>(3, vectorFactory, decimalField), scalarProd, nearest, Comparer <decimal> .Default); var vectorSet = new IMathVector <decimal> [3]; vectorSet[0] = new ArrayMathVector <decimal>(new decimal[] { 1, 1, 1 }); vectorSet[1] = new ArrayMathVector <decimal>(new decimal[] { -1, 0, 2 }); vectorSet[2] = new ArrayMathVector <decimal>(new decimal[] { 3, 5, 6 }); var reduced = lllReductionAlg.Run(vectorSet, 3M / 4); // O resultado esperado. var expected = new IMathVector <decimal> [3]; expected[0] = new ArrayMathVector <decimal>(new decimal[] { 0, 1, 0 }); expected[1] = new ArrayMathVector <decimal>(new decimal[] { 1, 0, 1 }); expected[2] = new ArrayMathVector <decimal>(new decimal[] { -1, 0, 2 }); this.AsserVectorLists(expected, reduced); }
protected override void ConstructFields() { TableName = "TBL_PATIENT"; m_fldID = new StringField() { Owner = this, FieldName = "PATIENT_ID", Description = "ID", Size = 12, Required = true, KeyField = true }; m_fldFirstName = new StringField(){ Owner = this, FieldName = "FIRST_NAME", Description = "First Name", Size = 50, Required = true }; m_fldLastName = new StringField() { Owner = this, FieldName = "LAST_NAME", Description = "Last Name", Size = 50, Required = true }; m_fldContactPhone = new StringField() { Owner = this, FieldName = "PHONE_CONTACT", Description = "Contact Phone#", DataEntryFormat = DataEntryFormat.Phone, Size = 25 }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB", Description = "Date of Birth", Required = true }; m_fldAdmissionDate = new DateTimeField() { Owner = this, FieldName = "ADM_DATE", Description = "Admission Date" }; m_fldMonthlyCost = new DecimalField() { Owner = this, FieldName = "MONTHLY_COST", Description = "Monthly Cost", MinValue = 0, DisplayFormat = "C" }; m_fldClassification = new StringField() { Owner = this, FieldName = "ATTITUDE_CLASSIFICATION", Description = "Classification", Required = true, Size = 3, LookupType = LookupType.Dictionary, DataEntryType = DataEntryType.Lookup, HasDefaultValue = true, DefaultValue = "BUD" }; m_fldClassification.LookupDictionary.Add("MRX, Marxist", "CAP, Capitalist", "NEH, Nehilist", "BUD, Buddhist"); m_fldReligious = new BoolField() { Owner = this, FieldName = "IS_RELIGIOUS", Description = "Religious", Required = true, DefaultValue = false, HasDefaultValue = true }; }
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName) { string strCreateTable = string.Format(@" /*dialect*/SELECT TM.FID,TM.FBILLNO,TM.FCREATORID,TM.FCREATEDATE,TF.FALLAMOUNT,ml.FNAME as FMaterialName,TE.FENTRYID as FIDENTITYID INTO {0} FROM T_PUR_POORDER TM INNER JOIN T_PUR_POORDERENTRY_F TF ON TM.FID = TF.FID INNER JOIN T_PUR_POORDERENTRY TE ON TM.FID = TE.FID inner join T_BD_MATERIAL m on te.FMATERIALID = m.FMATERIALID inner join T_BD_MATERIAL_L ml on m.FMATERIALID = ml.FMATERIALID WHERE 1=1 ", tableName); var custFilter = filter.FilterParameter.CustomFilter; if (custFilter != null && custFilter.DynamicObjectType.Properties.Contains("F_PAEZ_Date")) { var date = custFilter["F_PAEZ_Date"]; if (date != null && !string.IsNullOrEmpty(date.ToString())) { string strDate = DateTime.Parse(date.ToString()).ToString("yyyy-MM-dd"); strCreateTable += string.Format(" AND TM.FCREATEDATE >= '{0}'", strDate); } } //base.AfterCreateTempTable(tablename); DBUtils.ExecuteDynamicObject(this.Context, strCreateTable); DataTable reportSouce = DBUtils.ExecuteDataSet(this.Context, string.Format("SELECT * FROM {0}", tableName)).Tables[0]; this.SettingInfo = new PivotReportSettingInfo(); TextField field; DecimalField fieldData; //构造透视表列 //FID field = new TextField(); field.Key = "FBILLNO"; field.FieldName = "FBILLNO"; field.Name = new LocaleValue("单据编号"); SettingField settingBillNo = PivotReportSettingInfo.CreateColumnSettingField(field, 0); settingBillNo.IsShowTotal = false; this.SettingInfo.RowTitleFields.Add(settingBillNo); this.SettingInfo.SelectedFields.Add(settingBillNo); field = new TextField(); field.Key = "FCREATORID"; field.FieldName = "FCREATORID"; field.Name = new LocaleValue("创建者"); SettingField settingCreateId = PivotReportSettingInfo.CreateColumnSettingField(field, 1); this.SettingInfo.RowTitleFields.Add(settingCreateId); this.SettingInfo.SelectedFields.Add(settingCreateId); //构造行 field = new TextField(); field.Key = "FMaterialName"; field.FieldName = "FMaterialName"; field.Name = new LocaleValue("物料名称"); SettingField settingMaterial = PivotReportSettingInfo.CreateColumnSettingField(field, 0); settingMaterial.IsShowTotal = false; this.SettingInfo.ColTitleFields.Add(settingMaterial); this.SettingInfo.SelectedFields.Add(settingMaterial); //构造数据 fieldData = new DecimalField(); fieldData.Key = "FALLAMOUNT"; fieldData.FieldName = "FALLAMOUNT"; fieldData.Name = new LocaleValue("金额"); SettingField settingAmount = PivotReportSettingInfo.CreateDataSettingField(fieldData, 0, GroupSumType.Sum, "N3"); //N3表示3位小数 this.SettingInfo.AggregateFields.Add(settingAmount); this.SettingInfo.SelectedFields.Add(settingAmount); }
protected override void ConstructFields() { TableName = "TBL_TESTPERSON"; StoreFlag = StoreFlag.LoadAndStore; m_fldName = new StringField() { Owner = this, FieldName = "PERSON_NAME", Required = true, Size = 50 }; m_fldSex = new StringField() { Owner = this, FieldName = "SEX", Required = true, Size = 1, DataEntryType = DataEntryType.DirectEntryOrLookupWithValidation, LookupType = LookupType.Dictionary }; m_fldSex.LookupDictionary.AddRange(new string[] { "M,Male", "F,Female", "U,Unspecified" }); m_fldRating = new IntField() { Owner = this, FieldName = "RATING", MinMaxChecking = true, MinValue = 0, MaxValue = 10 }; m_fldRegistered = new BoolField() { Owner = this, FieldName = "IS_REGISTERED", Required = true }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB" }; m_fldSalary = new DecimalField() { Owner = this, FieldName = "PAYROLL_VOLUME", MinMaxChecking = true, MinValue = 0M, MaxValue = Decimal.MaxValue }; //calculated field returns salary * 10 years m_fldDecadeSalary = new DecimalField() { Owner = this, FieldName = "DECADE_SALARY", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None, Calculated = true, Formula = "850-10 +(::PAYROLL_VOLUME * 10)" }; m_fldScore = new DoubleField() { Owner = this, FieldName = "SCORE" }; m_fldMovieNames = new ListField <string>() { Owner = this, FieldName = "MOVIES", Required = true }; //ths is business logic-driven computed column for GUI m_fldBusinessCode = new StringField() { Owner = this, FieldName = "BUSINESS_CODE", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None }; }
/// <summary> /// Constructor. /// </summary> internal DecimalFieldHelper(DecimalField fieldEntity) { _field = fieldEntity; }
protected override void ConstructFields() { TableName = "TBL_TESTPERSON"; StoreFlag = StoreFlag.LoadAndStore; m_fldName = new StringField() { Owner = this, FieldName = "PERSON_NAME", Required = true, Size = 50 }; m_fldSex = new StringField() { Owner = this, FieldName = "SEX", Required = true, Size = 1, DataEntryType = DataEntryType.DirectEntryOrLookupWithValidation, LookupType = LookupType.Dictionary }; m_fldSex.LookupDictionary.AddRange(new string[]{"M,Male", "F,Female", "U,Unspecified"}); m_fldRating = new IntField() { Owner = this, FieldName = "RATING", MinMaxChecking = true, MinValue = 0, MaxValue = 10 }; m_fldRegistered = new BoolField() { Owner = this, FieldName = "IS_REGISTERED", Required = true }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB" }; m_fldSalary = new DecimalField() { Owner = this, FieldName = "PAYROLL_VOLUME", MinMaxChecking = true, MinValue = 0M, MaxValue = Decimal.MaxValue }; //calculated field returns salary * 10 years m_fldDecadeSalary = new DecimalField() { Owner = this, FieldName = "DECADE_SALARY", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None, Calculated = true, Formula = "850-10 +(::PAYROLL_VOLUME * 10)" }; m_fldScore = new DoubleField() { Owner = this, FieldName = "SCORE" }; m_fldMovieNames = new ListField<string>() { Owner = this, FieldName = "MOVIES", Required = true }; //ths is business logic-driven computed column for GUI m_fldBusinessCode = new StringField() { Owner = this, FieldName = "BUSINESS_CODE", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None }; }
public void FromApp(QuickFix.Message msg, SessionID sessionID) { logMe("\r\n \r\n" + "FromApp :" + msg.ToString()); try { if (msg is QuickFix.FIX42.OrderCancelReject) { Console.WriteLine("Order Cancel Reject event raised"); QuickFix.FIX42.OrderCancelReject er = (QuickFix.FIX42.OrderCancelReject)msg; if (er.IsSetClOrdID()) { Console.WriteLine("ClOrdID : " + er.ClOrdID); } if (er.IsSetOrigClOrdID()) { Console.WriteLine("OrigClOrdID : " + er.OrigClOrdID); } if (er.IsSetOrdStatus()) { Console.WriteLine("OrderStatus : " + er.OrdStatus); } if (er.IsSetCxlRejResponseTo()) { Console.WriteLine("CxlRejResponseTo : " + er.CxlRejResponseTo); } if (er.IsSetCxlRejReason()) { Console.WriteLine("CxlRejReason : " + er.CxlRejReason); } if (er.IsSetOrderID()) { Console.WriteLine("OrderID : " + er.OrderID); } if (er.CxlRejResponseTo.getValue() == CxlRejResponseTo.ORDER_CANCEL_REQUEST) { // Order Cancel Rejected reason // 1= UNKNOWN_ORDER, 2 = Broker Option, 3 = Order already in Pending Cancel or Pending Replace status string orderDetails = "CANCEL_REJECTED"; Int32 origOrderID = -1; if (er.IsSetOrigClOrdID()) { origOrderID = Convert.ToInt32(er.OrigClOrdID.getValue()); } Orders o = new Orders(); if (er.IsSetEncodedText()) { orderDetails += " : " + er.EncodedText.getValue(); } o.FIXResponseCanModRejectHandler(Convert.ToInt32(er.ClOrdID.getValue()), er.OrderID.getValue(), origOrderID, er.CxlRejResponseTo.getValue(), "CANCEL_" + getRejectType(er.CxlRejReason), orderDetails); } else if (er.CxlRejResponseTo.getValue() == CxlRejResponseTo.ORDER_CANCEL_REPLACE_REQUEST) { // Order modification Rejected reason // 1 = Broker Option // 3 = Order already in Pending Cancel or Pending Replace status string orderDetails = "MODIFY_REJECTED"; Int32 origOrderID = -1; if (er.IsSetOrigClOrdID()) { origOrderID = Convert.ToInt32(er.OrigClOrdID.getValue()); } Orders o = new Orders(); if (er.IsSetEncodedText()) { orderDetails += " : " + er.EncodedText.getValue(); } o.FIXResponseCanModRejectHandler(Convert.ToInt32(er.ClOrdID.getValue()), er.OrderID.getValue(), origOrderID, er.CxlRejResponseTo.getValue(), "MODIFY_" + getRejectType(er.CxlRejReason), orderDetails); } } else if (msg is QuickFix.FIX42.ExecutionReport) { string ordTypeField = msg.GetField(40); if (ordTypeField == "1") { IField field = new DecimalField(44, 0); msg.SetField(field); } QuickFix.FIX42.ExecutionReport er = (QuickFix.FIX42.ExecutionReport)msg; string orderDetails = Convert.ToString(er.ExecType.getValue()) + "|" + er.OrderQty.getValue() + "|" + er.Price.getValue() + "|" + er.LastShares.getValue() + "|" + er.LastPx.getValue() + "|" + er.CumQty.getValue() + "|" + er.AvgPx.getValue() + "|" + er.OrdType.getValue() + "|"; if (er.IsSetText()) { orderDetails = orderDetails + er.Text + "|"; } else { orderDetails = orderDetails + "NULL|"; } logMe("\r\n \r\n" + "Got execution Report - ExecType = " + orderDetails); Console.WriteLine("\r\n \r\n" + "Got execution Report - ExecType = " + orderDetails); Orders o = new Orders(); if (er.ExecType.getValue() == ExecType.FILL || er.ExecType.getValue() == ExecType.PARTIAL_FILL) { o.FIXResponseHandlerForFill(Convert.ToInt32(er.ClOrdID.getValue()), er.OrderID.getValue(), (float)Convert.ToDouble(er.OrderQty.getValue()), (float)Convert.ToDouble(er.LastPx.getValue()), (float)Convert.ToDouble(er.LastShares.getValue()), getExecType(er.ExecType), er.ExecType.getValue()); } else { Int32 origOrderID = -1; float price = -1; char orderType = '2'; if (er.IsSetOrigClOrdID()) { origOrderID = Convert.ToInt32(er.OrigClOrdID.getValue()); } if (er.IsSetPrice()) { price = (float)Convert.ToDouble(er.Price.getValue()); } if (er.IsSetOrdType()) { orderType = er.OrdType.getValue(); } //orderid is string since value is too large for int variable o.FIXResponseHandler(Convert.ToInt32(er.ClOrdID.getValue()), er.OrderID.getValue(), origOrderID, er.ExecType.getValue(), getExecType(er.ExecType), orderDetails, price, orderType); } } } catch (Exception e) { Console.WriteLine("exception(FixClient FromAPP) " + e.Message); } }
public static IFieldHelper ConvertToFieldHelper(IEntity fieldEntity) { if (fieldEntity == null) { throw new ArgumentNullException("fieldEntity"); } // Ensure we have the specific type of field in question. IEntity field = Entity.AsNative(fieldEntity); if (field == null) { throw new Exception("Assert false"); } StringField stringField = field as StringField; if (stringField != null) { return(new StringFieldHelper(stringField)); } AliasField aliasField = field as AliasField; if (aliasField != null) { return(new AliasFieldHelper(aliasField)); } AutoNumberField autoNumberField = field as AutoNumberField; if (autoNumberField != null) { return(new AutoNumberFieldHelper(autoNumberField)); } BoolField boolField = field as BoolField; if (boolField != null) { return(new BoolFieldHelper(boolField)); } CurrencyField currencyField = field as CurrencyField; if (currencyField != null) { return(new CurrencyFieldHelper(currencyField)); } DateField dateField = field as DateField; if (dateField != null) { return(new DateFieldHelper(dateField)); } DateTimeField dateTimeField = field as DateTimeField; if (dateTimeField != null) { return(new DateTimeFieldHelper(dateTimeField)); } DecimalField decimalField = field as DecimalField; if (decimalField != null) { return(new DecimalFieldHelper(decimalField)); } IntField intField = field as IntField; if (intField != null) { return(new IntFieldHelper(intField)); } TimeField timeField = field as TimeField; if (timeField != null) { return(new TimeFieldHelper(timeField)); } GuidField guidField = field as GuidField; if (guidField != null) { return(new GuidFieldHelper(guidField)); } XmlField xmlField = field as XmlField; if (xmlField != null) { return(new XmlFieldHelper(xmlField)); } throw new Exception("Entity is not a valid field type: " + field.GetType().ToString()); }
public void DefaultFieldTest() { DecimalField field = new DecimalField(200, new Decimal(101.0001)); fieldmap.SetField(field); string refield = fieldmap.GetField(200); Assert.That("101.0001", Is.EqualTo(refield)); }
internal static BaseField CreateField(FieldType type) { BaseField field = null; switch (type) { case FieldType.ObjectKey: field = new ObjectKeyField(); break; case FieldType.BigInt: field = new BigIntField(); break; case FieldType.Bool: field = new BoolField(); break; case FieldType.Date: field = new DateField(); break; case FieldType.DateTime: field = new DateTimeField(); break; case FieldType.Decimal: field = new DecimalField(); break; case FieldType.Image: field = new ImageField(); break; case FieldType.Integer: field = new IntegerField(); break; case FieldType.LongText: field = new LongTextField(); break; case FieldType.Password: field = new PasswordField(); break; case FieldType.MonataryAmount: field = new DecimalField(); break; case FieldType.Html: field = new HtmlField(); break; case FieldType.Xml: field = new XmlField(); break; case FieldType.Json: field = new JsonField(); break; case FieldType.Email: field = new EmailField(); break; case FieldType.Phone: field = new PhoneField(); break; case FieldType.ObjectLink: field = new ObjectLinkField(); break; case FieldType.MultiObjectLink: field = new MultiObjectLinkField(); break; case FieldType.Select: field = new SelectField(); break; case FieldType.MultiSelect: field = new MultiSelectField(); break; case FieldType.FilterField: field = new FilterField(); break; case FieldType.OneToMany: field = new OneToManyField(); break; default: field = new StringField(); break; } return(field); }
protected override void ConstructFields() { TableName = "TBL_PATIENT"; m_fldID = new StringField() { Owner = this, FieldName = "PATIENT_ID", Description = "ID", Size = 12, Required = true, KeyField = true }; m_fldFirstName = new StringField() { Owner = this, FieldName = "FIRST_NAME", Description = "First Name", Size = 50, Required = true }; m_fldLastName = new StringField() { Owner = this, FieldName = "LAST_NAME", Description = "Last Name", Size = 50, Required = true }; m_fldContactPhone = new StringField() { Owner = this, FieldName = "PHONE_CONTACT", Description = "Contact Phone#", DataEntryFormat = DataEntryFormat.Phone, Size = 25 }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB", Description = "Date of Birth", Required = true }; m_fldAdmissionDate = new DateTimeField() { Owner = this, FieldName = "ADM_DATE", Description = "Admission Date" }; m_fldMonthlyCost = new DecimalField() { Owner = this, FieldName = "MONTHLY_COST", Description = "Monthly Cost", MinValue = 0, DisplayFormat = "C" }; m_fldClassification = new StringField() { Owner = this, FieldName = "ATTITUDE_CLASSIFICATION", Description = "Classification", Required = true, Size = 3, LookupType = LookupType.Dictionary, DataEntryType = DataEntryType.Lookup, HasDefaultValue = true, DefaultValue = "BUD" }; m_fldClassification.LookupDictionary.Add("MRX, Marxist", "CAP, Capitalist", "NEH, Nehilist", "BUD, Buddhist"); m_fldReligious = new BoolField() { Owner = this, FieldName = "IS_RELIGIOUS", Description = "Religious", Required = true, DefaultValue = false, HasDefaultValue = true }; }