Example #1
0
 /// <summary>
 /// Bond_Rating_Summary 組成 A58ViewModel
 /// </summary>
 /// <param name="item">DataRow</param>
 /// <returns>A58ViewModel</returns>
 private A58ViewModel getA58ViewModel(Bond_Rating_Summary item)
 {
     return(new A58ViewModel()
     {
         Reference_Nbr = item.Reference_Nbr,
         Report_Date = TypeTransfer.dateTimeNToString(item.Report_Date),
         Bond_Number = item.Bond_Number,
         Lots = item.Lots,
         Origination_Date = TypeTransfer.dateTimeNToString(item.Origination_Date),
         Parm_ID = item.Parm_ID,
         Bond_Type = item.Bond_Type,
         Rating_Type = item.Rating_Type == "1" ? Rating_Type.A.GetDescription() : Rating_Type.B.GetDescription(),
         Rating_Object = item.Rating_Object,
         Rating_Org_Area = item.Rating_Org_Area,
         Rating_Selection = item.Rating_Selection == "1" ? "孰高" : "孰低",
         Grade_Adjust = TypeTransfer.intNToString(item.Grade_Adjust),
         Rating_Priority = TypeTransfer.intNToString(item.Rating_Priority),
         Processing_Date = TypeTransfer.dateTimeNToString(item.Processing_Date),
         Version = TypeTransfer.intNToString(item.Version),
         Portfolio_Name = item.Portfolio_Name,
         SMF = item.SMF,
         Issuer = item.ISSUER,
         Security_Ticker = getSecurityTicker(item.SMF, item.Bond_Number),
         RATING_AS_OF_DATE_OVERRIDE = item.Rating_Type == "1" ?
                                      TypeTransfer.dateTimeNToString(item.Origination_Date, 8) :
                                      TypeTransfer.dateTimeNToString(item.Report_Date, 8)
     });
 }
Example #2
0
        public JsonResult UpdateDbData(CDCItemImpViewModel model)
        {
            MSGReturnModel <bool> result = new MSGReturnModel <bool>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.CDCItemImpData))
            {
                var dbData         = (List <CDCItemImpViewModel>)Cache.Get(CacheList.CDCItemImpData);
                var updateTempData = dbData.FirstOrDefault(x => x.vItemId == model.vItemId);
                if (updateTempData != null)
                {
                    var _vItemImp_Name_AFT = model.vItemImp_Name.CheckAFT(updateTempData.vItemImp_Name);
                    if (_vItemImp_Name_AFT.Item2)
                    {
                        updateTempData.vItemImp_Name_AFT = _vItemImp_Name_AFT.Item1;
                    }
                    var _vItemImp_Remaining_AFT = TypeTransfer.intNToString(model.vItemImp_Remaining).CheckAFT(TypeTransfer.intNToString(updateTempData.vItemImp_Remaining));
                    if (_vItemImp_Remaining_AFT.Item2)
                    {
                        updateTempData.vItemImp_Remaining_AFT = TypeTransfer.stringToIntN(_vItemImp_Remaining_AFT.Item1);
                    }
                    var _vItemImp_Amount_AFT = TypeTransfer.decimalNToString(model.vItemImp_Amount).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vItemImp_Amount));
                    if (_vItemImp_Amount_AFT.Item2)
                    {
                        updateTempData.vItemImp_Amount_AFT = TypeTransfer.stringToDecimal(_vItemImp_Amount_AFT.Item1);
                    }
                    var _vItemImp_Expected_Date_AFT = model.vItemImp_Expected_Date.CheckAFT(updateTempData.vItemImp_Expected_Date);
                    if (_vItemImp_Expected_Date_AFT.Item2)
                    {
                        updateTempData.vItemImp_Expected_Date_AFT = _vItemImp_Expected_Date_AFT.Item1;
                    }
                    var _vItemImp_Description_AFT = model.vItemImp_Description.CheckAFT(updateTempData.vItemImp_Description);
                    if (_vItemImp_Description_AFT.Item2)
                    {
                        updateTempData.vItemImp_Description_AFT = _vItemImp_Description_AFT.Item1;
                    }
                    var _vItemImp_MEMO_AFT = model.vItemImp_MEMO.CheckAFT(updateTempData.vItemImp_MEMO);
                    if (_vItemImp_MEMO_AFT.Item2)
                    {
                        updateTempData.vItemImp_MEMO_AFT = _vItemImp_MEMO_AFT.Item1;
                    }
                    updateTempData.vAFTFlag = _vItemImp_Name_AFT.Item2 || _vItemImp_Remaining_AFT.Item2 || _vItemImp_Amount_AFT.Item2 || _vItemImp_Expected_Date_AFT.Item2 || _vItemImp_Description_AFT.Item2 || _vItemImp_MEMO_AFT.Item2;
                    Cache.Invalidate(CacheList.CDCItemImpData);
                    Cache.Set(CacheList.CDCItemImpData, dbData);
                    result.Datas       = dbData.Any(x => x.vAFTFlag);
                    result.RETURN_FLAG = true;
                    result.DESCRIPTION = Ref.MessageType.update_Success.GetDescription();
                }
                else
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = Ref.MessageType.update_Fail.GetDescription();
                }
            }
            return(Json(result));
        }
