Exemplo n.º 1
0
 public BranchPromotionBR(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     When(x => x.PromotionReviewStatusId == PromotionReviewStatusEnum.WaitingForStep1BranchManagerReview, () =>
     {
     });
 }
Exemplo n.º 2
0
 public GoalNonFulfillmentPercentBS(NeutrinoUnitOfWork unitOfWork,
                                    AbstractValidator <GoalNonFulfillmentPercent> validator
                                    )
     : base(unitOfWork)
 {
     this.validator = validator;
 }
Exemplo n.º 3
0
 public SimpleEntityModifer(NeutrinoUnitOfWork unitOfWork
                            , AbstractValidator <TEntity> validator = null)
     : base(unitOfWork)
 {
     dataRepository = unitOfWork.GetRepository <TEntity>();
     this.validator = validator;
 }
Exemplo n.º 4
0
        public FulfillmentPercentBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(entity => entity.BranchId)
            .NotNull()
            .WithMessage(".مرکز مشخص نشده است");

            RuleFor(entity => entity.ManagerFulfillmentPercent)
            .GreaterThanOrEqualTo(0)
            //.LessThan(100)
            .WithMessage(".لطفا عددی بزرگتر از صفر برای درصد مشمول رییس مشخص نماید");

            RuleFor(entity => entity.ManagerFulfillmentPercent)
            .GreaterThanOrEqualTo(0)
            .WithMessage(".لطفا عددی بزرگتر از صفر برای درصد فروشنده مشخص نماید");

            RuleFor(entity => entity.ManagerReachedPercent)
            .GreaterThanOrEqualTo(0)
            //.LessThan(100)
            .WithMessage(".لطفا عددی بزرگتر از صفر برای درصد معیار رییس مشخص کنید");

            RuleFor(entity => entity.Month)
            .NotNull()
            .WithMessage(".لطفا ماه را مشخص نماید");

            RuleFor(entity => entity.Year)
            .NotNull()
            .WithMessage(".لطفا سال را مشخص نماید");
        }
Exemplo n.º 5
0
 public MemberPromotionBS(NeutrinoUnitOfWork unitOfWork
                          , AbstractValidator <MemberPromotion> memberShareValidator
                          , AbstractValidator <List <MemberPromotion> > lstValidationRules) : base(unitOfWork)
 {
     validationRules         = memberShareValidator;
     this.lstValidationRules = lstValidationRules;
 }
Exemplo n.º 6
0
 public GoalStepBS(IEntityCreator <GoalStep> goalStepCreator
                   , IEntityModifer <GoalStep> goalStepUpdater
                   , IEntityEraser <GoalStep> goalStepEraser
                   , NeutrinoUnitOfWork unitOfWork) : base(unitOfWork)
 {
     this.goalStepCreator = goalStepCreator;
     this.goalStepUpdater = goalStepUpdater;
     this.goalStepEraser  = goalStepEraser;
 }
Exemplo n.º 7
0
 public OrgStructureShareDTOBR(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     RuleFor(x => x.Branch)
     .NotNull()
     .WithMessage("مرکز را مشخص کنید");
     RuleForEach(x => x.Items)
     .SetValidator(new OrgStructureShareBR());
 }
Exemplo n.º 8
0
        private static async void PromotionCalculate(string arg)
        {
            NeutrinoUnitOfWork            unitOfWork = NinjectContainer.Resolve <NeutrinoUnitOfWork>();
            AbstractValidator <Promotion> validator  = NinjectContainer.Resolve <AbstractValidator <Promotion> >();

            PromotionBS promotionBS = new PromotionBS(unitOfWork, validator);

            var promotion = await unitOfWork.PromotionDataService.FirstOrDefaultAsync(where : x => x.StatusId == Entities.PromotionStatusEnum.InProcessQueue);

            IBusinessResult result;

            if (arg.Length != 0)
            {
                if (promotion != null)
                {
                    if (arg.ToLower() == "sup")
                    {
                        Console.WriteLine("Start Supplier goales calualation.");
                        result = await promotionBS.CalculateSupplierGoalsAsync(promotion);

                        Console.WriteLine("Finish Supplier goales calualation.");
                    }
                    else if (arg.ToLower() == "rec")
                    {
                        Console.WriteLine("Start Receipt goales calualation ");
                        result = await promotionBS.CalculateReceiptGoalsAsync(promotion);

                        Console.WriteLine("Finish Receipt goales calualation ");
                    }
                    else if (arg.ToLower() == "all")
                    {
                        Console.WriteLine("Start all goales calualation.");
                        result = await promotionBS.CalculateGoalsAsync(promotion);

                        Console.WriteLine("Finish all goales calualation.");
                    }
                    else if (arg.ToLower() == "sal")
                    {
                        Console.WriteLine("Start branch sales calualation.");
                        result = await promotionBS.CalculateBranchSalesAsync(promotion);

                        Console.WriteLine("Finish branch sales calualation.");
                    }
                }
                else
                {
                    Console.WriteLine("There is not any promotion entity.");
                }
            }
            else
            {
                Console.WriteLine("Please specify the arg,the arge can be 'both : calculate Sales & Reciept','rec : just Reciept' and 'sal : just Sales");
            }
        }
Exemplo n.º 9
0
        public MemberPenaltyCollectionBR(NeutrinoUnitOfWork unitOfWork) : base(unitOfWork)
        {
            RuleFor(x => x.Count)
            .NotEmpty()
            .WithMessage("اطلاعاتی جهت ثبت وجود ندارد")
            .Configure(x => x.CascadeMode = CascadeMode.StopOnFirstFailure);
            RuleFor(x => x)
            .Must(x => lessOrEqualTotalPromotion(x))
            .WithMessage("جمع پورسانت پرسنل باید برابر با پورسانت مرکز باشد ");

            RuleForEach(x => x)
            .SetValidator(x => new MemberPenaltyBR());
        }
Exemplo n.º 10
0
        public GoalNonFulfillmentPercentBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x.Percent)
            .NotNull()
            .WithMessage("درصد را مشخص نماید")
            .LessThanOrEqualTo(100)
            .WithMessage("درصد بیشتر از مقدار صد نمیتواند باشد");

            RuleFor(x => x)
            .Must(x => x.GoalNonFulfillmentBranches.Count != 0)
            .WithMessage("مراکز را مشخص نماید")
            .Must(x => !checkedForUniqueBranchAndPercent(x))
            .WithMessage(x => getMessage(x));
        }
Exemplo n.º 11
0
        public GoalStepBusinessRules(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x)
            .Must(checkNotUsedGoal)
            .WithMessage("با توجه به اینکه با هدف انتخاب شده محاسبات انجام شده است ،امکان اصلاح وجود ندارد")
            .Configure(x => x.CascadeMode = CascadeMode.StopOnFirstFailure);


            RuleFor(entity => entity.ComputingTypeId)
            .NotNull()
            .WithMessage(".اطلاعات نحوه محاسبه مشخص نشده است");

            RuleFor(entity => entity.ComputingValue)
            .NotEmpty()
            .WithMessage(".مقدار پایه مشخص نشده است");

            RuleFor(x => x)
            .Must(x => checkSequentialValue(x))
            .WithMessage("مقدار پایه باید از مقدار پایه قبلی بزرگتر باشد");

            RuleFor(entity => entity.GoalId)
            .NotNull()
            .WithMessage(".هدف مشخص نشده است");

            RuleFor(x => x.Items)
            .Must(x => x.Count != 0)
            .WithMessage(".پاداش و جریمه هر دو نامشخص میباشد شما باید یکی از این دو ایتم را انتخاب کنید");

            RuleForEach(x => x.Items)
            .SetValidator(new GoalStepItemInfoRules());


            When(x => x.GoalTypeId == GoalTypeEnum.Supplier, () =>
            {
                RuleFor(x => x.IncrementPercent)
                .NotNull()
                .WithMessage("لطفا درصد افزایش را مشخص نماید");
            });

            RuleFor(entity => entity)
            .Must(entity => !IsDuplicate(entity))
            .WithMessage(".امکان ثبت اطلاعات تکراری وجود ندارد");
        }
Exemplo n.º 12
0
        public QuantityConditionBR(NeutrinoUnitOfWork unitOfWork) : base(unitOfWork)
        {
            RuleFor(x => x.GoalId)
            .NotEqual(0)
            .WithMessage("اطلاعات هدف موجود نمیباشد");

            RuleFor(x => x)
            .Must(x => x.Quantity != 0)
            .WithMessage("تعداد ایتم را مشخص نماید")
            .Must(entity => checkedLessThanGoodsCount(entity))
            .WithMessage("تعداد ایتم باید از تعداد داروهای موجود در هدف کمتر یا مساوی باشد");

            When(x => x.QuantityConditionTypeId == QuantityConditionTypeEnum.DependedOnGoal, () =>
            {
                RuleFor(x => x.ExtraEncouragePercent)
                .NotEmpty()
                .WithMessage("درصد پاداش اضافی را مشخص نماید");
            });
        }
