public async Task <HttpResponseMessage> Delete(MemberPromotionViewModel postedViewModel) { int branchId = IdentityConfig.GetBranchId(User); var entities = await businessService.RemoveAsync(branchId, postedViewModel.MemberId); if (entities.ReturnStatus == false) { return(CreateErrorResponse(entities)); } return(Request.CreateResponse(HttpStatusCode.OK, entities)); }
public async Task <HttpResponseMessage> GetMemberPromotionList4ManagerAsync(int month, int year) { var branchId = IdentityConfig.GetBranchId(User); var result_biz = await businessService.LoadMemberPromotionListAsync(branchId, month, year, new[] { ReviewPromotionStepEnum.Initial, ReviewPromotionStepEnum.Manager }); if (result_biz.ReturnStatus == false) { return(CreateErrorResponse(result_biz)); } var mapper = GetMapper(); var result = mapper.Map <List <MemberPromotion>, List <MemberPromotionManagerViewModel> >(result_biz.ResultValue); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public async Task <HttpResponseMessage> ReleaseManagerStep1() { int branchId = IdentityConfig.GetBranchId(User); IBusinessResult entities = await businessService.ProceedMemberPromotionAsync(PromotionReviewStatusEnum.WaitingForStep1BranchManagerReview , PromotionReviewStatusEnum.ReleasedStep1ByBranchManager , branchId); if (entities.ReturnStatus == false) { return(CreateErrorResponse(entities)); } return(Request.CreateResponse(HttpStatusCode.OK, entities)); }
public async Task <HttpResponseMessage> GetMemberPromotionAsync(int statusId) { int branchId = IdentityConfig.GetBranchId(User); var result_bizloading = await businessService.LoadAsync(branchId, (PromotionReviewStatusEnum)statusId); if (result_bizloading.ReturnStatus == false) { return(CreateErrorResponse(result_bizloading)); } var mapper = GetMapper(); var result = new List <MemberPromotionViewModel>(); if (result_bizloading.ResultValue != null) { result = mapper.Map <List <MemberPromotion>, List <MemberPromotionViewModel> >(result_bizloading.ResultValue); } return(CreateSuccessedListResponse(result)); }
public async Task <HttpResponseMessage> GetBranchPromotionReleasedByCEO() { int branchId = IdentityConfig.GetBranchId(User); IBusinessResultValue <BranchPromotion> result_bizloading = await businessService.LoadBranchPromotionAsync(branchId, PromotionReviewStatusEnum.ReleasedByCEO); if (result_bizloading.ReturnStatus == false) { return(CreateErrorResponse(result_bizloading)); } var mapper = GetMapper(); var result = new BranchPromotionViewModel(); if (result_bizloading.ResultValue != null) { result = mapper.Map <BranchPromotion, BranchPromotionViewModel>(result_bizloading.ResultValue); } else { result.PromotionReviewStatusId = 0; } return(CreateViewModelResponse(result, result_bizloading)); }
public async Task <HttpResponseMessage> GetBranchPromotionDetailForStep1BranchManager() { int branchId = IdentityConfig.GetBranchId(User); var entities = await businessService.LoadBranchPromotionAsync(branchId, PromotionReviewStatusEnum.WaitingForStep1BranchManagerReview); if (entities.ReturnStatus == false) { return(CreateErrorResponse(entities)); } var result = new List <BranchPromotionDetailViewModel>(); if (entities.ResultValue != null) { result = new List <BranchPromotionDetailViewModel>() { new BranchPromotionDetailViewModel() { BranchId = branchId, BranchName = entities.ResultValue?.Branch.Name, GoalTypeId = 1, GoalTypeTitle = "پورسانت تامین کننده", PromotionReviewStatusId = (int)entities.ResultValue?.PromotionReviewStatusId, TotalFinalPromotion = entities.ResultValue?.SupplierPromotion ?? 0, PositionPromotions = null, Month = entities.ResultValue?.Month ?? 0, Year = entities.ResultValue?.Year ?? 0, }, new BranchPromotionDetailViewModel() { BranchId = branchId, BranchName = entities.ResultValue?.Branch.Name, GoalTypeId = 4, GoalTypeTitle = "پورسانت ترمیمی", PromotionReviewStatusId = (int)entities.ResultValue?.PromotionReviewStatusId, TotalFinalPromotion = entities.ResultValue?.CompensatoryPromotion ?? 0, PositionPromotions = null, Month = entities.ResultValue?.Month ?? 0, Year = entities.ResultValue?.Year ?? 0, }, new BranchPromotionDetailViewModel() { BranchId = branchId, BranchName = entities.ResultValue?.Branch.Name, GoalTypeId = 5, GoalTypeTitle = "پورسانت فروش", PromotionReviewStatusId = (int)entities.ResultValue?.PromotionReviewStatusId, TotalFinalPromotion = entities.ResultValue?.TotalSalesPromotion ?? 0, PositionPromotions = null, Month = entities.ResultValue?.Month ?? 0, Year = entities.ResultValue?.Year ?? 0, }, new BranchPromotionDetailViewModel() { BranchId = branchId, GoalTypeId = 2, PromotionReviewStatusId = (int)entities.ResultValue?.PromotionReviewStatusId, BranchName = entities.ResultValue?.Branch.Name, GoalTypeTitle = "پورسانت وصول کل", Month = entities.ResultValue?.Month ?? 0, Year = entities.ResultValue?.Year ?? 0, TotalFinalPromotion = entities.ResultValue?.TotalReceiptPromotion ?? 0, PositionPromotions = (from brgpl in entities.ResultValue?.BranchGoalPromotions where brgpl.Goal.GoalGoodsCategoryTypeId == GoalGoodsCategoryTypeEnum.ReceiptTotalGoal from posi in brgpl.PositionReceiptPromotions select new PositionPromotion { PositionTitle = posi.PositionType.Description, Promotion = posi.Promotion }).ToList() }, new BranchPromotionDetailViewModel() { BranchId = branchId, GoalTypeId = 3, BranchName = entities.ResultValue?.Branch.Name, PromotionReviewStatusId = (int)entities.ResultValue?.PromotionReviewStatusId, GoalTypeTitle = "پورسانت وصول خصوصی", Month = entities.ResultValue?.Month ?? 0, Year = entities.ResultValue?.Year ?? 0, TotalFinalPromotion = entities.ResultValue?.PrivateReceiptPromotion ?? 0, PositionPromotions = (from brgpl in entities.ResultValue?.BranchGoalPromotions where brgpl.Goal.GoalGoodsCategoryTypeId == GoalGoodsCategoryTypeEnum.ReceiptPrivateGoal from posi in brgpl.PositionReceiptPromotions select new PositionPromotion { PositionTitle = posi.PositionType.Description, Promotion = posi.Promotion }).ToList() } }; } return(CreateSuccessedListResponse(result)); }