Beispiel #1
0
 /// <summary>
 /// 判斷 commpany 是否新增
 /// </summary>
 /// <param name="rating">評等內容</param>
 /// <param name="ratingDate">評等時間</param>
 /// <param name="bondNumber">債券編號</param>
 /// <param name="bloombergField">Bloomberg評等欄位名稱</param>
 /// <param name="org">評等機構</param>
 /// <param name="commpanyData">Commpany要新增的資料</param>
 private void validateCommpany(
     string rating,
     string ratingDate,
     string bondNumber,
     string bloombergField,
     RatingOrg org,
     List <Rating_Info> commpanyData
     )
 {
     rating = fr.forRating(rating);        //ForMate Rating
     if (!rating.IsNullOrWhiteSpace() &&
         !nullarr.Contains(rating.Trim())) //Commpany評等判斷
     {
         commpayInfo cInfo = new commpayInfo();
         if (info.TryGetValue(bondNumber.FormatEquity(), out cInfo))
         {
             cInfo.Bond_Number.ForEach(
                 x => commpanyData.Add(
                     saveCommpany(
                         rating,
                         ratingDate,
                         x,
                         bloombergField,
                         cInfo.Rating_Object,
                         org
                         ))
                 );
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 建立 Commpany 要Put檔案
        /// </summary>
        protected override void createCommpanyFile()
        {
            List <string> data = new List <string>();

            using (StreamReader sr = new StreamReader(Path.Combine(
                                                          setFile.getSampleFilePath(), setFile.getSampleFileName())))
            {
                bool   flag = false; //判斷是否為要讀取的資料行數
                string line = string.Empty;
                info = new Dictionary <string, commpayInfo>();
                while ((line = sr.ReadLine()) != null)
                {
                    if ("END-OF-DATA".Equals(line))
                    {
                        flag = false;
                    }
                    if (flag) //找到的資料
                    {
                        var arr = line.Split('|');
                        if (arr.Length >= 18)
                        {
                            if (!arr[3].IsNullOrWhiteSpace() &&
                                !nullarr.Contains(arr[3].Trim()))  //ISSUER_EQUITY_TICKER (發行人)
                            {
                                commpayInfo x = new commpayInfo();
                                if (!info.TryGetValue(arr[3].Trim(), out x))
                                {
                                    data.Add(arr[3].Trim());
                                    info.Add(arr[3].Trim(), new commpayInfo()
                                    {
                                        Bond_Number = new List <string>()
                                        {
                                            arr[0].Trim()
                                        },
                                        Rating_Object = RatingObject.ISSUER.GetDescription()
                                    });
                                }
                                else
                                {
                                    x.Bond_Number.Add(arr[0].Trim());
                                }
                            }
                            if (!arr[6].Trim().IsNullOrWhiteSpace() &&
                                !nullarr.Contains(arr[6].Trim()))  //GUARANTOR_EQY_TICKER (擔保人)
                            {
                                commpayInfo x = new commpayInfo();
                                if (!info.TryGetValue(arr[6].Trim(), out x))
                                {
                                    data.Add(arr[6].Trim());
                                    info.Add(arr[6].Trim(), new commpayInfo()
                                    {
                                        Bond_Number = new List <string>()
                                        {
                                            arr[0].Trim()
                                        },
                                        Rating_Object = RatingObject.GUARANTOR.GetDescription()
                                    });
                                }
                                else
                                {
                                    x.Bond_Number.Add(arr[0].Trim());
                                }
                            }
                        }
                    }
                    if ("START-OF-DATA".Equals(line))
                    {
                        flag = true;
                    }
                }
            }
            if (new CreateCommpanyFile().create(tableType, reportDateStr, data))
            {
                putCommpanySFTP();
            }
            else
            {
                log.saveTransferCheck(
                    type,
                    false,
                    reportDateDt,
                    1,
                    startTime,
                    DateTime.Now);
                log.txtLog(
                    type,
                    false,
                    startTime,
                    logPath,
                    MessageType.Create_Commpany_File_Fail.GetDescription());
            }
        }