コード例 #1
0
        public void LoadCommissionType(int?sysNo, EventHandler <RestClientEventArgs <CommissionTypeVM> > callback)
        {
            string relativeUrl = "/CommonService/CommissionType/Load/" + sysNo;

            if (sysNo.HasValue)
            {
                restClient.Query <CommissionType>(relativeUrl, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CommissionTypeVM _viewModel = null;
                    CommissionType entity       = args.Result;
                    if (entity == null)
                    {
                        _viewModel = new CommissionTypeVM();
                    }
                    else
                    {
                        _viewModel = entity.Convert <CommissionType, CommissionTypeVM>();
                    }
                    callback(obj, new RestClientEventArgs <CommissionTypeVM>(_viewModel, restClient.Page));
                });
            }
        }
コード例 #2
0
        public async Task InsertCommissionType()
        {
            var options = TestHelper.GetDbContext("InsertCommissionType");

            //Given
            var model = new CommissionType()
            {
                Name                     = "1",
                Code                     = "one",
                PolicyTypeId             = Guid.NewGuid(),
                CommissionEarningsTypeId = Guid.NewGuid()
            };

            using (var context = new DataContext(options))
            {
                var service = new CommissionLookupService(context);

                //When
                var result = await service.InsertCommissionType(model);

                //Then
                Assert.True(result.Success);

                var actual = await context.CommissionType.FindAsync(((CommissionType)result.Tag).Id);

                Assert.Equal(model.Name, actual.Name);
                Assert.Equal(model.Code, actual.Code);
                Assert.Equal(model.PolicyTypeId, actual.PolicyTypeId);
                Assert.Equal(model.CommissionEarningsTypeId, actual.CommissionEarningsTypeId);
            }
        }
コード例 #3
0
        public virtual CommissionType Create(CommissionType entity)
        {
            if (ObjectFactory <ICommissionTypeDA> .Instance.IsExistCommissionTypeID(entity.CommissionTypeID))
            {
                throw new BizException(string.Format("返佣金方式编码为{0}的数据已存在!", entity.CommissionTypeID));
            }

            if (ObjectFactory <ICommissionTypeDA> .Instance.IsExistCommissionTypeName(entity.CommissionTypeName))
            {
                throw new BizException(string.Format("返佣金方式名称为{0}的数据已存在!", entity.CommissionTypeName));
            }

            CommissionType tmpObj;

            using (TransactionScope scope = new TransactionScope())
            {
                tmpObj = ObjectFactory <ICommissionTypeDA> .Instance.Create(entity);

                string log = string.Format(@"用户""{0}""增加了系统编号为{1}的返佣金方式。", ServiceContext.Current.UserSysNo, entity.SysNo);
                //ObjectFactory<LogProcessor>.Instance.CreateOperationLog(log, BizLogType.Basic_PayType_Add, (int)BizLogType.Basic_PayType_Add, "8601", ServiceContext.Current.ClientIP);

                scope.Complete();
            }
            return(tmpObj);
        }
コード例 #4
0
        public async Task GetCommissionTypes()
        {
            var type = new CommissionType()
            {
                Id                       = Guid.NewGuid(),
                Name                     = "Name1",
                Code                     = "Code1",
                PolicyTypeId             = Guid.NewGuid(),
                CommissionEarningsTypeId = Guid.NewGuid()
            };

            var types = new List <CommissionType>()
            {
                type
            };

            var service = new Mock <ICommissionLookupService>();

            service.Setup(c => c.GetCommissionTypes())
            .ReturnsAsync(types);

            var controller = new LookupsController(service.Object);

            var result = await controller.CommissionTypes();

            var okResult    = Assert.IsType <OkObjectResult>(result);
            var returnValue = Assert.IsType <List <CommissionType> >(okResult.Value);

            Assert.Same(types, returnValue);
        }
コード例 #5
0
        public InfoRecord[] GetInfoRecords(ITranslationManager tm)
        {
            const string tg      = "Statistics";
            var          records = new List <InfoRecord>
            {
                new InfoRecord
                {
                    Name  = tm.T(tg, "Type"),
                    Value = InstrType.ToString()
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Comment"),
                    Value = Comment
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Digits"),
                    Value = Digits.ToString(CultureInfo.InvariantCulture)
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Point value"),
                    Value = Point.ToString("0.#####")
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Lot size"),
                    Value = LotSize.ToString(CultureInfo.InvariantCulture)
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Spread"),
                    Value = Spread.ToString("F2") + " " + tm.T(tg, "points")
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Swap long"),
                    Value = SwapLong.ToString("F2") + " " + tm.T(tg, SwapType.ToString().ToLower())
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Swap short"),
                    Value = SwapShort.ToString("F2") + " " + tm.T(tg, SwapType.ToString().ToLower())
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Commission"),
                    Value = Commission.ToString("F2") + " " + tm.T(tg, CommissionType.ToString().ToLower())
                },
                new InfoRecord
                {
                    Name  = tm.T(tg, "Slippage"),
                    Value = Slippage.ToString("F2") + " " + tm.T(tg, "points")
                }
            };

            return(records.ToArray());
        }
コード例 #6
0
ファイル: Commission.cs プロジェクト: davidbedok/oeprog2
 public Commission(SecuritiesName securitiesName, int count, int expectedValue, CommissionType type)
 {
     this.securitiesName = securitiesName;
     this.count = count;
     this.expectedValue = expectedValue;
     this.type = type;
     this.done = false;
 }
コード例 #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            CommissionType commissiontype = db.CommissionTypes.Find(id);

            db.CommissionTypes.Remove(commissiontype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #8
0
        public CommissionType QueryCommissionType(int sysNo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("QueryCommissionType");

            cmd.SetParameterValue("@SysNo", sysNo);
            CommissionType item = cmd.ExecuteEntity <CommissionType>();

            return(item);
        }
コード例 #9
0
        public CommissionType QueryCommissionType(string societyID)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("SocietyCommissionQuery");

            cmd.SetParameterValue("@SocietyID", societyID);
            CommissionType item = cmd.ExecuteEntity <CommissionType>();

            return(item);
        }
コード例 #10
0
ファイル: Order.cs プロジェクト: kris-dyke/sharpdash
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Consumer != null)
         {
             hashCode = hashCode * 59 + Consumer.GetHashCode();
         }
         if (Store != null)
         {
             hashCode = hashCode * 59 + Store.GetHashCode();
         }
         if (Subtotal != null)
         {
             hashCode = hashCode * 59 + Subtotal.GetHashCode();
         }
         if (Tax != null)
         {
             hashCode = hashCode * 59 + Tax.GetHashCode();
         }
         if (EstimatedPickupTime != null)
         {
             hashCode = hashCode * 59 + EstimatedPickupTime.GetHashCode();
         }
         if (IsPickup != null)
         {
             hashCode = hashCode * 59 + IsPickup.GetHashCode();
         }
         if (Categories != null)
         {
             hashCode = hashCode * 59 + Categories.GetHashCode();
         }
         if (IsTaxRemittedByDoordash != null)
         {
             hashCode = hashCode * 59 + IsTaxRemittedByDoordash.GetHashCode();
         }
         if (TaxAmountRemittedByDoordash != null)
         {
             hashCode = hashCode * 59 + TaxAmountRemittedByDoordash.GetHashCode();
         }
         if (CommissionType != null)
         {
             hashCode = hashCode * 59 + CommissionType.GetHashCode();
         }
         if (DeliveryShortCode != null)
         {
             hashCode = hashCode * 59 + DeliveryShortCode.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #11
0
ファイル: Client.cs プロジェクト: davidbedok/oeprog2
 public void addCommission(Securities securities, int count, int expectedValue, CommissionType type)
 {
     Commission commisson = new Commission(securities.Name, count, expectedValue, type);
     if (type == CommissionType.Buy && money < commisson.value() )
     {
         throw new NotEnoughMoneyException("Client hasn't got enough money to buy securities. (" + securities + ", count: " + count + ", expectedValue: " + expectedValue + ")." + this.ToString());
     }
     this.commissions.Add(commisson);
     securities.bind(new ValueChangeHandler(this, commisson, securities));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "CommissionTypeId,Name,Value,IsPercentage")] CommissionType commissiontype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(commissiontype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(commissiontype));
 }
コード例 #13
0
 /// <summary>
 /// Create a new (empty) tranche.
 /// </summary>
 /// <param name="commissionScheduleId"></param>
 public CommissionTranche(Guid commissionScheduleId)
 {
     this.commissionScheduleId = commissionScheduleId;
     this.commissionTrancheId  = Guid.Empty;
     this.commissionType       = new CommissionType();
     this.commissionUnit       = new CommissionUnit();
     this.endRange             = 0m;
     this.startRange           = 0m;
     this.value = 0m;
 }
コード例 #14
0
        public ActionResult Create([Bind(Include = "CommissionTypeId,Name,Value,IsPercentage")] CommissionType commissiontype)
        {
            if (ModelState.IsValid)
            {
                db.CommissionTypes.Add(commissiontype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(commissiontype));
        }
コード例 #15
0
        public async Task All()
        {
            var commissionType = new CommissionType()
            {
                Id                       = Guid.NewGuid(),
                Name                     = "Name1",
                Code                     = "Code1",
                PolicyTypeId             = Guid.NewGuid(),
                CommissionEarningsTypeId = Guid.NewGuid()
            };
            var commissionEarningsType = new CommissionEarningsType()
            {
                Id = Guid.NewGuid(), Name = "Name3"
            };
            var commissionStatementTemplateFieldName = new CommissionStatementTemplateFieldName()
            {
                Id = Guid.NewGuid().ToString(), Name = "Name7"
            };

            var commissionTypes = new List <CommissionType>()
            {
                commissionType
            };
            var commissionEarningsTypes = new List <CommissionEarningsType>()
            {
                commissionEarningsType
            };
            var commissionStatementTemplateFieldNames = new List <CommissionStatementTemplateFieldName>()
            {
                commissionStatementTemplateFieldName
            };

            var service = new Mock <ICommissionLookupService>();

            service.Setup(c => c.GetCommissionTypes()).ReturnsAsync(commissionTypes);
            service.Setup(c => c.GetCommissionEarningsTypes()).ReturnsAsync(commissionEarningsTypes);
            service.Setup(c => c.GetCommissionStatementTemplateFieldNames()).Returns(commissionStatementTemplateFieldNames);

            var controller = new LookupsController(service.Object);

            var result = await controller.All();

            var okResult    = Assert.IsType <OkObjectResult>(result);
            var returnValue = Assert.IsType <api.Controllers.Commission.Lookups.Dto.Lookups>(okResult.Value);

            var all = new api.Controllers.Commission.Lookups.Dto.Lookups()
            {
                CommissionTypes         = commissionTypes,
                CommissionEarningsTypes = commissionEarningsTypes,
                CommissionStatementTemplateFieldNames = commissionStatementTemplateFieldNames,
            };

            Assert.NotStrictEqual(all, returnValue);
        }
コード例 #16
0
 /// <summary>
 /// Create a new CommissionTranche based on a commission tranche row from the DataModel.
 /// </summary>
 /// <param name="commissionTrancheRow">The row to base this commission tranche on.</param>
 public CommissionTranche(CommissionTrancheRow commissionTrancheRow)
 {
     this.commissionScheduleId = commissionTrancheRow.CommissionScheduleId;
     this.commissionTrancheId  = commissionTrancheRow.CommissionTrancheId;
     this.commissionType       = commissionTrancheRow.CommissionTypeRow.CommissionTypeCode;
     this.commissionUnit       = commissionTrancheRow.CommissionUnitRow.CommissionUnitCode;
     this.endRange             = commissionTrancheRow.IsEndRangeNull()? null : (Decimal?)commissionTrancheRow.EndRange;
     this.rowVersion           = commissionTrancheRow.RowVersion;
     this.startRange           = commissionTrancheRow.StartRange;
     this.value = commissionTrancheRow.Value;
 }
コード例 #17
0
 /// <summary>
 /// Create a new CommissionTranche based on a commission tranche row from the DataModel.
 /// </summary>
 /// <param name="commissionTranche">The commission tranche to base this new tranche on.</param>
 public CommissionTranche(CommissionTranche commissionTranche)
 {
     this.commissionScheduleId = commissionTranche.CommissionScheduleId;
     this.commissionTrancheId  = commissionTranche.CommissionTrancheId;
     this.commissionType       = commissionTranche.CommissionType;
     this.commissionUnit       = commissionTranche.CommissionUnit;
     this.rowVersion           = commissionTranche.RowVersion;
     this.startRange           = commissionTranche.StartRange;
     this.endRange             = commissionTranche.EndRange;
     this.value = commissionTranche.Value;
 }
コード例 #18
0
        public async Task <IActionResult> InsertCommissionType([FromBody] CommissionType model)
        {
            var result = await LookupService.InsertCommissionType(model);

            if (!result.Success)
            {
                return(BadRequest(result.ValidationFailures));
            }

            return(Ok(result));
        }
コード例 #19
0
        public CommissionType Update(CommissionType entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("UpdatePayType");

            //cmd.SetParameterValue<CommissionType>(entity);
            //cmd.SetParameterValue("@IsNet", entity.IsNet.GetHashCode());
            //cmd.SetParameterValue("@IsPayWhenRecv", entity.IsPayWhenRecv.GetHashCode());
            //cmd.SetParameterValue("@IsOnlineShow", entity.IsOnlineShow.GetHashCode());
            //cmd.SetParameterValue("@NetPayType", entity.NetPayType.GetHashCode());
            //cmd.SetParameterValue("@CompanyCode", "8601");

            return(cmd.ExecuteEntity <CommissionType>());
        }
コード例 #20
0
        // GET: /CommissionType/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CommissionType commissiontype = db.CommissionTypes.Find(id);

            if (commissiontype == null)
            {
                return(HttpNotFound());
            }
            return(View(commissiontype));
        }