Exemplo n.º 13
0
        public MemberPromotionBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x.BranchPromotionId)
            .NotEmpty()
            .WithMessage(".اطلاعات مربوط به پورسانت مرکز مشخص نشده است");

            RuleFor(x => x.MemberId)
            .NotEmpty()
            .WithMessage(".اطلاعات مربوط به پرسنل مشخص نشده است");


            RuleFor(x => x)
            .Must(x => checkTotalAssigned(x))
            .WithMessage(".مقدار مشخص شده برای پرسنل نباید از جمع پورسانت مرکز بیشتر باشد");
            RuleFor(x => x)
            .Must(x => !isDuplicate(x))
            .WithMessage("اطلاعات وارد شده تکراری میباشد");
        }
Exemplo n.º 14
0
        public ServiceJob()
        {
            dataSyncConfiguration = ConfigurationManager.GetSection("serviceSection") as DataSyncServiceSection;
            if (dataSyncConfiguration == null)
            {
                throw new Exception("It wasn't found any configuration section");
            }

            serviceSetting = dataSyncConfiguration.Services[serviceName];

            yearMonth = new YearMonth();

            PersianCalendar pcal = new PersianCalendar();

            currentYear  = pcal.GetYear(DateTime.Now);
            currentMonth = pcal.GetMonth(DateTime.Now);

            unitOfWork = NinjectContainer.Resolve <NeutrinoUnitOfWork>();
        }
Exemplo n.º 15
0
        public MemberPromotionCollectionBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x.Count)
            .NotEmpty()
            .WithMessage("اطلاعاتی جهت ثبت وجود ندارد")
            .Configure(x => x.CascadeMode = CascadeMode.StopOnFirstFailure);

            RuleFor(x => x)
            .Must(x => checkTotalSalesPromotion(x))
            .WithMessage("مجموع پورسانت پرسنل برای تامین کننده نمیتواند از پورسانت تامین کننده مرکز بیشتر باشد");

            RuleFor(x => x)
            .Must(x => checkTotalReceiptPromotion(x))
            .WithMessage("مجموع پورسانت پرسنل برای وصول نمیتواند از پورسانت وصول مرکز بیشتر باشد");

            RuleFor(x => x)
            .Must(x => checkTotalSellerPromotion(x))
            .WithMessage("مجموع پورسانت عوامل فروش نمیتواند از جمع پورسانت عوامل بیشتر باشد");
        }
Exemplo n.º 16
0
        public PromotionBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x.StartDate)
            .IsValidDateTime()
            .WithMessage(".تاریخ محاسبه پورسانت مشخص نمیباشد");

            RuleFor(x => x)
            .Must(entity => !unitOfWork.PromotionDataService.Exist(where : x => x.StartDate == entity.StartDate && entity.EndDate == entity.EndDate))
            .WithMessage("اطلاعات وارد شده تکراری میباشد");

            RuleFor(x => x)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .Must(entity => CheckExistBranchSales(entity))
            .WithMessage("اطلاعات فروش مراکز وجود ندارد");

            RuleFor(x => x)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .Must(x => CheckGoal(x, GoalGoodsCategoryTypeEnum.TotalSalesGoal))
            .WithMessage("هدف کل برای ماه و سال انتخاب شده مشخص نشده است")
            .Must(x => CheckTotalFulfillPromotions(x))
            .WithMessage("مقادیر 'درصد از هدف کل ' برای هدف کل مشخص نشده است");
            //.Must(x => CheckBranchGoal(x, GoalGoodsCategoryTypeEnum.TotalSalesGoal))
            //.WithMessage("سهم مراکز به صورت کامل در هدف کل تعریف نشده است");


            RuleFor(x => x)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .Must(x => CheckGoal(x, GoalGoodsCategoryTypeEnum.ReceiptTotalGoal))
            .WithMessage("هدف وصول برای ماه و سال انتخاب شده مشخص نشده است")
            .Must(x => CheckGoal(x, GoalGoodsCategoryTypeEnum.ReceiptPrivateGoal))
            .WithMessage("هدف وصول برای ماه و سال انتخاب شده مشخص نشده است");


            //.Must(x => CheckBranchGoal(x, GoalGoodsCategoryTypeEnum.ReceiptTotalGoal))
            //.WithMessage("سهم مراکز به صورت کامل در هدف وصول کل تعریف نشده است")
            //.Must(x => CheckBranchGoal(x, GoalGoodsCategoryTypeEnum.ReceiptPrivateGoal))
            //.WithMessage("سهم مراکز به صورت کامل در هدف وصول خصوصی تعریف نشده است");
        }