Example #3
0
        public JsonResult UpdateDbData(CDCStockViewModel model)
        {
            MSGReturnModel <bool> result = new MSGReturnModel <bool>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.CDCStockDataD))
            {
                var dbData         = (List <CDCStockViewModel>)Cache.Get(CacheList.CDCStockDataD);
                var updateTempData = dbData.FirstOrDefault(x => x.vItemId == model.vItemId);
                if (updateTempData != null)
                {
                    var _vStock_Type_Aft = model.vStock_Type.CheckAFT(updateTempData.vStock_Type);
                    if (_vStock_Type_Aft.Item2)
                    {
                        updateTempData.vStock_Type_Aft = _vStock_Type_Aft.Item1;
                    }
                    var _vStock_No_Preamble_Aft = model.vStock_No_Preamble.CheckAFT(updateTempData.vStock_No_Preamble);
                    if (_vStock_No_Preamble_Aft.Item2)
                    {
                        updateTempData.vStock_No_Preamble_Aft = _vStock_No_Preamble_Aft.Item1;
                    }
                    var _vStock_No_B_Aft = model.vStock_No_B.CheckAFT(updateTempData.vStock_No_B);
                    if (_vStock_No_B_Aft.Item2)
                    {
                        updateTempData.vStock_No_B_Aft = _vStock_No_B_Aft.Item1;
                    }
                    var _vStock_No_E_Aft = model.vStock_No_E.CheckAFT(updateTempData.vStock_No_E);
                    if (_vStock_No_E_Aft.Item2)
                    {
                        updateTempData.vStock_No_E_Aft = _vStock_No_E_Aft.Item1;
                    }
                    var _vStock_Cnt_Aft = TypeTransfer.intNToString(model.vStock_Cnt).CheckAFT(TypeTransfer.intNToString(updateTempData.vStock_Cnt));
                    if (_vStock_Cnt_Aft.Item2)
                    {
                        updateTempData.vStock_Cnt_Aft = TypeTransfer.stringToIntN(_vStock_Cnt_Aft.Item1);
                    }
                    var _vAmount_Per_Share_Aft = TypeTransfer.decimalNToString(model.vAmount_Per_Share).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vAmount_Per_Share));
                    if (_vAmount_Per_Share_Aft.Item2)
                    {
                        updateTempData.vAmount_Per_Share_Aft = TypeTransfer.stringToDecimal(_vAmount_Per_Share_Aft.Item1);
                    }
                    var _vSingle_Number_Of_Shares_Aft = TypeTransfer.decimalNToString(model.vSingle_Number_Of_Shares).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vSingle_Number_Of_Shares));
                    if (_vSingle_Number_Of_Shares_Aft.Item2)
                    {
                        updateTempData.vSingle_Number_Of_Shares_Aft = TypeTransfer.stringToDecimal(_vSingle_Number_Of_Shares_Aft.Item1);
                    }
                    var _vDenomination_Aft = TypeTransfer.decimalNToString(model.vDenomination).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vDenomination));
                    if (_vDenomination_Aft.Item2)
                    {
                        updateTempData.vDenomination_Aft = TypeTransfer.stringToDecimal(_vDenomination_Aft.Item1);
                    }
                    var _vDenominationTotal_Aft = TypeTransfer.decimalNToString(model.vDenominationTotal).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vDenominationTotal));
                    if (_vDenominationTotal_Aft.Item2)
                    {
                        updateTempData.vDenominationTotal_Aft = TypeTransfer.stringToDecimal(_vDenominationTotal_Aft.Item1);
                    }
                    var _vNumberOfShares_Aft = TypeTransfer.decimalNToString(model.vNumberOfShares).CheckAFT(TypeTransfer.decimalNToString(updateTempData.vNumberOfShares));
                    if (_vNumberOfShares_Aft.Item2)
                    {
                        updateTempData.vNumberOfShares_Aft = TypeTransfer.stringToDecimal(_vNumberOfShares_Aft.Item1);
                    }
                    var _vMemo_Aft = model.vMemo.CheckAFT(updateTempData.vMemo);
                    if (_vMemo_Aft.Item2)
                    {
                        updateTempData.vMemo_Aft = _vMemo_Aft.Item1;
                    }

                    updateTempData.vAftFlag = _vStock_Type_Aft.Item2 || _vStock_No_Preamble_Aft.Item2 || _vStock_No_B_Aft.Item2 || _vStock_No_E_Aft.Item2 || _vStock_Cnt_Aft.Item2 ||
                                              _vAmount_Per_Share_Aft.Item2 || _vSingle_Number_Of_Shares_Aft.Item2 || _vDenomination_Aft.Item2 || _vDenominationTotal_Aft.Item2 || _vNumberOfShares_Aft.Item2 || _vMemo_Aft.Item2;
                    Cache.Invalidate(CacheList.CDCStockDataD);
                    Cache.Set(CacheList.CDCStockDataD, dbData);
                    result.Datas       = dbData.Any(x => x.vAftFlag);
                    result.RETURN_FLAG = true;
                    result.DESCRIPTION = Ref.MessageType.update_Success.GetDescription();
                }
                else
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = Ref.MessageType.update_Fail.GetDescription();
                }
            }

            return(Json(result));
        }