Пример #1
0
        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 };
            }
        }
Пример #2
0
 public static object CreateCtpyLimit(MA_CTPY_LIMIT record)
 {
     return CounterpartyUIP.CreateCtpyLimit(SessionInfo, record);
 }
Пример #3
0
        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 };
            }
        }
Пример #4
0
 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 };
     }
 }