示例#1
0
 public static MA_TBMA_CONFIG GetTBMAConfig(SessionInfo sessionInfo)
 {
     try
     {
         LookupBusiness _lookupbusiness = new LookupBusiness();
         //Get data from database
         return(_lookupbusiness.GetTBMAConfig(sessionInfo));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        public static object SendFIReport(SessionInfo sessioninfo, string IDs)
        {
            try
            {
                string[]       TrnsID          = IDs.Split(',');
                DealBusiness   _dealBusiness   = new DealBusiness();
                LookupBusiness _lookupBusiness = new LookupBusiness();
                MA_TBMA_CONFIG config          = _lookupBusiness.GetTBMAConfig(sessioninfo);
                Guid           productID       = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID;
                List <DA_TRN>  trns            = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate)
                                                 .Where(a => a.PRODUCT_ID.Value == productID && TrnsID.Contains(a.ID.ToString()) && a.DA_TMBA_EXTENSION.SEND_DATE == null).ToList();
                var validateTBMA_NAME = (from o1 in trns
                                         where string.IsNullOrEmpty(o1.MA_COUTERPARTY.TBMA_NAME)
                                         select o1.MA_COUTERPARTY.SNAME).Distinct().ToArray();

                //verify required info
                if (validateTBMA_NAME.Length > 0)
                {
                    throw CreateException(new Exception(), "TBMA_NAME can't be empty. Please input TBMA_NAME on counterparty " + string.Join(",", validateTBMA_NAME));
                }
                if (config == null)
                {
                    throw CreateException(new Exception(), "Cannot get configurations. Please contact administrator");
                }

                foreach (DA_TRN trn in trns)
                {
                    _dealBusiness.CreatingTBMAReportFile(sessioninfo, trn, config);
                }

                Guid[] TrnsIDSend = trns.Select(t => t.ID).ToArray();
                _dealBusiness.UpdateFISendReport(sessioninfo, TrnsIDSend);
                return(new
                {
                    Result = "OK",
                    Message = String.Format("Sending report completed")
                });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
示例#3
0
 public static MA_TBMA_CONFIG GetTBMAConfig(SessionInfo sessionInfo)
 {
     try
     {
         LookupBusiness _lookupbusiness = new LookupBusiness();
         //Get data from database
         return _lookupbusiness.GetTBMAConfig(sessionInfo);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
        public static object SendFIReport(SessionInfo sessioninfo, string IDs)
        {
            try
                {

                    string[] TrnsID = IDs.Split(',');
                    DealBusiness _dealBusiness = new DealBusiness();
                    LookupBusiness _lookupBusiness = new LookupBusiness();
                    MA_TBMA_CONFIG config = _lookupBusiness.GetTBMAConfig(sessioninfo);
                    Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID;
                    List<DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate)
                                       .Where(a => a.PRODUCT_ID.Value == productID && TrnsID.Contains(a.ID.ToString()) && a.DA_TMBA_EXTENSION.SEND_DATE == null).ToList();
                    var validateTBMA_NAME = (from o1 in trns
                                            where string.IsNullOrEmpty(o1.MA_COUTERPARTY.TBMA_NAME)
                                            select o1.MA_COUTERPARTY.SNAME).Distinct().ToArray();

                    //verify required info
                    if (validateTBMA_NAME.Length > 0) {
                        throw CreateException(new Exception(), "TBMA_NAME can't be empty. Please input TBMA_NAME on counterparty " + string.Join(",", validateTBMA_NAME));
                    }
                    if (config == null)
                        throw CreateException(new Exception(), "Cannot get configurations. Please contact administrator");

                    foreach (DA_TRN trn in trns)
                    {
                        _dealBusiness.CreatingTBMAReportFile(sessioninfo, trn, config);
                    }

                    Guid[] TrnsIDSend = trns.Select(t => t.ID).ToArray();
                    _dealBusiness.UpdateFISendReport(sessioninfo, TrnsIDSend);
                    return new
                    {
                        Result = "OK",
                        Message = String.Format("Sending report completed")
                    };
                }
                catch (Exception ex)
                {
                    return new { Result = "ERROR", Message = ex.Message };
                }
        }