コード例 #1
0
ファイル: LookupValues.cs プロジェクト: Theeranit/DealMarker
 public MemoryLookupValues()
 {
     Frequencies = _lookupBusiness.GetFreqTypeAll();
     Products    = _lookupBusiness.GetProductAll();
     Statuses    = _lookupBusiness.GetStatusAll();
     Portfolios  = _lookupBusiness.GetPortfolioAll();
     Limits      = _lookupBusiness.GetLimitAll();
     Currencies  = _lookupBusiness.GetCurrencyAll();
 }
コード例 #2
0
        public static object Create(SessionInfo sessioninfo, MA_COUTERPARTY record)
        {
            try
            {
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                LookupBusiness       _lookupBusiness       = new LookupBusiness();
                MA_CTPY_LIMIT        cplimit;

                record.ID                 = Guid.NewGuid();
                record.SNAME              = record.SNAME.ToUpper();
                record.TBMA_NAME          = record.TBMA_NAME.ToUpper();
                record.FNAME              = record.FNAME.ToUpper();
                record.BUSINESS           = record.BUSINESS.ToUpper();
                record.ISACTIVE           = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true;
                record.LOG.INSERTDATE     = DateTime.Now;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                record.GROUP_CTPY_ID      = record.GROUP_CTPY_ID == Guid.Empty ? null : record.GROUP_CTPY_ID;

                //Prepare Counterparty-Limit data
                List <MA_LIMIT> limits = _lookupBusiness.GetLimitAll();

                foreach (MA_LIMIT limit in limits)
                {
                    cplimit = new MA_CTPY_LIMIT();

                    cplimit.ID                 = Guid.NewGuid();
                    cplimit.CTPY_ID            = record.ID;
                    cplimit.LIMIT_ID           = limit.ID;
                    cplimit.FLAG_CONTROL       = true;
                    cplimit.AMOUNT             = 0;
                    cplimit.EXPIRE_DATE        = sessioninfo.Process.CurrentDate;
                    cplimit.LOG.INSERTDATE     = DateTime.Now;
                    cplimit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;

                    record.MA_CTPY_LIMIT.Add(cplimit);
                }

                var addedRecord = _counterpartyBusiness.Create(sessioninfo, record);

                addedRecord.MA_CTPY_LIMIT.Clear();

                return(new { Result = "OK", Record = addedRecord });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
コード例 #3
0
        public static object Create(SessionInfo sessioninfo, MA_COUTERPARTY record)
        {
            try
            {
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                LookupBusiness _lookupBusiness = new LookupBusiness();
                MA_CTPY_LIMIT cplimit;

                record.ID = Guid.NewGuid();
                record.SNAME = record.SNAME.ToUpper();
                record.TBMA_NAME = record.TBMA_NAME.ToUpper();
                record.FNAME = record.FNAME.ToUpper();
                record.BUSINESS = record.BUSINESS.ToUpper();
                record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true;
                record.LOG.INSERTDATE = DateTime.Now;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                record.GROUP_CTPY_ID = record.GROUP_CTPY_ID == Guid.Empty ? null : record.GROUP_CTPY_ID;

                //Prepare Counterparty-Limit data
                List<MA_LIMIT> limits = _lookupBusiness.GetLimitAll();

                foreach (MA_LIMIT limit in limits)
                {
                    cplimit = new MA_CTPY_LIMIT();

                    cplimit.ID = Guid.NewGuid();
                    cplimit.CTPY_ID = record.ID;
                    cplimit.LIMIT_ID = limit.ID;
                    cplimit.FLAG_CONTROL = true;
                    cplimit.AMOUNT = 0;
                    cplimit.EXPIRE_DATE = sessioninfo.Process.CurrentDate;
                    cplimit.LOG.INSERTDATE = DateTime.Now;
                    cplimit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;

                    record.MA_CTPY_LIMIT.Add(cplimit);
                }

                var addedRecord = _counterpartyBusiness.Create(sessioninfo, record);

                addedRecord.MA_CTPY_LIMIT.Clear();

                return new { Result = "OK", Record = addedRecord };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
コード例 #4
0
        public static object GetLimitOptions(SessionInfo sessioninfo)
        {
            try
            {
                LookupBusiness _lookupBusiness = new LookupBusiness();
                //Get data from database
                var limits = _lookupBusiness.GetLimitAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID });

                //Return result to jTable
                return(new { Result = "OK", Options = limits });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
コード例 #5
0
        public List <LimitCheckModel> GetPCEReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strLimit, string strSource, string strStatus)
        {
            try
            {
                DateTime             dteReport;
                LimitCheckBusiness   _limitBusiness        = new LimitCheckBusiness();
                DealBusiness         _dealBusiness         = new DealBusiness();
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                Guid guCtpyID  = Guid.Empty;
                Guid guLimitID = Guid.Empty;

                if (String.IsNullOrEmpty(strReportDate))
                {
                    throw this.CreateException(new Exception(), "Please input report date.");
                }
                else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport))
                {
                    throw this.CreateException(new Exception(), "Invalid report date.");
                }
                else
                {
                    dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null);
                }

                if (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                }

                if (_dealBusiness.CountByProcessDate(dteReport) == 0)
                {
                    throw this.CreateException(new Exception(), "No data for selected report date.");
                }

                var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, Guid.Empty, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).AsQueryable();

                //Get temp limit
                //Look for temp limit when all conditions meet
                // 1. Transaction maturity date <= Temp limit maturity date
                foreach (LimitCheckModel limit in limits)
                {
                    MA_TEMP_CTPY_LIMIT temp_limit = _counterpartyBusiness.GetActiveTempByID(sessioninfo.Process.CurrentDate, sessioninfo.Process.CurrentDate, limit.CTPY_LIMIT_ID);

                    if (temp_limit != null)
                    {
                        limit.TEMP_AMOUNT = temp_limit.AMOUNT;
                    }
                }

                //Additional filter on limit name
                if (Guid.TryParse(strLimit, out guLimitID))
                {
                    LookupBusiness _lookupBusiness = new LookupBusiness();
                    MA_LIMIT       limit           = _lookupBusiness.GetLimitAll().FirstOrDefault(t => t.ID == Guid.Parse(strLimit));

                    limits = limits.Where(t => t.LIMIT_LABEL.IndexOf(limit.LABEL, StringComparison.OrdinalIgnoreCase) >= 0);
                }

                if (strStatus != "")
                {
                    limits = limits.Where(t => t.STATUS.IndexOf(strStatus, StringComparison.OrdinalIgnoreCase) >= 0);
                }

                return(limits.ToList());
            }

            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
