Exemplo n.º 1
0
        public static object Create(SessionInfo sessioninfo, MA_USER record, int intCheckAD)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                if (intCheckAD == 1)
                {
                    bool validUser = LDAPHelper.UserExists(record.USERCODE);
                    if (!validUser)
                        return new { Result = "ERROR", Message = "User is not exist."};
                }

                record.ID = Guid.NewGuid();
                record.DEPARTMENT = record.DEPARTMENT.ToUpper();
                record.NAME = record.NAME.ToUpper();
                record.USER_OPICS = record.USER_OPICS.ToUpper();
                record.USERCODE = record.USERCODE.ToUpper();
                record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.HasValue ? false : true;
                record.ISLOCKED = record.ISLOCKED == null || !record.ISACTIVE.HasValue ? false : true;
                record.LOG.INSERTDATE = DateTime.Now;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                var addedStudent = _userBusiness.CreateUser(sessioninfo, record);
                return new { Result = "OK", Record = addedStudent };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Exemplo n.º 2
0
 public void DeleteUserTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     Guid ID = new Guid(); // TODO: Initialize to an appropriate value
     target.DeleteUser(sessioninfo, ID);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 3
0
 public void GetAllTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     List<MA_USER> expected = null; // TODO: Initialize to an appropriate value
     List<MA_USER> actual;
     actual = target.GetAll();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 4
0
 public void CreateUserTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     MA_USER user = null; // TODO: Initialize to an appropriate value
     MA_USER expected = null; // TODO: Initialize to an appropriate value
     MA_USER actual;
     actual = target.CreateUser(sessioninfo, user);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 5
0
 public static object Delete(SessionInfo sessioninfo, Guid ID)
 {
     try
     {
         UserBusiness _userBusiness = new UserBusiness();
         _userBusiness.DeleteUser(sessioninfo, ID);
         return new { Result = "OK" };
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }
Exemplo n.º 6
0
        public static object GetByFilter(SessionInfo sessioninfo, string name, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                //Get data from database
                List<MA_USER> users = _userBusiness.GetByFilter(sessioninfo, name, jtSorting);

                //Return result to jTable
                return new { Result = "OK",
                             Records = jtPageSize > 0 ? users.Skip(jtStartIndex).Take(jtPageSize).ToList() : users,
                             TotalRecordCount = users.Count };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Exemplo n.º 7
0
 public void UserBusinessConstructorTest()
 {
     UserBusiness target = new UserBusiness();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Exemplo n.º 8
0
 public void LogOnTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     string username = string.Empty; // TODO: Initialize to an appropriate value
     string password = string.Empty; // TODO: Initialize to an appropriate value
     SessionInfo expected = null; // TODO: Initialize to an appropriate value
     SessionInfo actual;
     actual = target.LogOn(username, password);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 9
0
        public static List<FIDealModel> GetDealInternalByProcessDate(SessionInfo sessioninfo)
        {
            DealBusiness _dealBusiness = new DealBusiness();
            UserBusiness _userBusiness = new UserBusiness();
            LookupBusiness _lookupBusiness = new LookupBusiness();
            List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll();
            List<MA_USER> users = _userBusiness.GetAll();
            Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID;
            List<DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate);

            return (from t in trns.Where(a => a.PRODUCT_ID.Value == productID && a.DA_TMBA_EXTENSION != null)
                      join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser
                      from inputuser in ljuser.DefaultIfEmpty()
                      join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID  into ljccy1
                      from ccy1 in ljccy1.DefaultIfEmpty()
                      join tbmauser in users on  t.DA_TMBA_EXTENSION.SENDER_ID equals tbmauser.ID  into ljtbmauser
                      from tbmainputuser in ljtbmauser.DefaultIfEmpty()
                      orderby t.LOG.INSERTDATE descending
                      select new FIDealModel
                      {
                          ID = t.ID,
                          DMK_NO = t.INT_DEAL_NO,
                          OPICS_NO = t.EXT_DEAL_NO,
                          InsertState = t.MA_STATUS.LABEL == StatusCode.CANCELLED.ToString()
                                            ? "Cancelled"
                                            : t.DA_TMBA_EXTENSION.SEND_DATE != null
                                                ? "Sent"
                                                : 1800 - DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds <=0
                                                    ? "Late"
                                                    : (1800 - Math.Round( DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds)).ToString() ,
                          TradeDate = t.TRADE_DATE.Value,
                          MaturityDate = t.MATURITY_DATE,
                          Instrument = t.MA_INSRUMENT.LABEL,
                          BuySell = t.FLAG_BUYSELL,
                          Portfolio = t.MA_PORTFOLIO.LABEL,
                          Counterparty = t.MA_COUTERPARTY.SNAME,
                          Yield = t.FIRST.RATE.Value,
                          GrossValue = t.FIRST.NOTIONAL.Value,
                          CCY = ccy1 != null ? ccy1.LABEL : null,
                          Trader = inputuser != null ? inputuser.USERCODE : null,
                          Status = t.MA_STATUS.LABEL,
                          PCE = t.KK_CONTRIBUTE.HasValue ? t.KK_CONTRIBUTE.Value : 0,
                          Sender = tbmainputuser != null ? tbmainputuser.USERCODE : null,
                          Unit = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.UNIT : 0,
                          CleanPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.CLEAN_PRICE : 0,
                          GrossPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.GROSS_PRICE : 0,
                          YieldType = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.YIELD_TYPE : string.Empty,
                          ReporyBy = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.IS_REPORT_CLEAN ? "Clean Price" : "Gross Price" : string.Empty,
                          Purpose = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.PURPOSE : string.Empty,
                          Term = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.TERM.HasValue ? t.DA_TMBA_EXTENSION.TERM.Value : 0,
                          Rate = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.RATE.HasValue ? t.DA_TMBA_EXTENSION.RATE.Value : 0,
                          TBMA_Remark = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.REMARK : string.Empty,
                          SendTime = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.SEND_DATE.HasValue ? t.DA_TMBA_EXTENSION.SEND_DATE.Value.ToString("dd MMM yyy HH:mm") : string.Empty : string.Empty,
                          PrimaryMarket = t.FLAG_PCE.Value ? "Yes" : "No",
                          NonDVP = t.FLAG_SETTLE.Value ? "Yes" : "No"
                      }).ToList();
        }
Exemplo n.º 10
0
        public static List<DealViewModel> GetDealInquiryData(SessionInfo sessioninfo
                                                            , string strDMKNo
                                                            , string strOPICNo
                                                            , string strProduct
                                                            , string strCtpy
                                                            , string strPortfolio
                                                            , string strTradeDate
                                                            , string strEffDate
                                                            , string strMatDate
                                                            , string strInstrument
                                                            , string strUser
                                                            , string strStatus
                                                            , string strOverStatus
                                                            , string strProcDate
                                                            , string strSettleStatus)
        {
            DealBusiness _dealBusiness = new DealBusiness();
            UserBusiness _userBusiness = new UserBusiness();
            LookupBusiness _lookupBusiness = new LookupBusiness();

            //Get data from database
            List<DA_TRN> trns = _dealBusiness.GetDealInquiryByFilter(sessioninfo
                                                                        , strDMKNo
                                                                        , strOPICNo
                                                                        , strProduct
                                                                        , strCtpy
                                                                        , strPortfolio
                                                                        , strTradeDate
                                                                        , strEffDate
                                                                        , strMatDate
                                                                        , strInstrument
                                                                        , strUser
                                                                        , strStatus
                                                                        , strProcDate);
            //Get user data
            List<MA_USER> users = _userBusiness.GetAll();
            List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll();
            List<MA_FREQ_TYPE> freq = _lookupBusiness.GetFreqTypeAll();

            return (from t in trns
                         join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser
                         from inputuser in ljuser.DefaultIfEmpty()
                         join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID into ljccy1
                         from ccy1 in ljccy1.DefaultIfEmpty()
                         join tempccy2 in ccys on t.SECOND.CCY_ID equals tempccy2.ID into ljccy2
                         from ccy2 in ljccy2.DefaultIfEmpty()
                         join f1 in freq on t.FIRST.FREQTYPE_ID equals f1.ID into fg1
                         from subfg1 in fg1.DefaultIfEmpty()
                         join f2 in freq on t.SECOND.FREQTYPE_ID equals f2.ID into fg2
                         from subfg2 in fg2.DefaultIfEmpty()
                         select new DealViewModel
                         {
                             ID = t.ID,
                             EntryDate = t.LOG.INSERTDATE,
                             DMK_NO = t.INT_DEAL_NO,
                             OPICS_NO = t.EXT_DEAL_NO,
                             TradeDate = t.TRADE_DATE.Value,
                             EffectiveDate = t.START_DATE,
                             Instrument = t.MA_INSRUMENT.LABEL,
                             MaturityDate = t.MATURITY_DATE,
                             BuySell = t.FLAG_BUYSELL,
                             Product = t.MA_PRODUCT.LABEL,
                             Portfolio = t.MA_PORTFOLIO.LABEL,
                             Counterparty = t.MA_COUTERPARTY.SNAME,
                             Notional1 = t.FIRST.NOTIONAL,
                             PayRec1 = t.FIRST.FLAG_PAYREC,
                             FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT",
                             Rate1 = t.FIRST.RATE,
                             Fixing1 = t.FIRST.FIRSTFIXINGAMT,
                             SwapPoint1 = t.FIRST.SWAP_POINT,
                             Notional2 = t.SECOND.NOTIONAL,
                             PayRec2 = t.SECOND.FLAG_PAYREC,
                             FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT",
                             Rate2 = t.SECOND.RATE,
                             Fixing2 = t.SECOND.FIRSTFIXINGAMT,
                             SwapPoint2 = t.SECOND.SWAP_POINT,
                             Status = t.MA_STATUS.LABEL,
                             KKContribute = t.KK_CONTRIBUTE,
                             BotContribute = t.BOT_CONTRIBUTE                             ,
                             LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET",
                             LimitApprover = t.OVER_APPROVER,
                             Trader = inputuser != null ? inputuser.USERCODE : null,
                             Remark = t.REMARK,
                             CCY1 = ccy1 != null ? ccy1.LABEL : null,
                             CCY2 = ccy2 != null ? ccy2.LABEL : null,
                             SettlementLimit = !t.FLAG_SETTLE.HasValue || !t.FLAG_SETTLE.Value ? "No" : "Yes",
                             Freq1 = subfg1 != null ? subfg1.USERCODE : null,
                             Freq2 = subfg2 != null ? subfg2.USERCODE : null,
                             OpicsTrader = t.INSERT_BY_EXT,
                             TBMA_SENT = t.DA_TMBA_EXTENSION == null ? "N/A" : t.DA_TMBA_EXTENSION.SEND_DATE != null ? "Yes" : "No"
                         }).Where(p => p.LimitOverwrite == strOverStatus || String.IsNullOrEmpty(strOverStatus))
                         .Where(t => t.SettlementLimit == strSettleStatus || string.IsNullOrEmpty(strSettleStatus)).ToList();
        }
Exemplo n.º 11
0
        public static List<DealViewModel> GetLimitOverwriteData(SessionInfo sessioninfo, string strReportDate, string strCtpy)
        {
            ReportBusiness _reportBusiness = new ReportBusiness();
            UserBusiness _userBusiness = new UserBusiness();
            LookupBusiness _lookupBusiness = new LookupBusiness();
            char[] trimchar = { '/' };
            List<DA_TRN> trns =  _reportBusiness.GetLimitOverwriteReport(sessioninfo,strReportDate,strCtpy);
            List<MA_USER> users = _userBusiness.GetAll();
            List<MA_CURRENCY> ccys =  _lookupBusiness.GetCurrencyAll();
            var query = (from t in trns
                            join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser
                            join ccy in ccys on t.FIRST.CCY_ID equals ccy.ID
                            from inputuser in ljuser.DefaultIfEmpty()
                            select new DealViewModel
                            {
                                EngineDate = t.ENGINE_DATE,
                                Trader = inputuser != null ? inputuser.USERCODE : "",
                                LimitApprover = t.OVER_APPROVER,
                                Remark = t.OVER_COMMENT,
                                DMK_NO = t.INT_DEAL_NO,
                                Counterparty = t.MA_COUTERPARTY.SNAME,
                                Product = t.MA_PRODUCT.LABEL,
                                Instrument = t.MA_INSRUMENT.LABEL,
                                Notional1 = t.FIRST.NOTIONAL,
                                CCY1 = ccy.LABEL,
                                KKContribute = t.KK_CONTRIBUTE,
                                LimitOverwrite = string.Concat(t.OVER_AMOUNT > 0 ? "PCE/" : "", t.OVER_SETTL_AMOUNT > 0 ? "SET/" : "", t.OVER_COUNTRY_AMOUNT > 0 ? "COUNTRY/" : "").TrimEnd(trimchar),
                                LimitOverAmount = ((t.OVER_AMOUNT > 0 ? "PCE: " + t.OVER_AMOUNT.Value.ToString("#,##0") : string.Empty)
                                                    + (t.OVER_SETTL_AMOUNT > 0 ? " SET: " + t.OVER_SETTL_AMOUNT.Value.ToString("#,##0") : string.Empty)
                                                    + (t.OVER_COUNTRY_AMOUNT > 0 ? " COUNTRY: " + t.OVER_COUNTRY_AMOUNT.Value.ToString("#,##0") : string.Empty)).Trim()
                            }).OrderBy(t=>t.EngineDate).ToList();

            return query;
        }
Exemplo n.º 12
0
        public static MA_USER GetByUserCode(SessionInfo sessioninfo, string usercode)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                //Get data from database
                MA_USER user = _userBusiness.GetByUserCode(sessioninfo, usercode);

                //Return result to jTable
                return user;
            }
            catch (Exception ex)
            {
                throw new UIPException(ex);
            }
        }
