Exemplo n.º 1
0
        public string SendEquityData(Equity obj)
        {
            PropertyInfo[] properties = obj.GetType().GetProperties();

            if (obj == null)
                return "False";
            else
            {
                DataTable tempTable = new DataTable();
                List<string> columnList = DataAccessLayer.DAL.GetColumnNames("Equity", true);
                for (int i = 0; i < columnList.Count && columnList[i] != ""; i++)
                {
                    DataColumn dc = new DataColumn(columnList[i], typeof(string));
                    tempTable.Columns.Add(dc);
                }

                DataRow dr = tempTable.NewRow();
                foreach (PropertyInfo p in properties)
                {
                    dr[p.Name] = p.GetValue(obj, null).ToString();
                }
                tempTable.Rows.Add(dr);

                return DataAccessLayer.DAL.SendDataToDB(tempTable, "Equity").ToString();
            }
        }
        public string SendEquityData(Equity obj)
        {
            if (obj == null)
                return "False";
            else
            {
                DataTable tempTable = new DataTable();
                List<string> columnList = DataAccessLayer.DAL.GetColumnNames("Equity");
                for (int i = 0; i < columnList.Count && columnList[i]!=""; i++)
                {
                    DataColumn dc = new DataColumn(columnList[i], typeof(string));
                    tempTable.Columns.Add(dc);
                }

                tempTable.Rows.Add(new Object[] { obj.securityName, obj.securityDescription, obj.hasPosition, obj.isActive, 
                    obj.roundLotSize,obj.bloombergUniqueName,obj.cusip,obj.isin,
                    obj.sedol,obj.bloombergTicker,obj.bloombergUniqueID,obj.bloombergGlobalID,
                    obj.bloombergTickerAndExchange,obj.IsAdr,obj.adrUnderlyingTicker,obj.adrUnderlyingCurrency,
                    obj.sharesPerADR,obj.ipoDate,obj.priceCurrency,obj.settleDays,
                    obj.sharesOutstanding,obj.votingRightsPerShare,obj.TwentyDayAvgVolume,obj.Beta,
                    obj.shortInterest,obj.ytdReturn,obj.priceVolatility,obj.formPFAssetClass,
                    obj.formPFCountry,obj.formPFCreditRating,obj.formPFCurrency,obj.formPFInstrument,
                    obj.formPFLiquidityProfile,obj.formPFMaturity,obj.formPFNAICSCode,obj.formPFRegion,
                    obj.formPFSector,obj.formPFSubAssetClass,obj.issueCountry,obj.exchange,
                    obj.issuer,obj.issueCurrency,obj.tradingCurrency,obj.bloombergIndustrySubGroup,
                    obj.bloombergIndustryGroup,obj.bloombergIndustrySector,obj.countryOfIncorporation,obj.riskCurrency,
                    obj.openPrice,obj.closePrice,obj.volume,obj.lastPrice,
                    obj.askPrice,obj.bidPrice,obj.peRatio,obj.declaredDate,
                    obj.exDate,obj.recordDate,obj.payDate,obj.amount,
                    obj.frequency,obj.dividendType });

                Console.WriteLine(tempTable.Columns.Count);

                DataAccessLayer.DAL.SendDataToDB(tempTable, "Equity");
                return "True";
            }
        }