コード例 #6
0
ファイル: LookupUIP.cs プロジェクト: Theeranit/DealMarker
        public static object GetLimitOptions(SessionInfo sessioninfo)
        {
            try
            {
                LookupBusiness _lookupBusiness = new LookupBusiness();
                //Get data from database
                var limits = _lookupBusiness.GetLimitAll().Select(c => new { DisplayText = c.LABEL, Value = c.ID });

                //Return result to jTable
                return new { Result = "OK", Options = limits };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
コード例 #7
0
        public List<LimitCheckModel> GetPCEReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strLimit, string strSource, string strStatus)
        {
            try
            {
                DateTime dteReport;
                LimitCheckBusiness _limitBusiness = new LimitCheckBusiness();
                DealBusiness _dealBusiness = new DealBusiness();
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                Guid guCtpyID = Guid.Empty;
                Guid guLimitID = Guid.Empty;

                if (String.IsNullOrEmpty(strReportDate))
                    throw this.CreateException(new Exception(), "Please input report date.");
                else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport))
                    throw this.CreateException(new Exception(), "Invalid report date.");
                else
                    dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null);

                if (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                }

                if (_dealBusiness.CountByProcessDate(dteReport) == 0)
                {
                    throw this.CreateException(new Exception(), "No data for selected report date.");
                }

                var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, Guid.Empty, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).AsQueryable();

                //Get temp limit
                //Look for temp limit when all conditions meet
                // 1. Transaction maturity date <= Temp limit maturity date
                foreach (LimitCheckModel limit in limits)
                {
                    MA_TEMP_CTPY_LIMIT temp_limit = _counterpartyBusiness.GetActiveTempByID(sessioninfo.Process.CurrentDate, sessioninfo.Process.CurrentDate, limit.CTPY_LIMIT_ID);

                    if (temp_limit != null)
                        limit.TEMP_AMOUNT = temp_limit.AMOUNT;
                }

                //Additional filter on limit name
                if (Guid.TryParse(strLimit, out guLimitID))
                {
                    LookupBusiness _lookupBusiness = new LookupBusiness();
                    MA_LIMIT limit = _lookupBusiness.GetLimitAll().FirstOrDefault(t => t.ID == Guid.Parse(strLimit));

                    limits = limits.Where(t => t.LIMIT_LABEL.IndexOf(limit.LABEL, StringComparison.OrdinalIgnoreCase) >= 0);
                }

                if (strStatus != "")
                {
                    limits = limits.Where(t => t.STATUS.IndexOf(strStatus, StringComparison.OrdinalIgnoreCase) >= 0);
                }

                return limits.ToList();
            }

            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }