public MA_CTPY_LIMIT UpdateCounterpartyLimit(SessionInfo sessioninfo, MA_CTPY_LIMIT counterpartyLimit) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var foundData = unitOfWork.MA_CTPY_LIMITRepository.GetAll().FirstOrDefault(p => p.ID == counterpartyLimit.ID); if (foundData == null) { throw this.CreateException(new Exception(), "Data not found!"); } else { LogBusiness logBusiness = new LogBusiness(); var oldRecord = new{ AMOUNT = foundData.AMOUNT.ToString("#,##0"), FLAG_CONTROL = foundData.FLAG_CONTROL, EXPIRE_DATE = foundData.EXPIRE_DATE }; var newRecord = new { AMOUNT = counterpartyLimit.AMOUNT.ToString("#,##0"), FLAG_CONTROL = counterpartyLimit.FLAG_CONTROL, EXPIRE_DATE = counterpartyLimit.EXPIRE_DATE }; var log = logBusiness.UpdateLogging(sessioninfo, foundData.ID, LimitLogEvent.LIMIT_AUDIT.ToString(), LookupFactorTables.MA_CTPY_LIMIT, oldRecord, newRecord); if (log != null) { unitOfWork.DA_LOGGINGRepository.Add(log); } foundData.ID = counterpartyLimit.ID; foundData.AMOUNT = counterpartyLimit.AMOUNT; foundData.FLAG_CONTROL = counterpartyLimit.FLAG_CONTROL; foundData.EXPIRE_DATE = counterpartyLimit.EXPIRE_DATE; foundData.LOG.MODIFYBYUSERID = counterpartyLimit.LOG.MODIFYBYUSERID; foundData.LOG.MODIFYDATE = DateTime.Now; foundData.LIMIT_ID = counterpartyLimit.LIMIT_ID; unitOfWork.Commit(); } } return(counterpartyLimit); }
public MA_CTPY_LIMIT CreateCounterpartyLimit(SessionInfo sessioninfo, MA_CTPY_LIMIT counterpartyLimit) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { unitOfWork.MA_CTPY_LIMITRepository.Add(counterpartyLimit); unitOfWork.Commit(); } return(counterpartyLimit); }
public void CreateCounterpartyLimitTest() { CounterpartyBusiness target = new CounterpartyBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value MA_CTPY_LIMIT counterpartyLimit = null; // TODO: Initialize to an appropriate value MA_CTPY_LIMIT expected = null; // TODO: Initialize to an appropriate value MA_CTPY_LIMIT actual; actual = target.CreateCounterpartyLimit(sessioninfo, counterpartyLimit); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
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 }); } }
public static object CreateCtpyLimit(SessionInfo sessioninfo, MA_CTPY_LIMIT record) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); record.ID = Guid.NewGuid(); record.EXPIRE_DATE = record.EXPIRE_DATE.Date; //record.FLAG_CONTROL = record.FLAG_CONTROL == null ? false : true; record.LOG.INSERTDATE = DateTime.Now; record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; var addedRecord = _counterpartyBusiness.CreateCounterpartyLimit(sessioninfo, record); return(new { Result = "OK", Record = addedRecord }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object UpdateCtpyLimit(SessionInfo sessioninfo, MA_CTPY_LIMIT record) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); //record.FLAG_CONTROL = record.FLAG_CONTROL == null ? false : true; if (!record.FLAG_CONTROL) { record.AMOUNT = 0; record.EXPIRE_DATE = sessioninfo.Process.CurrentDate; } record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId; record.LOG.MODIFYDATE = DateTime.Now; var updateRecord = _counterpartyBusiness.UpdateCounterpartyLimit(sessioninfo, record); return(new { Result = "OK", Record = updateRecord }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object CreateCtpyLimit(MA_CTPY_LIMIT record) { return(CounterpartyUIP.CreateCtpyLimit(SessionInfo, record)); }