Exemplo n.º 13
0
        public static MA_USER ValidateUser(SessionInfo sessioninfo, string strUsername, string strPassword, int intADLogin)
        {
            UserBusiness _userBusiness = new UserBusiness();

            try
            {
                bool validUser = true;
                if (intADLogin == 1)
                    validUser = LDAPHelper.ValidateUser(strUsername, strPassword);

                if (validUser)
                {
                    MA_USER user = _userBusiness.GetByUserCode(sessioninfo, strUsername);

                    return user;
                }
                else
                {
                    return null;
                }

            }
            catch (Exception ex)
            {
                throw new UIPException(ex);
            }

            //if (strUsername == "Admin")
            //{
            //    return new { Result = "OK", Message = "" };
            //}
            //else
            //{
            //    return new { Result = "ERROR", Message = "User has no right to approve limit." };
            //}
        }
Exemplo n.º 14
0
        //public static SessionInfo LogOn(string username)
        //{
        //    SessionInfo _session = new SessionInfo();
        //    if (username.ToUpper().Equals("ADMINISTRATOR"))
        //    {
        //        UserBusiness _userBusiness = new UserBusiness();
        //        _session = _userBusiness.LogOn(username);
        //    }
        //    return _session;
        //}
        public static SessionInfo LogOn(string username, string password, string userIP, int intADLogin)
        {
            UserBusiness _userBusiness = new UserBusiness();
            SessionInfo _session = null;
            //string currentpassword = DecodeJSPassEncoding(password);
            string currentpassword = password.Trim();
            try
            {

                if (username.ToUpper().Equals("ADMINISTRATOR"))
                {
                    string systempassword = DecodeJSPassEncoding((string)ConfigurationSettings.AppSettings[AppSettingName.SYSTEM_KEY]);
                    if (systempassword.Equals(currentpassword))
                        _session = _userBusiness.LogOn(username, userIP);
                    else
                        throw new Exception("That password is incorrect. Be sure you're using the password for your Deal Maker account.");

                    _session.IsSystemUser = true;
                }
                else
                {
                    //log on via AD user
                    bool validUser = false;
                    if (intADLogin == 1)
                        validUser = LDAPHelper.ValidateUser(username, currentpassword);
                    else
                        validUser = _userBusiness.GetAll().FirstOrDefault(p => p.USERCODE.ToLower().Equals(username.ToLower())) != null ? true : false;

                    if (validUser)
                    {
                        _session = _userBusiness.LogOn(username, userIP);
                        _session.IsSystemUser = false;
                    }
                    else
                        throw new Exception("That username is not authorized. Be sure you're using the username and password for your Windows account.");

                }

            }
            catch (Exception ex)
            {
                throw new UIPException(ex);
            }

            return _session;
        }
