Beispiel #1
0
        //public static object CreateBondInstruments(SessionInfo sessioninfo, MA_INSTRUMENT record)
        //{
        //    try
        //    {
        //        InstrumentBusiness _instrumentBusiness = new InstrumentBusiness();
        //        ILookupValuesRepository _lookupvaluesRepository = RepositorySesssion.GetRepository();
        //        record.ID = Guid.NewGuid();
        //        record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE ? false : true;
        //        record.PRODUCT_ID = _lookupvaluesRepository.ProductRepository.GetByLabel(ProductCode.BOND.ToString()).ID;
        //        record.LOG.INSERTDATE = DateTime.Now;
        //        record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
        //        var addedRecord = _instrumentBusiness.Create(sessioninfo, record);
        //        return new { Result = "OK", Record = addedRecord };
        //    }
        //    catch (Exception ex)
        //    {
        //        return new { Result = "ERROR", Message = ex.Message };
        //    }
        //}
        public static object Update(SessionInfo sessioninfo, MA_INSTRUMENT record)
        {
            try
            {
                InstrumentBusiness _instrumentBusiness = new InstrumentBusiness();
                ILookupValuesRepository _lookupvaluesRepository = RepositorySesssion.GetRepository();
                MA_PRODUCT product = _lookupvaluesRepository.ProductRepository.GetByID(record.PRODUCT_ID);

                ProductCode eProduct = (ProductCode)Enum.Parse(typeof(ProductCode), product.LABEL.Replace(" ", string.Empty));

                record.LABEL = record.LABEL.ToUpper();
                record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE ? false : true;
                record.FLAG_FIXED = record.FLAG_FIXED == null || !record.FLAG_FIXED.Value ? false : true;

                if (eProduct != ProductCode.BOND)
                {
                    record.INS_MKT = null;
                    record.ISSUER = null;
                    record.LOT_SIZE = null;
                    record.COUPON = null;
                    record.MATURITY_DATE = null;
                    record.CAL_METHOD = null;
                    record.FLAG_FIXED = null;
                    record.COUPON_FREQ_TYPE_ID = null;
                }

                record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
                record.LOG.MODIFYDATE = DateTime.Now;
                var addedRecord = _instrumentBusiness.Update(sessioninfo, record, eProduct);
                return new { Result = "OK" };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
 public void UpdateTest()
 {
     InstrumentBusiness target = new InstrumentBusiness(); // TODO: Initialize to an appropriate value
     SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value
     MA_INSTRUMENT instrument = null; // TODO: Initialize to an appropriate value
     MA_INSTRUMENT expected = null; // TODO: Initialize to an appropriate value
     MA_INSTRUMENT actual;
     actual = target.Update(sessioninfo, instrument);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }