Пример #1
0
        public static Hashtable SelectELWFM1(string rics)
        {
            string    condition = string.Format("where FM = '1' and RIC in ({0})", rics);
            DataTable dt        = Select(ETI_KOREA_ELW_TABLE_NAME, new string[] { "*" }, condition);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }

            Hashtable fmOne = new Hashtable();

            foreach (DataRow dr in dt.Rows)
            {
                WarrantTemplate elw = new WarrantTemplate();
                elw.RIC            = Convert.ToString(dr["RIC"]);
                elw.IDNDisplayName = Convert.ToString(dr["IDNDisplayName"]);
                elw.ISIN           = Convert.ToString(dr["ISIN"]);
                elw.Ticker         = Convert.ToString(dr["Ticker"]);
                elw.BCASTREF       = Convert.ToString(dr["BCAST_REF"]);
                elw.QACommonName   = Convert.ToString(dr["QACommonName"]);
                if (!string.IsNullOrEmpty(Convert.ToString(dr["MatDate"])))
                {
                    elw.MatDate = Convert.ToDateTime(dr["MatDate"]).ToString("yyyy-MMM-dd", new CultureInfo("en-US"));
                }
                elw.StrikePrice       = Convert.ToString(dr["StrikePrice"]);
                elw.QuanityofWarrants = Convert.ToString(dr["QuantityOfWarrant"]);
                elw.IssuePrice        = Convert.ToString(dr["IssuePrice"]);
                if (!string.IsNullOrEmpty(Convert.ToString(dr["IssueDate"])))
                {
                    elw.IssueDate = Convert.ToDateTime(dr["IssueDate"]).ToString("yyyy-MMM-dd", new CultureInfo("en-US"));
                }
                elw.ConversionRatio  = Convert.ToString(dr["ConversionRatio"]);
                elw.Issuer           = Convert.ToString(dr["Issuer"]);
                elw.KoreaWarrantName = Convert.ToString(dr["KoreaWarrantName"]);
                elw.Chain            = Convert.ToString(dr["Chain"]);
                fmOne.Add(elw.RIC, elw);
            }
            return(fmOne);
        }
Пример #2
0
        public static int InsertELW(WarrantTemplate elw)
        {
            string    condition = string.Format("where RIC = '{0}' and FM = '1'", elw.RIC);
            DataTable dt        = Select(ETI_KOREA_ELW_TABLE_NAME, new string[] { "*" }, condition);

            if (dt == null)
            {
                return(0);
            }
            string effectiveDate = elw.EffectiveDate;

            if (elw.EffectiveDate.Length == 4)
            {
                effectiveDate += "-01-01";
            }

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(elw.UpdateDate))
                    {
                        dr["UpdateDate"] = elw.UpdateDate;
                    }
                    if (!string.IsNullOrEmpty(effectiveDate))
                    {
                        dr["EffectiveDate"] = effectiveDate;
                    }
                    dr["RIC"]            = elw.RIC;
                    dr["FM"]             = elw.FM;
                    dr["IDNDisplayName"] = elw.IDNDisplayName;
                    dr["ISIN"]           = elw.ISIN;
                    dr["Ticker"]         = elw.Ticker;
                    dr["BCAST_REF"]      = elw.BCASTREF;
                    dr["QACommonName"]   = elw.QACommonName;
                    if (!string.IsNullOrEmpty(elw.MatDate))
                    {
                        dr["MatDate"] = elw.MatDate;
                    }
                    dr["StrikePrice"]       = elw.StrikePrice;
                    dr["QuantityOfWarrant"] = elw.QuanityofWarrants;
                    dr["IssuePrice"]        = elw.IssuePrice;
                    if (!string.IsNullOrEmpty(elw.IssueDate))
                    {
                        dr["IssueDate"] = elw.IssueDate;
                    }
                    dr["ConversionRatio"]  = elw.ConversionRatio;
                    dr["Issuer"]           = elw.Issuer;
                    dr["KoreaWarrantName"] = elw.KoreaWarrantName;
                    dr["Chain"]            = elw.Chain;
                    if (!string.IsNullOrEmpty(elw.LastTradingDate))
                    {
                        dr["LastTradingDate"] = elw.LastTradingDate;
                    }
                    dr["EquityType"] = "ELW";
                }
            }
            else
            {
                DataRow dr = dt.NewRow();
                if (!string.IsNullOrEmpty(elw.UpdateDate))
                {
                    dr["UpdateDate"] = elw.UpdateDate;
                }
                if (!string.IsNullOrEmpty(effectiveDate))
                {
                    dr["EffectiveDate"] = effectiveDate;
                }
                dr["RIC"]            = elw.RIC;
                dr["FM"]             = elw.FM;
                dr["IDNDisplayName"] = elw.IDNDisplayName;
                dr["ISIN"]           = elw.ISIN;
                dr["Ticker"]         = elw.Ticker;
                dr["BCAST_REF"]      = elw.BCASTREF;
                dr["QACommonName"]   = elw.QACommonName;
                if (!string.IsNullOrEmpty(elw.MatDate))
                {
                    dr["MatDate"] = elw.MatDate;
                }
                dr["StrikePrice"]       = elw.StrikePrice;
                dr["QuantityOfWarrant"] = elw.QuanityofWarrants;
                dr["IssuePrice"]        = elw.IssuePrice;
                if (!string.IsNullOrEmpty(elw.IssueDate))
                {
                    dr["IssueDate"] = elw.IssueDate;
                }
                dr["ConversionRatio"]  = elw.ConversionRatio;
                dr["Issuer"]           = elw.Issuer;
                dr["KoreaWarrantName"] = elw.KoreaWarrantName;
                dr["Chain"]            = elw.Chain;
                if (!string.IsNullOrEmpty(elw.LastTradingDate))
                {
                    dr["LastTradingDate"] = elw.LastTradingDate;
                }
                dr["EquityType"] = "ELW";
                dt.Rows.Add(dr);
            }
            return(UpdateDbTable(dt, ETI_KOREA_ELW_TABLE_NAME));
        }