Exemplo n.º 15
0
        public static object GetUserOptions(SessionInfo sessioninfo)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                //Get data from database
                var users = _userBusiness.GetAll().Select(c => new { DisplayText = c.USERCODE, Value = c.ID });

                //Return result to jTable
                return new { Result = "OK", Options = users };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Exemplo n.º 16
0
        public List<LimitAuditReportModel> GetLimitAuditReport(SessionInfo sessionInfo, string strLogDatefrom, string strLogDateto, string strCtpy, string strCountry, string strEvent)
        {
            try
            {
                DateTime dteReportfrom;
                DateTime dteReportto;
                Guid guCtpyID = Guid.Empty;
                Guid guCountryID = Guid.Empty;
                LogBusiness _logBusiness = new LogBusiness();
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                CountryBusiness _countryBusiness = new CountryBusiness();
                UserBusiness _userBusiness = new UserBusiness();

                var log = _logBusiness.GetLogAll().Where(l => l.EVENT == LimitLogEvent.LIMIT_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.TEMP_LIMIT_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.COUNTRY_LIMIY_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.TEMP_COUNTRY_LIMIT_AUDIT.ToString()).AsQueryable();

                var ctpyLimit = _counterpartyBusiness.GetCounterpartyLimitAll().AsQueryable();
                var ctpys = _counterpartyBusiness.GetCounterpartyAll().AsQueryable();
                var countrys = _countryBusiness.GetCountryAll().AsQueryable();
                var users = _userBusiness.GetAll().AsQueryable();

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

                if (String.IsNullOrEmpty(strLogDateto))
                    throw this.CreateException(new Exception(), "Please input end log date.");
                else if (!DateTime.TryParseExact(strLogDateto, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReportto))
                    throw this.CreateException(new Exception(), "Invalid end log date.");
                else
                    dteReportto = DateTime.ParseExact(strLogDateto, "dd/MM/yyyy", null);
                if (dteReportto < dteReportfrom) throw this.CreateException(new Exception(), "Start log date must before end log date.");

                var limits = from limit in ctpyLimit
                             join ctpy in ctpys on limit.CTPY_ID equals ctpy.ID
                             select new
                             {
                                 LIMIT_ID = limit.ID,
                                 CTPY_ID = ctpy.ID,
                                 SNAME = ctpy.SNAME,
                                 LIMIT = limit.MA_LIMIT.LABEL
                             };

                log = log.Where(l => l.LOG_DATE.Date >= dteReportfrom.Date && l.LOG_DATE.Date <= dteReportto.Date);

                if (strEvent != "-1")
                    log = log.Where(p => p.EVENT == strEvent);

                var limitAudits = from l in log
                                  join user in users on l.LOG.INSERTBYUSERID equals user.ID
                                  join c in limits on l.RECORD_ID equals c.LIMIT_ID into templimit
                                  from sublimit in templimit.DefaultIfEmpty()
                                  join country in countrys on l.RECORD_ID equals country.ID into tempcountry
                                  from subcountry in tempcountry.DefaultIfEmpty()
                                  orderby l.LOG_DATE
                                  select new LimitAuditReportModel
                                  {
                                      ENTITY = sublimit != null ? sublimit.SNAME : subcountry != null ? subcountry.LABEL : "",
                                      ENTITY_ID = sublimit != null ? sublimit.CTPY_ID : (subcountry != null ? subcountry.ID : Guid.Empty),
                                      LIMIT = (l.EVENT.Contains("TEMP") ? "TEMP-" : "") + (sublimit != null ? sublimit.LIMIT : "COUNTRY-LIMIT"), //sublimit != null ? sublimit.LIMIT : "Country Limit",
                                      USER = user.USERCODE,
                                      LOG_DATE = l.LOG_DATE,
                                      LOG_DATE_STR = l.LOG_DATE.ToString("dd-MMM-yyyy HH:mm"),
                                      DETAIL = l.LOG_DETAIL
                                  };

                if (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                    limitAudits = limitAudits.Where(p => p.ENTITY_ID == guCtpyID);
                }

                if (Guid.TryParse(strCountry, out guCountryID))
                {
                    guCountryID = Guid.Parse(strCountry);
                    limitAudits = limitAudits.Where(t => t.ENTITY_ID == guCountryID);
                }

                return limitAudits.ToList();
            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
Exemplo n.º 17
0
 public void GetByFilterTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     string name = string.Empty; // TODO: Initialize to an appropriate value
     int startIndex = 0; // TODO: Initialize to an appropriate value
     int count = 0; // TODO: Initialize to an appropriate value
     string sorting = string.Empty; // TODO: Initialize to an appropriate value
     List<MA_USER> expected = null; // TODO: Initialize to an appropriate value
     List<MA_USER> actual;
     actual = target.GetByFilter(sessioninfo, name, startIndex, count, sorting);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 18
0
 public void GetByIDTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     Guid ID = new Guid(); // TODO: Initialize to an appropriate value
     MA_USER expected = null; // TODO: Initialize to an appropriate value
     MA_USER actual;
     actual = target.GetByID(sessioninfo, ID);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 19
0
        public static List<LimitAuditReportModel> GetLimitAuditExport(SessionInfo sessioninfo, string strLogDatefrom, string strLogDateto, string strCtpy, string strCountry, string strEvent)
        {
            ReportBusiness _reportBusiness = new ReportBusiness();
            CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
            LookupBusiness _lookupBusiness = new LookupBusiness();
            UserBusiness _userBusiness = new UserBusiness();
            List<LimitAuditReportModel> logs = _reportBusiness.GetLimitAuditReport(sessioninfo, strLogDatefrom, strLogDateto, strCtpy, strCountry, strEvent);

               return logs;
        }
Exemplo n.º 20
0
 public void GetByUserCodeTest()
 {
     UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     string usercode = string.Empty; // TODO: Initialize to an appropriate value
     MA_USER expected = null; // TODO: Initialize to an appropriate value
     MA_USER actual;
     actual = target.GetByUserCode(sessioninfo, usercode);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 21
0
        public static object CancelDeal(SessionInfo sessioninfo, DA_TRN trn)
        {
            try
            {
                LookupBusiness _lookupBusiness = new LookupBusiness();
                UserBusiness _userBusiness = new UserBusiness();
                DealBusiness _dealbusiness = new DealBusiness();
                DA_TRN t = _dealbusiness.CancelDeal(sessioninfo, trn);
                DA_TRN t2 = _dealbusiness.GetDealByDealNo(t.INT_DEAL_NO,t.VERSION).FirstOrDefault(p => p.ID != t.ID);
                if (t2 != null) _dealbusiness.CancelDeal(sessioninfo, t2);
                var inputuser = _userBusiness.GetAll().FirstOrDefault(u => u.ID == t.LOG.INSERTBYUSERID);

                var query = new DealViewModel
                            {
                                ID = t.ID,
                                EntryDate = t.LOG.INSERTDATE,
                                DMK_NO = t.INT_DEAL_NO
                                ,
                                OPICS_NO = t.EXT_DEAL_NO,
                                TradeDate = t.TRADE_DATE.Value
                                ,
                                EffectiveDate = t.START_DATE,
                                Instrument = t.MA_INSRUMENT.LABEL
                                ,
                                MaturityDate = t.MATURITY_DATE,
                                BuySell = t.FLAG_BUYSELL
                                ,
                                Product = t.MA_PRODUCT.LABEL,
                                Portfolio = t.MA_PORTFOLIO.LABEL
                                ,
                                Counterparty = t.MA_COUTERPARTY.SNAME,
                                Notional1 = t.FIRST.NOTIONAL
                                ,
                                PayRec1 = t.FIRST.FLAG_PAYREC,
                                FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT"
                                ,
                                Rate1 = t.FIRST.RATE,
                                Fixing1 = t.FIRST.FIRSTFIXINGAMT,
                                SwapPoint1 = t.FIRST.SWAP_POINT,
                                Notional2 = t.SECOND.NOTIONAL
                                ,
                                PayRec2 = t.SECOND.FLAG_PAYREC,
                                FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT"
                                ,
                                Rate2 = t.SECOND.RATE,
                                Fixing2 = t.SECOND.FIRSTFIXINGAMT,
                                SwapPoint2 = t.SECOND.SWAP_POINT,
                                Status =  _lookupBusiness.GetStatusAll().FirstOrDefault(p => p.ID == t.STATUS_ID).LABEL
                                ,
                                KKContribute = t.KK_CONTRIBUTE,
                                BotContribute = t.BOT_CONTRIBUTE
                                ,
                                LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET"
                                ,
                                LimitApprover = t.OVER_APPROVER
                                ,
                                Trader = inputuser != null ? inputuser.USERCODE : ""
                                ,
                                Remark = t.REMARK
                            };
                return new { Result = "OK", Record = query, DealPairID = t2 != null? t2.ID.ToString() : string.Empty };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Exemplo n.º 22
0
 public static object CheckFlagReconcile(SessionInfo sessioninfo)
 {
     ProcessingDateBusiness _pcdBusiness = new ProcessingDateBusiness();
     UserBusiness _userBusiness = new UserBusiness();
     MA_PROCESS_DATE processdate;
     MA_USER user;
     try
     {
         processdate = _pcdBusiness.Get();
         if (processdate == null)
             throw new UIPException(new Exception(), "Process date data not found!");
         if (processdate.FLAG_RECONCILE.HasValue && processdate.FLAG_RECONCILE.Value == true)
         {
             user = _userBusiness.GetByID(sessioninfo, processdate.LOG.MODIFYBYUSERID.Value);
             return new { Result = "UNAVAILBLE", Message = string.Format("Please wait. System is on processing by {0}", user != null ? user.NAME : string.Empty) };
         }
         else
         {
             //processdate.FLAG_RECONCILE = true;
             //processdate.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
             //processdate.LOG.MODIFYDATE = DateTime.Now;
             //_pcdBusiness.Update(sessioninfo, processdate);
             return new { Result = "AVAILBLE", Message = string.Empty };
         }
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }