Пример #1
0
        public static object GetByFilter(SessionInfo sessioninfo, string label, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                //Get data from database
                List<MA_COUNTRY> countries = _countryBusiness.GetByFilter(sessioninfo, label, jtSorting);

                //Return result to jTable
                return new
                {
                    Result = "OK",
                    Records = jtPageSize > 0 ? countries.Skip(jtStartIndex).Take(jtPageSize).ToList() : countries,
                    TotalRecordCount = countries.Count
                };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #2
0
        public List <LimitCheckModel> CheckAllCountry(DateTime ProcessingDate, DA_TRN trn, Guid ExcludeID1, Guid ExcludeID2)
        {
            CounterpartyBusiness   _counterpartyBusiness = new CounterpartyBusiness();
            CountryBusiness        _countryBusiness      = new CountryBusiness();
            List <LimitCheckModel> results = new List <LimitCheckModel>();
            LimitCheckModel        result;
            LimitCheckModel        temp = new LimitCheckModel();
            LimitCheckModel        pce  = new LimitCheckModel();
            MA_COUTERPARTY         ctpy = _counterpartyBusiness.GetCounterpartyAll().FirstOrDefault(p => p.ID == trn.CTPY_ID);

            List <LimitCheckModel> sets = GetCountrySETByCriteria(ProcessingDate, ctpy.COUNTRY_ID, "", ExcludeID1, ExcludeID2);
            List <LimitCheckModel> pces = GetCountryPCEByCriteria(ProcessingDate, ctpy.COUNTRY_ID, "", ExcludeID1, ExcludeID2);

            if (pces.Count != 1)
            {
                throw new Exception("Invalid country limit data. Please contact administrator");
            }
            else
            {
                pce = pces.FirstOrDefault();
            }

            MA_COUNTRY_LIMIT temp_limit = _countryBusiness.GetActiveTempByCountryID(ProcessingDate, trn.MATURITY_DATE.Value, ctpy.COUNTRY_ID);

            DateTime dateStart = trn.TRADE_DATE.Value;
            DateTime dateEnd   = trn.FLAG_SETTLE.HasValue && trn.FLAG_SETTLE.Value ? trn.DA_TRN_FLOW.Max(p => p.FLOW_DATE).Value : trn.TRADE_DATE.Value;

            while (dateStart <= dateEnd)
            {
                result = new LimitCheckModel();

                temp = sets.FirstOrDefault(p => p.FLOW_DATE == dateStart);

                result.COUNTRY_LABEL = pce.COUNTRY_LABEL;
                result.COUNTRY_ID    = pce.COUNTRY_ID;
                result.FLAG_CONTROL  = pce.FLAG_CONTROL;
                result.GEN_AMOUNT    = pce.GEN_AMOUNT;
                result.TEMP_AMOUNT   = temp_limit != null ? temp_limit.AMOUNT : 0;
                //result.AMOUNT = pce.AMOUNT + (temp_limit != null ? temp_limit.AMOUNT : 0);
                result.PROCESSING_DATE        = pce.PROCESSING_DATE;
                result.EXPIRE_DATE            = pce.EXPIRE_DATE;
                result.FLOW_DATE              = dateStart;
                result.ORIGINAL_KK_CONTRIBUTE = pce.ORIGINAL_KK_CONTRIBUTE;

                if (temp != null)
                {
                    result.ORIGINAL_KK_CONTRIBUTE = result.ORIGINAL_KK_CONTRIBUTE + temp.ORIGINAL_KK_CONTRIBUTE;
                }

                results.Add(result);

                //if (dateStart.DayOfWeek == DayOfWeek.Friday)
                //    dateStart = dateStart.AddDays(3);
                //else
                dateStart = dateStart.AddDays(1);
            }

            return(results);
        }
Пример #3
0
        public List<LimitCheckModel> CheckAllCountry(DateTime ProcessingDate, DA_TRN trn, Guid ExcludeID1, Guid ExcludeID2)
        {
            CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
            CountryBusiness _countryBusiness = new CountryBusiness();
            List<LimitCheckModel> results = new List<LimitCheckModel>();
            LimitCheckModel result;
            LimitCheckModel temp = new LimitCheckModel();
            LimitCheckModel pce = new LimitCheckModel();
            MA_COUTERPARTY ctpy = _counterpartyBusiness.GetCounterpartyAll().FirstOrDefault(p => p.ID == trn.CTPY_ID);

            List<LimitCheckModel> sets = GetCountrySETByCriteria(ProcessingDate, ctpy.COUNTRY_ID, "", ExcludeID1, ExcludeID2);
            List<LimitCheckModel> pces = GetCountryPCEByCriteria(ProcessingDate, ctpy.COUNTRY_ID, "", ExcludeID1, ExcludeID2);

            if (pces.Count != 1)
                throw new Exception("Invalid country limit data. Please contact administrator");
            else
                pce = pces.FirstOrDefault();

            MA_COUNTRY_LIMIT temp_limit = _countryBusiness.GetActiveTempByCountryID(ProcessingDate, trn.MATURITY_DATE.Value, ctpy.COUNTRY_ID);

            DateTime dateStart = trn.TRADE_DATE.Value;
            DateTime dateEnd = trn.FLAG_SETTLE.HasValue && trn.FLAG_SETTLE.Value ? trn.DA_TRN_FLOW.Max(p => p.FLOW_DATE).Value : trn.TRADE_DATE.Value;

            while (dateStart <= dateEnd)
            {
                result = new LimitCheckModel();

                temp = sets.FirstOrDefault(p => p.FLOW_DATE == dateStart);

                result.COUNTRY_LABEL = pce.COUNTRY_LABEL;
                result.COUNTRY_ID = pce.COUNTRY_ID;
                result.FLAG_CONTROL = pce.FLAG_CONTROL;
                result.GEN_AMOUNT = pce.GEN_AMOUNT;
                result.TEMP_AMOUNT = temp_limit != null ? temp_limit.AMOUNT : 0;
                //result.AMOUNT = pce.AMOUNT + (temp_limit != null ? temp_limit.AMOUNT : 0);
                result.PROCESSING_DATE = pce.PROCESSING_DATE;
                result.EXPIRE_DATE = pce.EXPIRE_DATE;
                result.FLOW_DATE = dateStart;
                result.ORIGINAL_KK_CONTRIBUTE = pce.ORIGINAL_KK_CONTRIBUTE;

                if (temp != null)
                    result.ORIGINAL_KK_CONTRIBUTE = result.ORIGINAL_KK_CONTRIBUTE + temp.ORIGINAL_KK_CONTRIBUTE;

                results.Add(result);

                //if (dateStart.DayOfWeek == DayOfWeek.Friday)
                //    dateStart = dateStart.AddDays(3);
                //else
                dateStart = dateStart.AddDays(1);
            }

            return results;
        }
Пример #4
0
        public static object Create(SessionInfo sessioninfo, MA_COUNTRY record)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();

                record.ID = Guid.NewGuid();
                record.LABEL = record.LABEL.ToUpper();
                record.DESCRIPTION = record.DESCRIPTION.ToUpper();

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

                return new { Result = "OK", Record = addedRecord };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #5
0
        public static object CreateTempLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT record)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();

                record.ID = Guid.NewGuid();
                record.ISTEMP = true;
                record.FLAG_CONTROL = true;
                record.LOG.INSERTDATE = DateTime.Now;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;

                var addedRecord = _countryBusiness.CreateTempLimit(sessioninfo, record);

                return new { Result = "OK", Record = addedRecord };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #6
