コード例 #1
0
        public ConsumerService()
        {
            try
            {
                var coreBuilder = new CoreBuilder();
                coreBuilder.builder.RegisterModule <AutofacModules>();
                coreBuilder.UserRedis(ConfigurationManager.ConnectionStrings["RedisConnectionString"].ConnectionString);

                coreBuilder.OnStarting(builder =>
                {
                    builder.RegisterType <MemoryEventBusService>().As <IMemoryEventBusService>().InstancePerMatchingLifetimeScope();
                    builder.RegisterType <DistributedEventBusService>().As <IDistributedEventBusService>().InstancePerMatchingLifetimeScope();
                });

                //拆分DLL后需要注册,需要注入的DLL
                Assembly[] asm = Utils.GetAllAssembly("MutualClass.*.dll").ToArray();
                coreBuilder.Build(asm);
                CoreBuilderWork.LifetimeScope.Resolve <IDistributedEventBusService>();

                //var _MutualClassRewardQueueService = CoreBuilderWork.LifetimeScope.Resolve<MutualClassRewardQueueService>();
                //_MutualClassRewardQueueService.imq_onReceive_test();
            }
            catch (Exception ex)
            {
                _Logger.Error("Autofac注册异常", ex);
            }
            InitializeComponent();
        }
コード例 #2
0
        public dynamic GetInfo(int Id)
        {
            CoreBuilder model = new CoreBuilder();

            try
            {
                model = _coreBuilderService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                model.Errors.Add("Generic", "Error : " + ex);
            }

            return(Json(new
            {
                model.Id,
                model.Name,
                model.Category,
                model.UoMId,
                UoM = _uomService.GetObjectById(model.UoMId).Name,
                model.BaseSku,
                model.SkuUsedCore,
                model.SkuNewCore,
                UsedCoreQuantity = _itemService.GetObjectById(model.UsedCoreItemId).Quantity,
                NewCoreQuantity = _itemService.GetObjectById(model.NewCoreItemId).Quantity,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
 public ConfluxBuffBuilders(IStatFactory statFactory)
 {
     Igniting  = new BuffBuilder(statFactory, CoreBuilder.Create("IgnitingConflux"));
     Shocking  = new BuffBuilder(statFactory, CoreBuilder.Create("ShockingConflux"));
     Chilling  = new BuffBuilder(statFactory, CoreBuilder.Create("ChillingConflux"));
     Elemental = new BuffBuilder(statFactory, CoreBuilder.Create("ElementalConflux"));
 }
コード例 #4
0
        public RecoveryOrder VQuantityIsInStock(RecoveryOrder recoveryOrder, ICoreIdentificationDetailService _coreIdentificationDetailService,
                                                IRecoveryOrderDetailService _recoveryOrderDetailService, ICoreBuilderService _coreBuilderService, IItemService _itemService,
                                                IWarehouseItemService _warehouseItemService)
        {
            IList <RecoveryOrderDetail> details = _recoveryOrderDetailService.GetObjectsByRecoveryOrderId(recoveryOrder.Id);
            IDictionary <int, int>      ValuePairItemIdQuantity = new Dictionary <int, int>();

            foreach (var detail in details)
            {
                CoreIdentificationDetail coreIdentificationDetail = _coreIdentificationDetailService.GetObjectById(detail.CoreIdentificationDetailId);
                CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(coreIdentificationDetail.CoreBuilderId);
                Item        item        = (coreIdentificationDetail.MaterialCase == Core.Constants.Constant.MaterialCase.New) ?
                                          _coreBuilderService.GetNewCore(coreBuilder.Id) : _coreBuilderService.GetUsedCore(coreBuilder.Id);
                WarehouseItem warehouseItem = _warehouseItemService.FindOrCreateObject(recoveryOrder.WarehouseId, item.Id);
                if (ValuePairItemIdQuantity.ContainsKey(warehouseItem.Id))
                {
                    ValuePairItemIdQuantity[warehouseItem.Id] += 1;
                }
                else
                {
                    ValuePairItemIdQuantity.Add(warehouseItem.Id, 1);
                }
            }

            foreach (var ValuePair in ValuePairItemIdQuantity)
            {
                WarehouseItem warehouseItem = _warehouseItemService.GetObjectById(ValuePair.Key);
                if (warehouseItem.Quantity < ValuePair.Value)
                {
                    recoveryOrder.Errors.Add("Generic", "Stock quantity core item tidak boleh kurang dari jumlah di dalam recovery order");
                    return(recoveryOrder);
                }
            }
            return(recoveryOrder);
        }
コード例 #5
0
        public CoreBuilder SoftDeleteObject(CoreBuilder coreBuilder, IItemService _itemService, IRollerBuilderService _rollerBuilderService,
                                            ICoreIdentificationDetailService _coreIdentificationDetailService, IRecoveryOrderDetailService _recoveryOrderDetailService,
                                            IRecoveryAccessoryDetailService _recoveryAccessoryDetailService, IWarehouseItemService _warehouseItemService,
                                            IStockMutationService _stockMutationService, IItemTypeService _itemTypeService)
        {
            Item UsedCore = _itemService.GetObjectById(coreBuilder.UsedCoreItemId);
            Item NewCore  = _itemService.GetObjectById(coreBuilder.NewCoreItemId);

            if (_itemService.GetValidator().ValidDeleteLegacyObject(UsedCore, _stockMutationService, _itemTypeService, _warehouseItemService) &&
                _itemService.GetValidator().ValidDeleteLegacyObject(UsedCore, _stockMutationService, _itemTypeService, _warehouseItemService))
            {
                if (_validator.ValidDeleteObject(coreBuilder, _coreIdentificationDetailService, _rollerBuilderService))
                {
                    _itemService.GetRepository().SoftDeleteObject(UsedCore);
                    _itemService.GetRepository().SoftDeleteObject(NewCore);
                    _repository.SoftDeleteObject(coreBuilder);
                }
            }
            else
            {
                if (UsedCore.Errors.Count() > 0)
                {
                    coreBuilder.Errors.Add(UsedCore.Errors.First().Key, UsedCore.Errors.First().Value);
                }
                else if (NewCore.Errors.Count() > 0)
                {
                    coreBuilder.Errors.Add(NewCore.Errors.First().Key, NewCore.Errors.First().Value);
                }
                else
                {
                    coreBuilder.Errors.Add("Generic", "Item tidak dapat di hapus");
                }
            }
            return(coreBuilder);
        }
コード例 #6
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public UserDepartmentController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IUserDepartmentMgr = coreBuilder.GetManager <IUserDepartmentMgr>(CoreBuilder.IUSERDEPARTMENTMGR);

            this.UserDepartmentWrapper = UserDepartmentWrapper.GetInstance();
        }
コード例 #7
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public AddressController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IAddressMgr = coreBuilder.GetManager <IAddressMgr>(CoreBuilder.IADDRESSMGR);

            SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #8
0
        public void SourceBuildsToCorrectResults()
        {
            var damageTypes =
                Mock.Of <IDamageTypeBuilder>(b => b.BuildDamageTypes() == new[] { DamageType.Fire, DamageType.Cold });
            var sut = new AilmentBuilder(new StatFactory(), CoreBuilder.Create(Ailment.Bleed));

            var statBuilder = sut.Source(damageTypes);
            var results     = statBuilder.Build(default).ToList();
コード例 #9
0
        public IStatBuilder DamageHasKeyword(DamageSource damageSource, IKeywordBuilder keyword)
        {
            var coreBuilder = new CoreStatBuilderFromCoreBuilder <Keyword>(
                CoreBuilder.Proxy(keyword, (ps, b) => b.Build(ps)),
                (e, k) => StatFactory.MainSkillPartDamageHasKeyword(e, k, damageSource));

            return(new StatBuilder(StatFactory, coreBuilder));
        }
コード例 #10
0
        public IStatBuilder AdditionalLevels(ISkillBuilder skill)
        {
            var coreBuilder = new CoreStatBuilderFromCoreBuilder <string>(
                CoreBuilder.Proxy(skill, (ps, b) => b.Build(ps).Id),
                (e, t) => StatFactory.FromIdentity($"Gem.AdditionalLevels.{t}", e, typeof(int)));

            return(new StatBuilder(StatFactory, coreBuilder));
        }
コード例 #11
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public EventGroupController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IEventGroupMgr = coreBuilder.GetManager <IEventGroupMgr>(CoreBuilder.IEVENTGROUPMGR);

            SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #12
0
 public CoreBuilder VNameNotEmpty(CoreBuilder coreBuilder)
 {
     if (String.IsNullOrEmpty(coreBuilder.Name) || coreBuilder.Name.Trim() == "")
     {
         coreBuilder.Errors.Add("Name", "Tidak boleh kosong");
     }
     return(coreBuilder);
 }
コード例 #13
0
        private IStatBuilder AdditionalLevels(string identityInfix, IGemTagBuilder gemTag, Func <BuildParameters, string, string> buildIdentitySuffix)
        {
            var coreBuilder = new CoreStatBuilderFromCoreBuilder <string>(
                CoreBuilder.Proxy(gemTag, (ps, b) => buildIdentitySuffix(ps, b.Build(ps))),
                (e, t) => StatFactory.FromIdentity($"Gem.AdditionalLevels{identityInfix}.{t}", e, typeof(int)));

            return(new StatBuilder(StatFactory, coreBuilder));
        }
コード例 #14
0
        /// <summary>
        /// Default constructor
        /// </summary>
        private CarWrapper()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.ICarMgr       = coreBuilder.GetManager <ICarMgr>(CoreBuilder.ICARMGR);
            this.ITransportMgr = coreBuilder.GetManager <ITransportMgr>(CoreBuilder.ITRANSPORTMGR);
            this.IEventMgr     = coreBuilder.GetManager <IEventMgr>(CoreBuilder.IEVENTMGR);
        }
コード例 #15
0
        /// <summary>
        /// Default constructor
        /// </summary>
        private AssistantWrapper()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IAssistantMgr = coreBuilder.GetManager <IAssistantMgr>(CoreBuilder.IASSISTANTMGR);
            this.IEventMgr     = coreBuilder.GetManager <IEventMgr>(CoreBuilder.IEVENTMGR);

            this.EmailWrapper = EmailWrapper.GetInstance();
        }
コード例 #16
0
ファイル: Startup.cs プロジェクト: mqkfc123/InjectApm
        public void OnInvoke()
        {
            var coreBuilder = new CoreBuilder();

            coreBuilder.OnStarting(builder =>
            {
                builder.RegisterModule <GrpcModule>();
            });
            coreBuilder.Build();
        }
コード例 #17
0
 public ChargeTypeBuilders(IStatFactory statFactory)
 {
     Endurance     = new ChargeTypeBuilder(statFactory, CoreBuilder.Create(ChargeType.Endurance));
     Frenzy        = new ChargeTypeBuilder(statFactory, CoreBuilder.Create(ChargeType.Frenzy));
     Power         = new ChargeTypeBuilder(statFactory, CoreBuilder.Create(ChargeType.Power));
     ChanceToSteal =
         StatBuilderUtils.DamageRelatedFromIdentity(statFactory, "ChanceToStealACharge", typeof(int)).WithHits;
     Rage       = new ChargeTypeBuilder(statFactory, CoreBuilder.Create(ChargeType.Rage));
     RageEffect = StatBuilderUtils.FromIdentity(statFactory, "RageEffect", typeof(double));
 }
コード例 #18
0
        /// <summary>
        /// Default constructor
        /// </summary>
        private InvitationWrapper()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IInvitationMgr = coreBuilder.GetManager <IInvitationMgr>(CoreBuilder.IINVITATIONMGR);
            this.IAssistantMgr  = coreBuilder.GetManager <IAssistantMgr>(CoreBuilder.IASSISTANTMGR);
            this.IEventMgr      = coreBuilder.GetManager <IEventMgr>(CoreBuilder.IEVENTMGR);

            this.EmailWrapper = EmailWrapper.GetInstance();
        }
コード例 #19
0
        public RollerBuilder VHasCoreBuilder(RollerBuilder rollerBuilder, ICoreBuilderService _coreBuilderService)
        {
            CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(rollerBuilder.CoreBuilderId);

            if (coreBuilder == null)
            {
                rollerBuilder.Errors.Add("CoreBuilderId", "Tidak terasosiasi dengan coreBuilder");
            }
            return(rollerBuilder);
        }
コード例 #20
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public InvitationController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IInvitationMgr = coreBuilder.GetManager <IInvitationMgr>(CoreBuilder.IINVITATIONMGR);

            this.InvitationWrapper = InvitationWrapper.GetInstance();

            SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #21
0
        public CoreBuilder VIsInCoreIdentificationDetail(CoreBuilder coreBuilder, ICoreIdentificationDetailService _coreIdentificationDetailService)
        {
            IList <CoreIdentificationDetail> details = _coreIdentificationDetailService.GetObjectsByCoreBuilderId(coreBuilder.Id);

            if (details.Any())
            {
                coreBuilder.Errors.Add("Generic", "Tidak boleh terasosiasi dengan Core Identification Detail");
            }
            return(coreBuilder);
        }
コード例 #22
0
        public CoreBuilder VHasUoM(CoreBuilder coreBuilder, IUoMService _uomService)
        {
            UoM uom = _uomService.GetObjectById(coreBuilder.UoMId);

            if (uom == null)
            {
                coreBuilder.Errors.Add("UoMId", "Tidak terasosiasi dengan unit of measurement");
            }
            return(coreBuilder);
        }
コード例 #23
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public PassengerController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IPassengerMgr = coreBuilder.GetManager <IPassengerMgr>(CoreBuilder.IPASSENGERMGR);

            this.PassengerWrapper = PassengerWrapper.GetInstance();

            SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #24
0
 public CoreBuilder VDeleteObject(CoreBuilder coreBuilder, ICoreIdentificationDetailService _coreIdentificationDetailService, IRollerBuilderService _rollerBuilderService)
 {
     VIsInCoreIdentificationDetail(coreBuilder, _coreIdentificationDetailService);
     if (!isValid(coreBuilder))
     {
         return(coreBuilder);
     }
     VIsInRollerBuilder(coreBuilder, _rollerBuilderService);
     return(coreBuilder);
 }
コード例 #25
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TransportController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.ITransportMgr = coreBuilder.GetManager <ITransportMgr>(CoreBuilder.ITRANSPORTMGR);

            this.TransportWrapper = TransportWrapper.GetInstance();

            this.SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #26
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public CarController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.ICarMgr = coreBuilder.GetManager <ICarMgr>(CoreBuilder.ICARMGR);

            this.CarWrapper = CarWrapper.GetInstance();

            this.SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #27
0
        public CoreBuilder VIsInRollerBuilder(CoreBuilder coreBuilder, IRollerBuilderService _rollerBuilderService)
        {
            IList <RollerBuilder> rollerBuilders = _rollerBuilderService.GetObjectsByCoreBuilderId(coreBuilder.Id);

            if (rollerBuilders.Any())
            {
                coreBuilder.Errors.Add("Generic", "Tidak boleh terasosiasi dengan Roller Builder");
            }
            return(coreBuilder);
        }
コード例 #28
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public EventController()
        {
            CoreBuilder coreBuilder = CoreBuilder.GetInstance();

            this.IEventMgr = coreBuilder.GetManager <IEventMgr>(CoreBuilder.IEVENTMGR);

            this.EventWrapper = EventWrapper.GetInstance();

            SystemLogWrapper = SystemLogWrapper.GetInstance();
        }
コード例 #29
0
        public CoreBuilder VHasNewCoreItem(CoreBuilder coreBuilder, IItemService _itemService)
        {
            Item NewCoreItem = _itemService.GetObjectById(coreBuilder.NewCoreItemId);

            if (NewCoreItem == null)
            {
                coreBuilder.Errors.Add("NewCoreItemId", "Tidak terasosiasi dengan Item");
            }
            return(coreBuilder);
        }
コード例 #30
0
        public CoreIdentificationDetail VHasCoreBuilder(CoreIdentificationDetail coreIdentificationDetail, ICoreBuilderService _coreBuilderService)
        {
            CoreBuilder coreBuilder = _coreBuilderService.GetObjectById(coreIdentificationDetail.CoreBuilderId);

            if (coreBuilder == null)
            {
                coreIdentificationDetail.Errors.Add("CoreBuilderId", "Tidak terasosiasi dengan coreBuilder");
            }
            return(coreIdentificationDetail);
        }