Exemplo n.º 17
0
        public UserBusinessRules(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(x => x.Email)
            .NotNull()
            .WithMessage(".آدرس ایمیل مشخص نشده است");

            RuleFor(x => x.LastName)
            .NotNull()
            .WithMessage("نام خانوادگی مشخص نشده است");

            RuleFor(entity => entity.PhoneNumber)
            .NotNull()
            .WithMessage(".شماره موبایل مشخص نشده است");

            RuleFor(entity => entity.Name)
            .NotNull()
            .WithMessage(".نام مشخص نشده است");

            RuleFor(entity => entity.UserName)
            .NotNull()
            .WithMessage(".نام کاربری مشخص نشده است");

            RuleFor(entity => entity.Roles)
            .Must(x => x.Count != 0)
            .WithMessage(".نقش کاربری مشخص نشده است");

            RuleFor(entity => entity)
            .Must(entity => !IsEmailDuplicate(entity))
            .WithMessage(".ایمیل انتخاب شده قبلا در سیستم ثبت شده است");

            RuleFor(entity => entity)
            .Must(entity => !IsUserNameDuplicate(entity))
            .WithMessage(".نام کاربری انتخاب شده قبلا در سیستم ثبت شده است");

            RuleFor(entity => entity)
            .Must(entity => !IsMobileDuplicate(entity))
            .WithMessage(".شماره موبایل انتخاب شده قبلا در سیستم ثبت شده است");
        }
Exemplo n.º 18
0
        public GoalGoodsCategoryBR(NeutrinoUnitOfWork unitOfWork)
            : base(unitOfWork)
        {
            RuleFor(gCat => gCat.Name)
            .NotEmpty()
            .WithMessage(".نام گروه دسته دارویی مشخص نشده است");

            RuleFor(gCat => gCat.GoalGoodsCategoryTypeId)
            .NotEmpty()
            .WithMessage(".نوع دسته دارویی مشخص نشده است");
            When(x => x.GoalGoodsCategoryTypeId != GoalGoodsCategoryTypeEnum.TotalSalesGoal, () =>
            {
                RuleFor(gCat => gCat.GoodsCollection)
                .Must(coll => coll == null || coll.Count > 0)
                .WithMessage("دارو(ها) دسته دارویی را مشخص نماید");
            });

            //When(x => x.GoalTypeId == GoalTypeEnum.Distributor, () => {

            //    RuleFor(x => x)
            //    .Must(entity => !IsDuplicate(entity))
            //    .WithMessage(".امکان ثبت دسته دارویی تکراری وجود ندارد");
            //});
        }
Exemplo n.º 19
0
 public CostCoefficientBS(AbstractValidator <CostCoefficient> validator
                          , NeutrinoUnitOfWork unitOfWork) : base(unitOfWork)
 {
     this.validator = validator;
 }
Exemplo n.º 20
0
 public FulfillmentPercentRules(NeutrinoUnitOfWork unitOfWork)
 {
     RuleForEach(entity => entity)
     .SetValidator(x => new FulfillmentPercentBR(unitOfWork));
 }
Exemplo n.º 21
0
 public ManagementJob()
 {
     unitOfWork = NinjectContainer.Resolve <NeutrinoUnitOfWork>();
 }
Exemplo n.º 22
0
 public BranchReceiptGoalPercentBS(NeutrinoUnitOfWork unitOfWork
                                   , AbstractValidator <BranchReceiptGoalPercentDTO> validator)
     : base(unitOfWork)
 {
     this.validator = validator;
 }
Exemplo n.º 23
0
 public OrgStructureShareBS(NeutrinoUnitOfWork unitOfWork
                            , AbstractValidator <OrgStructureShareDTO> valdiator)
     : base(unitOfWork)
 {
     this.valdiator = valdiator;
 }
Exemplo n.º 24
0
 public SellerPromotionBS(NeutrinoUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
Exemplo n.º 25
0
 public SimpleEntityEraser(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     dataRepository = unitOfWork.GetRepository <TEntity>();
 }
Exemplo n.º 26
0
 public NeutrinoValidator(NeutrinoUnitOfWork unitOfWork)
     : base()
 {
     this.unitOfWork = unitOfWork;
 }
Exemplo n.º 27
0
 public GeneralEntityCounter(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
 }
Exemplo n.º 28
0
 public BranchReceiptBS(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
 }
Exemplo n.º 29
0
 public OrgStructureBS(NeutrinoUnitOfWork unitOfWork
                       , AbstractValidator <List <OrgStructure> > validator)
     : base(unitOfWork)
 {
     this.validator = validator;
 }
Exemplo n.º 30
0
 public PositionMappingBS(NeutrinoUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
 }