public void CreateLimitProductTest()
 {
     LimitProductBusiness target = new LimitProductBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     MA_LIMIT_PRODUCT limitproduct = null; // TODO: Initialize to an appropriate value
     MA_LIMIT_PRODUCT expected = null; // TODO: Initialize to an appropriate value
     MA_LIMIT_PRODUCT actual;
     actual = target.CreateLimitProduct(sessioninfo, limitproduct);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void GetLimitProductByFilterTest()
 {
     LimitProductBusiness target = new LimitProductBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     string strproduct = string.Empty; // TODO: Initialize to an appropriate value
     string strlimit = 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_LIMIT_PRODUCT> expected = null; // TODO: Initialize to an appropriate value
     List<MA_LIMIT_PRODUCT> actual;
     actual = target.GetLimitProductByFilter(sessioninfo, strproduct, strlimit, startIndex, count, sorting);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #3
0
 public static object Update(SessionInfo sessioninfo, MA_LIMIT_PRODUCT record)
 {
     try
     {
         LimitProductBusiness _limitproductbusiness = new LimitProductBusiness();
         record.LIMIT_ID = record.LIMIT_ID;
         record.PRODUCT_ID = record.PRODUCT_ID;
         var added = _limitproductbusiness.UpdateLimitProduct(sessioninfo, record);
         return new { Result = "OK" };
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }
Example #4
0
        public static object GetLimitproductByFilter(SessionInfo sessioninfo, string strproduct, string strlimit, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                //Return result to jTable
                LimitProductBusiness _limitproductbusiness = new LimitProductBusiness();

                //Get data from database
                List<MA_LIMIT_PRODUCT> limitproduct = _limitproductbusiness.GetLimitProductByFilter(sessioninfo, strproduct, strlimit, jtSorting);

                //Return result to jTable
                return new { Result = "OK",
                             Records = jtPageSize > 0 ? limitproduct.Skip(jtStartIndex).Take(jtPageSize).ToList() : limitproduct,
                             TotalRecordCount = limitproduct.Count };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
 public void LimitProductBusinessConstructorTest()
 {
     LimitProductBusiness target = new LimitProductBusiness();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Example #6
0
        public List<RepoReportModel> GetRepoReport(SessionInfo sessioninfo, string strReportDate, string strSource, string strCtpy)
        {
            try
            {
                DateTime dteReport;
                LimitCheckBusiness _limitBusiness = new LimitCheckBusiness();
                DealBusiness _dealBusiness = new DealBusiness();
                LimitProductBusiness _limitProductBusiness = new LimitProductBusiness();
                LookupBusiness _lookupBusiness = new LookupBusiness();
                StaticDataBusiness _staticBusiness = new StaticDataBusiness();
                List<RepoReportModel> reports = new List<RepoReportModel>();
                RepoReportModel report;
                Guid guCtpyID = 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);
                }

                Guid guProductID = _lookupBusiness.GetProductByUsercode(ProductCode.REPO.ToString()).ID;
                MA_PCCF rev_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("84f608c9-8b58-48eb-a6dd-a5407548784a"));
                MA_PCCF rep_gov_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("28b24b19-e81d-4f82-a2f0-7c834ee3f91c"));
                MA_PCCF rep_soe_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("7014b05e-198f-4f62-94b0-1d54322efbca"));

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

                foreach (LimitCheckModel limit in limits)
                {
                    report = new RepoReportModel();

                    report.PROCESSING_DATE = limit.PROCESSING_DATE;
                    report.SNAME = limit.SNAME;
                    report.LIMIT_LABEL = limit.LIMIT_LABEL;
                    report.GEN_AMOUNT = limit.GEN_AMOUNT;
                    report.TEMP_AMOUNT = limit.TEMP_AMOUNT;
                    //report.AMOUNT = limit.AMOUNT;
                    report.EXPIRE_DATE = limit.EXPIRE_DATE;
                    report.ORIGINAL_KK_CONTRIBUTE = limit.ORIGINAL_KK_CONTRIBUTE;
                    report.DEAL_CONTRIBUTION = 0;
                    report.REV_AMOUNT = report.AVAILABLE / rev_pccf.C1.Value * 100;
                    report.REP_GOV_5_AMOUNT = report.AVAILABLE / rep_gov_pccf.C5.Value * 100;
                    report.REP_GOV_10_AMOUNT = report.AVAILABLE / rep_gov_pccf.C10.Value * 100;
                    report.REP_GOV_20_AMOUNT = report.AVAILABLE / rep_gov_pccf.C20.Value * 100;
                    report.REP_GOV_20s_AMOUNT = report.AVAILABLE / rep_gov_pccf.more20.Value * 100;
                    report.REP_SOE_5_AMOUNT = report.AVAILABLE / rep_soe_pccf.C5.Value * 100;
                    report.REP_SOE_10_AMOUNT = report.AVAILABLE / rep_soe_pccf.C10.Value * 100;
                    report.REP_SOE_20_AMOUNT = report.AVAILABLE / rep_soe_pccf.C20.Value * 100;
                    report.REP_SOE_20s_AMOUNT = report.AVAILABLE / rep_soe_pccf.more20.Value * 100;

                    reports.Add(report);
                }

                return reports;
            }

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