コード例 #21
0
        private CommissionTypeEntity MapCommissionTypeModelToEntity(CommissionType model, CommissionTypeEntity entity = null)
        {
            if (entity == null)
            {
                entity = new CommissionTypeEntity();
            }

            entity.Name                     = model.Name;
            entity.Code                     = model.Code;
            entity.PolicyTypeId             = model.PolicyTypeId.Value;
            entity.CommissionEarningsTypeId = model.CommissionEarningsTypeId.Value;

            return(entity);
        }
コード例 #22
0
        public virtual CommissionType Update(CommissionType entity)
        {
            CommissionType tmpObj;

            using (TransactionScope scope = new TransactionScope())
            {
                tmpObj = ObjectFactory <ICommissionTypeDA> .Instance.Update(entity);

                string log = string.Format(@"用户""{0}""编辑了系统编号为{1}的返佣金方式。", ServiceContext.Current.UserSysNo, entity.SysNo);
                //ObjectFactory<LogProcessor>.Instance.CreateOperationLog(log, BizLogType.Basic_PayType_Update, (int)BizLogType.Basic_PayType_Update, "8601", ServiceContext.Current.ClientIP);

                scope.Complete();
            }
            return(tmpObj);
        }
コード例 #23
0
ファイル: StockExchange.cs プロジェクト: davidbedok/oeprog2
 public void createCommission(String clientName, SecuritiesName securitiesName, int count, int expectedValue, CommissionType type)
 {
     Client client = this.find(clientName);
     Securities securities = this.find(securitiesName);
     if (client != null && securities != null)
     {
         if (type == CommissionType.Buy && securities.Value < expectedValue)
         {
             throw new InvalidCommissionException("Cannot create " + type + " commission, 'cos the expectedValue is greater than the actual (" + securities + ", expectedValue: " + expectedValue + ").");
         }
         else if (type == CommissionType.Sale && securities.Value > expectedValue) {
             throw new InvalidCommissionException("Cannot create " + type + " commission, 'cos the expectedValue is lower than the actual (" + securities + ", expectedValue: " + expectedValue + ").");
         }
         client.addCommission(securities, count, expectedValue, type);
     }
 }
コード例 #24
0
        public CommissionType Create(CommissionType entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("CreateCommissionType");

            //cmd.SetParameterValue<CommissionType>(entity);
            //cmd.SetParameterValue("@IsNet", entity.IsNet.GetHashCode());
            cmd.SetParameterValue("@CommissionTypeID", entity.CommissionTypeID);
            cmd.SetParameterValue("@CommissionTypeName", entity.CommissionTypeName);
            cmd.SetParameterValue("@CommissionTypeDesc", entity.CommissionTypeDesc);
            cmd.SetParameterValue("@LowerLimit", entity.LowerLimit);
            cmd.SetParameterValue("@UpperLimit", entity.UpperLimit);
            cmd.SetParameterValue("@CommissionRate", entity.CommissionRate);
            cmd.SetParameterValue("@CommissionStatus", entity.CommissionStatus);
            cmd.SetParameterValue("@CommissionOrder", entity.CommissionOrder);
            return(cmd.ExecuteEntity <CommissionType>());
        }
コード例 #25
0
        internal static CommType Convert(CommissionType commissionType)
        {
            switch (commissionType)
            {
            case CommissionType.PerShare:
                return(CommType.PerShare);

            case CommissionType.Percent:
                return(CommType.Percent);

            case CommissionType.Absolute:
                return(CommType.Absolute);

            default:
                throw new NotImplementedException("CommissionType is not supported : " + commissionType);
            }
        }
コード例 #26
0
ファイル: EnumConverter.cs プロジェクト: zhuzhenping/FreeOQ
        internal static CommType Convert(CommissionType commissionType)
        {
            switch (commissionType)
            {
            case CommissionType.PerShare:
                return(CommType.PerShare);

            case CommissionType.Percent:
                return(CommType.Percent);

            case CommissionType.Absolute:
                return(CommType.Absolute);

            default:
                throw new ArgumentException(string.Format("Unsupported CommissionType - {0}", commissionType));
            }
        }
コード例 #27
0
        public async Task UpdateCommissionType()
        {
            var options = TestHelper.GetDbContext("UpdateCommissionType");

            //Given
            var lkp1 = new CommissionTypeEntity {
                Id = Guid.NewGuid(), Name = "1", Code = "aa", PolicyTypeId = Guid.NewGuid(), CommissionEarningsTypeId = Guid.NewGuid()
            };

            using (var context = new DataContext(options))
            {
                context.CommissionType.Add(lkp1);

                context.SaveChanges();
            }

            var model = new CommissionType()
            {
                Id                       = lkp1.Id,
                Name                     = "1 Updated",
                Code                     = "aa Updated",
                PolicyTypeId             = Guid.NewGuid(),
                CommissionEarningsTypeId = Guid.NewGuid()
            };

            using (var context = new DataContext(options))
            {
                var service = new CommissionLookupService(context);

                //When
                var result = await service.UpdateCommissionType(model);

                //Then
                Assert.True(result.Success);

                var actual = await context.CommissionType.FindAsync(model.Id);

                Assert.Equal(model.Name, actual.Name);
                Assert.Equal(model.Code, actual.Code);
                Assert.Equal(model.PolicyTypeId, actual.PolicyTypeId);
                Assert.Equal(model.CommissionEarningsTypeId, actual.CommissionEarningsTypeId);
            }
        }
コード例 #28
0
        public async Task <Result> InsertCommissionType(CommissionType model)
        {
            var validator = new CommissionTypeValidator(_context, true);
            var result    = validator.Validate(model).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = MapCommissionTypeModelToEntity(model);
            await _context.CommissionType.AddAsync(entity);

            await _context.SaveChangesAsync();

            model.Id   = entity.Id;
            result.Tag = model;

            return(result);
        }
コード例 #29
0
        public async Task <Result> UpdateCommissionType(CommissionType model)
        {
            var validator = new CommissionTypeValidator(_context, false);
            var result    = validator.Validate(model).GetResult();

            if (!result.Success)
            {
                return(result);
            }

            var entity = await _context.CommissionType.FindAsync(model.Id);

            if (entity == null)
            {
                return(new Result());
            }

            entity = MapCommissionTypeModelToEntity(model, entity);
            await _context.SaveChangesAsync();

            return(result);
        }
コード例 #30
0
ファイル: CommissionManager.cs プロジェクト: 453495181/Agents
        /// <summary>
        /// 添加佣金
        /// </summary>
        private async Task AddCommissionAsync(Order order, CommissionType type, Agent agent)
        {
            if (agent == null)
            {
                return;
            }
            decimal commission = 0;

            switch (type)
            {
            case CommissionType.Level1:
                //commission = ConfigHelper.GetConfigString("CommissionLevel1").ToDecimal();
                commission = 15;
                break;

            case CommissionType.Level2:
                //commission = ConfigHelper.GetConfigString("CommissionLevel2").ToDecimal();
                commission = 10;
                break;

            case CommissionType.Level3:
                //commission = ConfigHelper.GetConfigString("CommissionLevel3").ToDecimal();
                commission = 5;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            var model = new Commission();

            model.Init();
            model.Money   = order.Money * commission / 100;
            model.Type    = type;
            model.State   = CommissionState.UnPayed;
            model.AgentId = agent.Id;
            model.OrderId = order.Id;
            await CommissionRepository.AddAsync(model);
        }
コード例 #31
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            View view = this.BindingInflate(Resource.Layout.fragment_daily_commission, null);

            CommissionType commissionType = CommissionType.DailyCommission;

            if (this.Arguments != null)
            {
                commissionType = (CommissionType)this.Arguments.GetInt(FragmentCommissionSummary.CommissionTypeBundleKey);
                string month = this.Arguments.GetString(FragmentCommissionSummary.CurrentMonthBundleKey);
                _currentMonth = DateTime.Parse(month);
            }

            DailyCommissionViewModel vm = new DailyCommissionViewModel(this._currentMonth);

            if (commissionType == CommissionType.DailyCommission)
            {
                vm.FirstColLabel    = GetString(Resource.String.commissions_date);
                vm.SecondColLabel   = GetString(Resource.String.commissions_sale);
                vm.SummaryLabel     = GetString(Resource.String.total_commission_daily);;
                vm.NoDataMessage    = GetString(Resource.String.commissions_no_sales_made);
                vm.CommissionType   = CommissionType.DailyCommission;
                vm.SecondColVisible = true;
            }
            else if (commissionType == CommissionType.QualityCommission)
            {
                vm.FirstColLabel = GetString(Resource.String.commissions_month);
                // vm.SecondColLabel = GetString(Resource.String.commissions_quality_sale);
                vm.SummaryLabel     = GetString(Resource.String.total_commission_quality);
                vm.NoDataMessage    = GetString(Resource.String.commissions_no_quality_commissions);
                vm.CommissionType   = CommissionType.QualityCommission;
                vm.SecondColVisible = false;
            }

            this.ViewModel = vm;

            return(view);
        }
コード例 #32
0
 public TravelAgentBuilder(TravelAgentIndicator ind, string iataId, CommissionType t,
                           decimal commissionAmount, string givenName, string familyName, string businessAddress1,
                           string businessAddress2, string businessCity, string businessState, string businessZIP,
                           string businessNation, string businessPhoneNumber, string businessFAXNumber,
                           string businessEmailAddress)
 {
     _ind                  = ind;
     _iataId               = iataId;
     _t                    = t;
     _commAmt              = commissionAmount;
     _givenName            = givenName;
     _familyName           = familyName;
     _businessAddress1     = businessAddress1;
     _businessAddress2     = businessAddress2;
     _businessCity         = businessCity;
     _businessState        = businessState;
     _businessZIP          = businessZIP;
     _businessNation       = businessNation;
     _businessPhoneNumber  = businessPhoneNumber;
     _businessFAXNumber    = businessFAXNumber;
     _businessEmailAddress = businessEmailAddress;
 }
コード例 #33
0
        public async Task UpdateCommissionType()
        {
            var type = new CommissionType()
            {
                Id                       = Guid.NewGuid(),
                Name                     = "Name1",
                Code                     = "Code1",
                PolicyTypeId             = Guid.NewGuid(),
                CommissionEarningsTypeId = Guid.NewGuid()
            };

            var service = new Mock <ICommissionLookupService>();

            var result = new Result()
            {
                Success = true
            };

            CommissionType updated = null;

            service.Setup(c => c.UpdateCommissionType(It.IsAny <CommissionType>()))
            .Callback((CommissionType i) =>
            {
                updated = i;
            })
            .ReturnsAsync(result);

            var controller = new LookupsController(service.Object);

            var actual = await controller.UpdateCommissionType(type.Id.Value, type);

            Assert.Same(type, updated);

            var okResult    = Assert.IsType <OkObjectResult>(actual);
            var returnValue = Assert.IsType <Result>(okResult.Value);

            Assert.Same(result, returnValue);
        }
コード例 #34
0
		protected void EmitFilled(Order order, double price, int quantity, CommissionType commissionType, double commission)
		{
			this.provider.EmitExecutionReport(order, price, quantity, EnumConverter.Convert(commissionType), commission);
		}
コード例 #35
0
		internal static CommType Convert(CommissionType commissionType)
		{
			switch (commissionType)
			{
			case CommissionType.PerShare:
				return CommType.PerShare;
			case CommissionType.Percent:
				return CommType.Percent;
			case CommissionType.Absolute:
				return CommType.Absolute;
			default:
				throw new NotImplementedException("CommissionType is not supported : " + commissionType);
			}
		}
コード例 #36
0
ファイル: EnumConverter.cs プロジェクト: heber/FreeOQ
		internal static CommType Convert(CommissionType commissionType)
		{
			switch (commissionType)
			{
				case CommissionType.PerShare:
					return CommType.PerShare;
				case CommissionType.Percent:
					return CommType.Percent;
				case CommissionType.Absolute:
					return CommType.Absolute;
				default:
					throw new ArgumentException(string.Format("Unsupported CommissionType - {0}", commissionType));
			}
		}