0
        public static object GetCountryLimitByCountryID(SessionInfo sessioninfo, Guid ID)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                //Get data from database
                List<MA_COUNTRY_LIMIT> limits = _countryBusiness.GetCountryLimitByCountryID(sessioninfo, ID);

                //Return result to jTable
                return new { Result = "OK", Records = limits, TotalRecordCount = limits.Count };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #7
0
        public static object UpdateTempLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT record)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                record.LOG.MODIFYDATE = DateTime.Now;
                record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;

                var updateRecord = _countryBusiness.UpdateTempCountryLimit(sessioninfo, record);

                return new { Result = "OK", Record = updateRecord };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #8
0
        public static object UpdateCountryLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT record)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();

                if (!record.FLAG_CONTROL)
                {
                    record.AMOUNT = 0;
                    record.EFFECTIVE_DATE = sessioninfo.Process.CurrentDate;
                    record.EXPIRY_DATE = sessioninfo.Process.CurrentDate;
                }

                record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
                record.LOG.MODIFYDATE = DateTime.Now;

                var updateRecord = _countryBusiness.UpdateCountryLimit(sessioninfo, record);

                return new { Result = "OK" , Record = updateRecord };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #9
0
        public static object GetTempLimitByFilter(SessionInfo sessioninfo, string strCountry, string strEffDateFrom, string strEffDateTo
                                                   , string strExpDateFrom, string strExpDateTo, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                //Get data from database
                List<MA_COUNTRY_LIMIT> limits = _countryBusiness.GetTempLimitByFilter(sessioninfo, strCountry, strEffDateFrom, strEffDateTo
                                                                                      , strExpDateFrom, strExpDateTo, jtSorting);

                //Return result to jTable
                return new
                {
                    Result = "OK",
                    Records = jtPageSize > 0 ? limits.Skip(jtStartIndex).Take(jtPageSize).ToList() : limits,
                    TotalRecordCount = limits.Count
                };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #10
0
        public static object GetCountryOptions(SessionInfo sessioninfo)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                //Get data from database
                var countries = _countryBusiness.GetCountryAll()
                                            .OrderBy(p => p.LABEL)
                                            .Select(c => new { DisplayText = c.LABEL, Value = c.ID });

                //Return result to jTable
                return new { Result = "OK", Options = countries };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
Пример #11
0
        public static List<DealViewModel> GetPCEDetailData(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strProduct, string strSource)
        {
            try
            {
                ReportBusiness _reportBusiness = new ReportBusiness();
                LookupBusiness _lookupBusiness = new LookupBusiness();
                CountryBusiness _countryBusiness = new CountryBusiness();
                CounterpartyBusiness _ctpyBusiness = new CounterpartyBusiness();

                List<DA_TRN> trns = _reportBusiness.GetPCEDetailReport(sessioninfo, strReportDate, strCtpy, strProduct, strSource);
                List<MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll();
                List<MA_CSA_PRODUCT> csaproducts = _ctpyBusiness.GetCSAProductAll(sessioninfo);
                List<MA_COUNTRY> country = _countryBusiness.GetCountryAll();

                var report = (from trn in trns
                              join ct in country on trn.MA_COUTERPARTY.COUNTRY_ID equals ct.ID
                              join ccy1 in ccys on trn.FIRST.CCY_ID equals ccy1.ID into ljccy1
                              from subccy1 in ljccy1.DefaultIfEmpty()
                              join ccy2 in ccys on trn.SECOND.CCY_ID equals ccy2.ID into ljccy2
                              from subccy2 in ljccy2.DefaultIfEmpty()
                              join csaproduct in csaproducts on new { CTPY_ID = trn.CTPY_ID, PRODUCT_ID = trn.PRODUCT_ID.Value } equals new { CTPY_ID = csaproduct.CSA_AGREEMENT_ID, PRODUCT_ID = csaproduct.PRODUCT_ID } into ljcsa
                              from subcsa in ljcsa.DefaultIfEmpty()
                              select new DealViewModel
                              {
                                  EngineDate = trn.ENGINE_DATE,
                                  DMK_NO = trn.INT_DEAL_NO,
                                  OPICS_NO = trn.EXT_DEAL_NO,
                                  Source = trn.SOURCE == "INT" ? "DMK" : "OPICS",
                                  Product = trn.MA_PRODUCT.LABEL,
                                  Portfolio = trn.MA_PORTFOLIO.LABEL,
                                  TradeDate = trn.TRADE_DATE.Value,
                                  EffectiveDate = trn.START_DATE,
                                  MaturityDate = trn.MATURITY_DATE,
                                  Instrument = trn.MA_INSRUMENT.LABEL,
                                  Counterparty = trn.MA_COUTERPARTY.SNAME,
                                  Notional1 = trn.FIRST.NOTIONAL,
                                  Notional2 = trn.SECOND.NOTIONAL,
                                  FixedFloat1 = !trn.FIRST.FLAG_FIXED.HasValue ? "-" : trn.FIRST.FLAG_FIXED.Value ? trn.FIRST.FLAG_PAYREC + "-FIXED" : trn.FIRST.FLAG_PAYREC + "-FLOAT",
                                  FixedFloat2 = !trn.SECOND.FLAG_FIXED.HasValue ? "-" : trn.SECOND.FLAG_FIXED.Value ? trn.SECOND.FLAG_PAYREC + "-FIXED" : trn.SECOND.FLAG_PAYREC + "-FLOAT",
                                  KKPCCF = trn.KK_PCCF,
                                  KKContribute = trn.KK_CONTRIBUTE,
                                  CCY1 = subccy1 != null ? subccy1.LABEL : "-",
                                  CCY2 = subccy2 != null ? subccy2.LABEL : "-",
                                  CSA = subcsa != null ? "Yes" : "No",
                                  Country = ct.LABEL
                              }).OrderBy(p => p.DMK_NO).ToList();

                return report;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #12
0
        public List<LimitCheckModel> GetCountryReport(SessionInfo sessioninfo, string strReportDate, string strCountry, string strSource, string strStatus)
        {
            try
            {
                DateTime dteReport;
                LimitCheckBusiness _limitBusiness = new LimitCheckBusiness();
                DealBusiness _dealBusiness = new DealBusiness();
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                CountryBusiness _countryBusiness = new CountryBusiness();
                Guid guCountryID = Guid.Empty;
                MA_COUNTRY_LIMIT temp_limit = null;

                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 (_dealBusiness.CountByProcessDate(dteReport) == 0)
                {
                    throw this.CreateException(new Exception(), "No data for selected report date.");
                }

                if (Guid.TryParse(strCountry, out guCountryID))
                {
                    guCountryID = Guid.Parse(strCountry);
                }

                List<LimitCheckModel>  sets = _limitBusiness.GetCountrySETByCriteria(dteReport, guCountryID, strSource, Guid.Empty, Guid.Empty);
                List<LimitCheckModel> pces = _limitBusiness.GetCountryPCEByCriteria(dteReport, guCountryID, strSource, Guid.Empty, Guid.Empty);

                var reports = (from report in sets.Union(pces)
                               join pce in pces on report.COUNTRY_ID equals pce.COUNTRY_ID
                               select new LimitCheckModel
                               {
                                   COUNTRY_LABEL = report.COUNTRY_LABEL,
                                   COUNTRY_ID = report.COUNTRY_ID,
                                   FLAG_CONTROL = report.FLAG_CONTROL,
                                   GEN_AMOUNT = report.AMOUNT,
                                   PROCESSING_DATE = report.PROCESSING_DATE,
                                   EXPIRE_DATE = report.EXPIRE_DATE,
                                   FLOW_DATE = report.FLOW_DATE,
                                   SET_CONTRIBUTE = report.SET_CONTRIBUTE,
                                   PCE_CONTRIBUTE = pce.PCE_CONTRIBUTE
                               }).GroupBy(g => new
                               {
                                   g.COUNTRY_ID,
                                   g.COUNTRY_LABEL,
                                   g.FLAG_CONTROL,
                                   g.GEN_AMOUNT,
                                   g.PROCESSING_DATE,
                                   g.EXPIRE_DATE,
                                   g.FLOW_DATE,
                                   g.PCE_CONTRIBUTE
                               }).Select(s => new LimitCheckModel
                               {
                                   COUNTRY_LABEL = s.Key.COUNTRY_LABEL,
                                   COUNTRY_ID = s.Key.COUNTRY_ID,
                                   FLAG_CONTROL = s.Key.FLAG_CONTROL,
                                   GEN_AMOUNT = s.Key.GEN_AMOUNT,
                                   PROCESSING_DATE = s.Key.PROCESSING_DATE,
                                   EXPIRE_DATE = s.Key.EXPIRE_DATE,
                                   FLOW_DATE = s.Key.FLOW_DATE,
                                   PCE_CONTRIBUTE = s.Key.PCE_CONTRIBUTE,
                                   SET_CONTRIBUTE = s.Sum(x => x.SET_CONTRIBUTE),
                                   ORIGINAL_KK_CONTRIBUTE = s.Key.PCE_CONTRIBUTE + s.Sum(y => y.SET_CONTRIBUTE)
                               }).ToList();

                foreach (var report in reports)
                {
                    temp_limit = _countryBusiness.GetActiveTempByCountryID(sessioninfo.Process.CurrentDate, report.FLOW_DATE, report.COUNTRY_ID);

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

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

                return reports.OrderBy(p => p.COUNTRY_LABEL).ThenBy(t => t.FLOW_DATE).ToList();
            }

            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
Пример #13
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);
            }
        }