Esempio n. 1
0
 /// <summary>
 /// DataItem constructor.
 /// </summary>
 /// <param name="name">Parameter name.</param>
 /// <param name="type">Parameter tyoe.</param>
 /// <param name="defaultValue">Parameter's default value (optional; will be used if value is not specified).</param>
 /// <param name="isRequired">"true" if parameter must be set, otherwise "false".</param>
 /// <param name="extraData">Some extra data.</param>
 public DataItem(string name, DataItemType type, object defaultValue, bool isRequired = true, object extraData = null)
 {
     Name = name;
     Type = type;
     DefaultValue = defaultValue;
     ExtraData = extraData;
     IsRequired = isRequired;
 }
Esempio n. 2
0
        }                                                   //是否為有號數

        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessDataType"/> class.
        /// </summary>
        /// <param name="itemType">Type of the item.</param>
        /// <param name="name">The name.</param>
        /// <param name="wordCound">The word cound.</param>
        /// <param name="multiplier">The multiplier.</param>
        /// <param name="isContainSign">if set to <c>true</c> [is contain sign].</param>
        public ProcessDataType(DataItemType itemType, string name, int wordCound,
                               double multiplier, bool isContainSign)
        {
            this.ItemType      = itemType;
            this.Name          = name;
            this.WordCount     = wordCound;
            this.Multiplier    = multiplier;
            this.IsContainSign = isContainSign;
        }
Esempio n. 3
0
        public DataItemType getScoreObjStr(DataItemTypeName dtItemName, string value)
        {
            DataItemType itemType = new DataItemType();

            itemType.name = dtItemName;
            VCScoring.String str = new VCScoring.String();
            str.Val       = value;
            itemType.Item = str;
            return(itemType);
        }
Esempio n. 4
0
        public DataItemType getScoreObjFloat(DataItemTypeName dtItemName, double value)
        {
            DataItemType itemType = new DataItemType();

            itemType.name = dtItemName;
            VCScoring.Float str = new VCScoring.Float();
            str.Val          = value;
            itemType.Item    = str;
            str.ValSpecified = true;
            return(itemType);
        }
Esempio n. 5
0
        public DataItemType getScoreObjInt(DataItemTypeName dtItemName, long value)
        {
            DataItemType itemType = new DataItemType();

            itemType.name = dtItemName;
            VCScoring.Int str = new VCScoring.Int();
            str.Val          = value;
            str.ValSpecified = true;
            itemType.Item    = str;
            return(itemType);
        }
Esempio n. 6
0
        public DataItemType getScoreObjDate(DataItemTypeName dtItemName, System.DateTime value)
        {
            DataItemType itemType = new DataItemType();

            itemType.name = dtItemName;
            VCScoring.DateTime str = new VCScoring.DateTime();
            str.Val          = value;
            itemType.Item    = str;
            str.ValSpecified = true;
            return(itemType);
        }
        /// <summary>
        /// Throws a <see cref="System.NotSupportedException"/>.
        /// </summary>
        protected virtual void OnSet(int index, object oldValue, object newValue)
        {
            DataItem newItem = newValue as DataItem;

            if (newItem == null || !DataItemType.IsInstanceOfType(newItem) || newItem.ParentCollection != this)
            {
                throw new InvalidOperationException("Only items already belonging to the collection can be set to new indexes");
            }

            // Remove the new item from it's old position and put it in the new one
            if (newItem.Row.RowState != DataRowState.Deleted && newItem.Row.RowState != DataRowState.Detached)
            {
                this.Remove(newItem);
            }

            this.Insert(index, newItem);
        }
Esempio n. 8
0
        private ICollection <object> ParsePayload(TubularGridDataResponse response)
        {
            var result = new List <object>();
            var props  = DataItemType.PropertyProxies().Values.Where(t => t.IsFlatType);

            foreach (var itemData in response.Payload)
            {
                var valueIndex = 0;
                var targetItem = Activator.CreateInstance(DataItemType);

                foreach (var targetProperty in props)
                {
                    var v            = itemData[valueIndex++];
                    var nullableType = Nullable.GetUnderlyingType(targetProperty.PropertyType);
                    var isNullable   = nullableType != null;

                    try
                    {
                        if (v is JsonElement element)
                        {
                            v = ParseValue(element, targetProperty.PropertyType);
                        }
                        else if (v != null && v.GetType() != (isNullable ? nullableType : targetProperty.PropertyType))
                        {
                            v = Convert.ChangeType(v?.ToString(), isNullable ? nullableType : targetProperty.PropertyType);
                        }

                        targetProperty.SetValue(targetItem, v);
                    }
                    catch
                    {
                        // ignore
                    }
                }

                result.Add(targetItem);
            }

            return(result);
        }
Esempio n. 9
0
        private object ParseAggregateItem(TubularGridDataResponse response)
        {
            var payload = response.AggregationPayload;

            if (payload == null || payload.Count <= 0)
            {
                return(null);
            }

            var result  = Activator.CreateInstance(DataItemType);
            var proxies = DataItemType.PropertyProxies();

            foreach (var kvp in payload)
            {
                if (kvp.Value is not JsonElement value)
                {
                    continue;
                }

                var property = proxies.ContainsKey(kvp.Key) ? proxies[kvp.Key] : null;
                if (property == null)
                {
                    continue;
                }

                try
                {
                    property.SetValue(result, ParseValue(value, property.PropertyType));
                }
                catch
                {
                    // ignore
                }
            }

            return(result);
        }
Esempio n. 10
0
        protected abstract void ReadDataItem(TargetMemoryAccess memory, DataItemType type,
						      TargetReader reader);
Esempio n. 11
0
            protected override void ReadDataItem(TargetMemoryAccess memory,
							      DataItemType type, TargetReader reader)
            {
                if (type != DataItemType.DelegateInvoke)
                    throw new InternalError (
                        "Got unknown data item: {0}", type);

                TargetAddress code = reader.ReadAddress ();
                int size = reader.BinaryReader.ReadInt32 ();
                Report.Debug (DebugFlags.JitSymtab, "READ DELEGATE IMPL: {0} {1}",
                          code, size);
                delegate_impl_list.Add (new DelegateInvokeEntry (code, size));
            }
Esempio n. 12
0
 /// <summary>
 /// DataItem constructor.
 /// </summary>
 /// <param name="name">Parameter name.</param>
 /// <param name="type">Parameter tyoe.</param>
 /// <param name="isRequired">"true" if parameter must be set, otherwise "false".</param>
 public DataItem(string name, DataItemType type, bool isRequired = true)
     : this(name, type, null, true, null)
 {
 }
Esempio n. 13
0
            protected override void ReadDataItem(TargetMemoryAccess memory,
							      DataItemType type, TargetReader reader)
            {
                if (type != DataItemType.Class)
                    throw new InternalError (
                        "Got unknown data item: {0}", type);

                reader.BinaryReader.ReadInt32 ();

                int token = reader.BinaryReader.ReadLeb128 ();
                reader.BinaryReader.ReadLeb128 (); /* instance_size */
                TargetAddress klass_address = reader.ReadAddress ();

                SymbolFile.AddClassEntry (token, klass_address);
            }
Esempio n. 14
0
        private DataItemType[] GenerateItemTypes()
        {
            DataItemType[] itemTypes = new DataItemType[51];

            itemTypes[0] = getScoreObjStr(DataItemTypeName.Application_Number, "APPTestbINH");
            itemTypes[1] = getScoreObjFloat(DataItemTypeName.Request_Limit, 1000000000.0);
            itemTypes[2] = getScoreObjStr(DataItemTypeName.Application_ID, "APPTestbINH");
            itemTypes[3] = getScoreObjStr(DataItemTypeName.Product, "101");
            itemTypes[4] = getScoreObjStr(DataItemTypeName.Credit_Card_Type, "THẺ TIỀN MẶT VIETCREDIT");
            itemTypes[5] = getScoreObjStr(DataItemTypeName.Promo_Code, "RET");
            itemTypes[6] = getScoreObjStr(DataItemTypeName.Age, "27");
            itemTypes[7] = getScoreObjStr(DataItemTypeName.Resident_Type, "LEASEHOLD");
            itemTypes[8] = getScoreObjStr(DataItemTypeName.Marital_Status, "Married");
            itemTypes[9] = getScoreObjStr(DataItemTypeName.Address_Type, "ResidentialAddress");

            itemTypes[10] = getScoreObjStr(DataItemTypeName.State, "VN");
            itemTypes[11] = getScoreObjStr(DataItemTypeName.City, "HCMI");
            itemTypes[12] = getScoreObjInt(DataItemTypeName.Number_of_Dependents, 1);
            itemTypes[13] = getScoreObjInt(DataItemTypeName.Number_of_Children, 2);
            itemTypes[14] = getScoreObjStr(DataItemTypeName.Occupation_Type, "Salaried");
            itemTypes[15] = getScoreObjStr(DataItemTypeName.Industry, "Others");
            itemTypes[16] = getScoreObjStr(DataItemTypeName.Nature_of_Business, "GRADUATION");
            itemTypes[17] = getScoreObjStr(DataItemTypeName.SubIndustry, "");
            itemTypes[18] = getScoreObjStr(DataItemTypeName.Company_Type, "Aut Body");
            itemTypes[19] = getScoreObjStr(DataItemTypeName.Employment_type, "Bằng hoặc lớn hơn 1 năm - Equal or more than 1 year");

            itemTypes[20] = getScoreObjStr(DataItemTypeName.Employment_Status, "Trưởng phòng/manager/deputy manager");
            itemTypes[21] = getScoreObjDate(DataItemTypeName.Employment_From, System.DateTime.Now);
            itemTypes[22] = getScoreObjFloat(DataItemTypeName.Years_In_Job, 0.7);
            itemTypes[23] = getScoreObjStr(DataItemTypeName.Employment_Location, "");
            itemTypes[24] = getScoreObjFloat(DataItemTypeName.Gross_Monthly_Income, 3000000);
            itemTypes[25] = getScoreObjStr(DataItemTypeName.Missing_Information, "");
            itemTypes[26] = getScoreObjStr(DataItemTypeName.Employer_Status, "Hoạt động - Working");
            itemTypes[27] = getScoreObjStr(DataItemTypeName.Employer_Establish_Day, "10");
            itemTypes[28] = getScoreObjFloat(DataItemTypeName.Annual_Net_Income, 180000000);
            itemTypes[29] = getScoreObjFloat(DataItemTypeName.Annual_Gross_Income, 150000000);

            itemTypes[30] = getScoreObjFloat(DataItemTypeName.Income_From_Other_Sources, 27000000);
            itemTypes[31] = getScoreObjFloat(DataItemTypeName.Card_Limit, 20000000);
            itemTypes[32] = getScoreObjStr(DataItemTypeName.Card_Expiry, "");
            itemTypes[33] = getScoreObjStr(DataItemTypeName.PCB_Response_XML, "");
            itemTypes[34] = getScoreObjInt(DataItemTypeName.Maximum_Worststatus, 1);
            itemTypes[35] = getScoreObjStr(DataItemTypeName.Result, "");
            itemTypes[36] = getScoreObjInt(DataItemTypeName.No_of_Contract, 0);
            itemTypes[37] = getScoreObjStr(DataItemTypeName.Results_2, "");
            itemTypes[38] = getScoreObjFloat(DataItemTypeName.Amount_of_Unpaid_Due_Installments, 0);
            itemTypes[39] = getScoreObjFloat(DataItemTypeName.Overdue_Not_Paid_Amount, 0);

            itemTypes[40] = getScoreObjFloat(DataItemTypeName.Total_Current_Overdue_Amount, 0);
            itemTypes[41] = getScoreObjStr(DataItemTypeName.Results_3, "");
            itemTypes[42] = getScoreObjFloat(DataItemTypeName.Number_of_Bank_Relationship, 0);
            itemTypes[43] = getScoreObjFloat(DataItemTypeName.No_of_Installment_Loans, 0);
            itemTypes[44] = getScoreObjFloat(DataItemTypeName.Total_Outstanding_Balances, 0);
            itemTypes[45] = getScoreObjFloat(DataItemTypeName.No_of_Credit_Cards, 0);
            itemTypes[46] = getScoreObjFloat(DataItemTypeName.Total_Credit_Limit, 0);
            itemTypes[47] = getScoreObjFloat(DataItemTypeName.Total_Oustanding_Balance_1, 0);
            itemTypes[48] = getScoreObjFloat(DataItemTypeName.No_Overdraft, 0);
            itemTypes[49] = getScoreObjFloat(DataItemTypeName.Total_Credit_Limit_1, 0);

            itemTypes[50] = getScoreObjFloat(DataItemTypeName.Total_Monthly_Payment_Excluding_Overdraft, 0);

            return(itemTypes);
        }
Esempio n. 15
0
            protected override void ReadDataItem(TargetMemoryAccess memory,
							      DataItemType type, TargetReader reader)
            {
                if (type != DataItemType.Method)
                    throw new InternalError (
                        "Got unknown data item: {0}", type);

                int size = reader.BinaryReader.PeekInt32 ();
                byte[] contents = reader.BinaryReader.PeekBuffer (size);
                reader.BinaryReader.ReadInt32 ();
                int file_idx = reader.BinaryReader.ReadInt32 ();
                Report.Debug (DebugFlags.JitSymtab, "READ RANGE ITEM: {0} {1}",
                          size, file_idx);
                MonoSymbolFile file = Mono.GetSymbolFile (file_idx);
                if (file != null)
                    file.AddRangeEntry (memory, reader, contents);
            }
Esempio n. 16
0
        // GET api/values
        public void Get()
        {
            //Call Scoring
            HeaderType hd = new HeaderType();

            hd.ClientTimeZoneID = "Asia/Ho_Chi_Minh";
            hd.Identity         = "91";
            string             eventName = "CFCScoring";
            EventService       evt       = new EventService();
            HeaderResponseType hdResp;

            DataItemResponseType resptt = new DataItemResponseType();


            DataItemResponseType[] respType = new DataItemResponseType[8];
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

            //Declare data item
            DataItemType[] itemTypes = new DataItemType[51];
            itemTypes[0] = getScoreObjStr(DataItemTypeName.Application_Number, "APPTestbINH");
            itemTypes[1] = getScoreObjFloat(DataItemTypeName.Request_Limit, 1000000000.0);
            itemTypes[2] = getScoreObjStr(DataItemTypeName.Application_ID, "APPTestbINH");
            itemTypes[3] = getScoreObjStr(DataItemTypeName.Product, "101");
            itemTypes[4] = getScoreObjStr(DataItemTypeName.Credit_Card_Type, "THẺ TIỀN MẶT VIETCREDIT");
            itemTypes[5] = getScoreObjStr(DataItemTypeName.Promo_Code, "RET");
            itemTypes[6] = getScoreObjStr(DataItemTypeName.Age, "27");
            itemTypes[7] = getScoreObjStr(DataItemTypeName.Resident_Type, "LEASEHOLD");
            itemTypes[8] = getScoreObjStr(DataItemTypeName.Marital_Status, "Married");
            itemTypes[9] = getScoreObjStr(DataItemTypeName.Address_Type, "ResidentialAddress");

            itemTypes[10] = getScoreObjStr(DataItemTypeName.State, "VN");
            itemTypes[11] = getScoreObjStr(DataItemTypeName.City, "HCMI");
            itemTypes[12] = getScoreObjInt(DataItemTypeName.Number_of_Dependents, 1);
            itemTypes[13] = getScoreObjInt(DataItemTypeName.Number_of_Children, 2);
            itemTypes[14] = getScoreObjStr(DataItemTypeName.Occupation_Type, "Salaried");
            itemTypes[15] = getScoreObjStr(DataItemTypeName.Industry, "Others");
            itemTypes[16] = getScoreObjStr(DataItemTypeName.Nature_of_Business, "GRADUATION");
            itemTypes[17] = getScoreObjStr(DataItemTypeName.SubIndustry, "");
            itemTypes[18] = getScoreObjStr(DataItemTypeName.Company_Type, "Aut Body");
            itemTypes[19] = getScoreObjStr(DataItemTypeName.Employment_type, "Bằng hoặc lớn hơn 1 năm - Equal or more than 1 year");

            itemTypes[20] = getScoreObjStr(DataItemTypeName.Employment_Status, "Trưởng phòng/manager/deputy manager");
            itemTypes[21] = getScoreObjDate(DataItemTypeName.Employment_From, System.DateTime.Now);
            itemTypes[22] = getScoreObjFloat(DataItemTypeName.Years_In_Job, 0.7);
            itemTypes[23] = getScoreObjStr(DataItemTypeName.Employment_Location, "");
            itemTypes[24] = getScoreObjFloat(DataItemTypeName.Gross_Monthly_Income, 3000000);
            itemTypes[25] = getScoreObjStr(DataItemTypeName.Missing_Information, "");
            itemTypes[26] = getScoreObjStr(DataItemTypeName.Employer_Status, "Hoạt động - Working");
            itemTypes[27] = getScoreObjStr(DataItemTypeName.Employer_Establish_Day, "10");
            itemTypes[28] = getScoreObjFloat(DataItemTypeName.Annual_Net_Income, 180000000);
            itemTypes[29] = getScoreObjFloat(DataItemTypeName.Annual_Gross_Income, 150000000);

            itemTypes[30] = getScoreObjFloat(DataItemTypeName.Income_From_Other_Sources, 27000000);
            itemTypes[31] = getScoreObjFloat(DataItemTypeName.Card_Limit, 20000000);
            itemTypes[32] = getScoreObjStr(DataItemTypeName.Card_Expiry, "");
            itemTypes[33] = getScoreObjStr(DataItemTypeName.PCB_Response_XML, "");
            itemTypes[34] = getScoreObjInt(DataItemTypeName.Maximum_Worststatus, 1);
            itemTypes[35] = getScoreObjStr(DataItemTypeName.Result, "");
            itemTypes[36] = getScoreObjInt(DataItemTypeName.No_of_Contract, 0);
            itemTypes[37] = getScoreObjStr(DataItemTypeName.Results_2, "");
            itemTypes[38] = getScoreObjFloat(DataItemTypeName.Amount_of_Unpaid_Due_Installments, 0);
            itemTypes[39] = getScoreObjFloat(DataItemTypeName.Overdue_Not_Paid_Amount, 0);

            itemTypes[40] = getScoreObjFloat(DataItemTypeName.Total_Current_Overdue_Amount, 0);
            itemTypes[41] = getScoreObjStr(DataItemTypeName.Results_3, "");
            itemTypes[42] = getScoreObjFloat(DataItemTypeName.Number_of_Bank_Relationship, 0);
            itemTypes[43] = getScoreObjFloat(DataItemTypeName.No_of_Installment_Loans, 0);
            itemTypes[44] = getScoreObjFloat(DataItemTypeName.Total_Outstanding_Balances, 0);
            itemTypes[45] = getScoreObjFloat(DataItemTypeName.No_of_Credit_Cards, 0);
            itemTypes[46] = getScoreObjFloat(DataItemTypeName.Total_Credit_Limit, 0);
            itemTypes[47] = getScoreObjFloat(DataItemTypeName.Total_Oustanding_Balance_1, 0);
            itemTypes[48] = getScoreObjFloat(DataItemTypeName.No_Overdraft, 0);
            itemTypes[49] = getScoreObjFloat(DataItemTypeName.Total_Credit_Limit_1, 0);

            itemTypes[50] = getScoreObjFloat(DataItemTypeName.Total_Monthly_Payment_Excluding_Overdraft, 0);
            var stringwriter  = new StringWriter();
            var xmlSerializer = new XmlSerializer(itemTypes.GetType());

            xmlSerializer.Serialize(stringwriter, itemTypes);
            var xml = stringwriter.ToString();

            hdResp = evt.Event(hd, itemTypes, ref eventName, out respType);
        }
Esempio n. 17
0
 public DataItem(DataItemCategory category, DataItemType dataItemType, string name, string id)
     : this(category, dataItemType.ToString(), name, id)
 {
 }