public static ReportKeyValueListResponseFloatDto GetAgentBossSellerReportDelired(AgentBossReportSellerDeliveredRequest request) { ReportKeyValueListResponseFloatDto response = new ReportKeyValueListResponseFloatDto(); try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { response.message = MessagesSource.GetMessage("invalid.agentboss"); return(response); } SellerReportDeliveredRequest req = new SellerReportDeliveredRequest { entity_id = request.driver_id, periodical_data = request.periodical_data, for_role = UserType.AgentBoss }; return(ReportsServices.GetSellerReportSellerReportDelivered(req)); } catch (Exception e) { response.MakeExceptionResponse(e); return(response); } }
public static GetAgentBossDetailsResponse GetDetails(GetAgentBossDetailsRequest request) { GetAgentBossDetailsResponse response = new GetAgentBossDetailsResponse(); AgentBoss agentBoss = null; try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); response.agent_boss_details = new AgentBossMoreDetailsDto(); response.agent_boss_details.agent_boss_id = agentBoss.AbosID; response.agent_boss_details.profile_image = ImagePathService.agentBossImagePath + agentBoss.ProfileImage; response.agent_boss_details.agent_boss_name = agentBoss.OwnerName; response.agent_boss_details.mobile_number = agentBoss.MobileNumber; response.agent_boss_details.agent_boss_email = agentBoss.Email; response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("admin.boss.details"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static ABossReviewReasonResponse GetReviewReasonByAgentBoss(ABossReviewReasonRequest request) { ABossReviewReasonResponse response = new ABossReviewReasonResponse(); try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } response.service_reason_rating = new List <ABossReviewReasonDto>(); using (OrderDao dao = new OrderDao()) { int periodRange = Common.GetAppSetting <int>(APPSETTING_REPORTPERIOD_RANGE, 6); var reportDetails = dao.GetReviewReasonByAgentBoss(request.user_id, request.driver_id, request.periodical_data, periodRange); if (reportDetails != null && reportDetails.Count > 0) { response.service_reason_rating = reportDetails.Select(r => new ABossReviewReasonDto { key = r.ReasonText, value = r.Value.ToDecimal() }).ToList(); } response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("boss.rating.report"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static ResponseDto ChangeProfile(ChangeProfileAgentBossRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); agentBoss.OwnerName = request.agent_boss_name; //agentBoss.MobileNumber = request.mobile_number; //agentBoss.ProfileImage = request.profile_image; //Commented bcz image is uploading as multipart agentBoss.Email = request.agent_boss_email; dao.Update(agentBoss); response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("profile.changed"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static GetDriverNameResponse GetDriversByAgentBoss(GetDriverNameRequest request) { GetDriverNameResponse response = new GetDriverNameResponse(); try { if (request.is_boss) { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } } else { if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response)) { return(response); } } response.driver_names = new List <GetDriverNameDto>(); using (OrderDao dao = new OrderDao()) { var driverList = dao.GetDriversByAgentBoss(request.is_boss ? request.user_id : 0); if (driverList != null && driverList.Count > 0) { response.driver_names = driverList.Select(r => new GetDriverNameDto { driver_id = r.DrvrID, driver_name = r.DriverName }).ToList(); } response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("boss.drv.listed"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static ABossSellerRptResponse GetSellerReportByAgentBoss(ABossSellerRptRequest request) { var productIdList = request.products.Select(x => x.product_id).ToList(); ABossSellerRptResponse response = new ABossSellerRptResponse(); try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } response.sales_details = new List <ABossSellerRptDto>(); using (OrderDao dao = new OrderDao()) { int periodRange = Common.GetAppSetting <int>(APPSETTING_REPORTPERIOD_RANGE, 6); if (productIdList != null && productIdList.Count > 0) { string productIds = string.Join(",", productIdList.Select(n => n.ToString()).ToArray()); var sellerRpt = dao.GetSellerReportByAgentBoss(request.user_id, request.total_type, request.periodical_data, periodRange, productIds); if (sellerRpt != null && sellerRpt.Count > 0) { response.sales_details = sellerRpt.Select(r => new ABossSellerRptDto { key = r.Period, value = r.Value.ToDecimal() }).ToList(); } } response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("boss.sales.report"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static ResponseDto ChangePassword(ChangePasswordAgentBossRequest request) { ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; string oldPasswordHash = TokenGenerator.GetHashedPassword(request.old_password, 49); try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { MakeNouserResponse(response); return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); if (agentBoss.Password == oldPasswordHash) { agentBoss.Password = TokenGenerator.GetHashedPassword(request.new_password, 49); dao.Update(agentBoss); response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("password.changed"); return(response); } } response.code = 1; response.has_resource = 0; response.message = MessagesSource.GetMessage("exception"); return(response); } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public InfoBannerResponse GetInfoBanner(GetInfoBannerRequest request) { InfoBannerResponse response = new InfoBannerResponse(); try { switch (request.user_type) { case (int)UserType.SuperUser: if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response)) { response.message = MessagesSource.GetMessage("invalid.super.user"); return(response); } break; case (int)UserType.AgentBoss: if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } break; case (int)UserType.AgentAdmin: if (!AgentAdminServices.CheckAdmin(request.user_id, request.auth_token, response)) { return(response); } break; case (int)UserType.Driver: if (!DriverServices.CheckAuthDriver(request.user_id, request.auth_token)) { _userServices.MakeNouserResponse(response); return(response); } break; case (int)UserType.Consumer: if (!_userServices.CheckAuthUser(request.user_id, request.auth_token)) { _userServices.MakeNouserResponse(response); return(response); } break; default: { response.has_resource = 0; response.code = 1; response.message = MessagesSource.GetMessage("invalid.user.type"); return(response); } } using (PromoDao dao = new PromoDao()) { List <PromoInfo> bList = dao.GetInfoBanners(); if (bList.Count <= 0) { response.has_resource = 1; response.code = 0; response.message = MessagesSource.GetMessage("promo.info.not.found"); return(response); } InfoBannerDto[] promoDtos = new InfoBannerDto[bList.Count()]; for (int i = 0; i < bList.Count; i++) { InfoBannerDto dto = new InfoBannerDto(); PromoHelper.CopyFromEntity(dto, bList[i]); promoDtos[i] = dto; } response.info_banners = promoDtos; response.has_resource = 1; response.code = 0; response.message = MessagesSource.GetMessage("promo.info.found"); } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }
public GetBannerResponse GetBanner(GetBannerRequest request) { GetBannerResponse response = new GetBannerResponse(); try { switch (request.user_type) { case (int)UserType.SuperUser: if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response)) { response.message = MessagesSource.GetMessage("invalid.super.user"); return(response); } break; case (int)UserType.AgentBoss: if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } break; case (int)UserType.AgentAdmin: if (!AgentAdminServices.CheckAdmin(request.user_id, request.auth_token, response)) { return(response); } break; case (int)UserType.Driver: if (!DriverServices.CheckAuthDriver(request.user_id, request.auth_token)) { _userServices.MakeNouserResponse(response); return(response); } break; case (int)UserType.Consumer: if (!_userServices.CheckAuthUser(request.user_id, request.auth_token)) { _userServices.MakeNouserResponse(response); return(response); } break; default: { response.has_resource = 0; response.code = 1; response.message = MessagesSource.GetMessage("invalid.user.type"); return(response); } } using (PromoDao dao = new PromoDao()) { GetBannerResponse dto = new GetBannerResponse(); PromoBanner promo = dao.FindByCategoty(request.category); if (promo == null) { response.has_resource = 1; response.code = 0; response.message = MessagesSource.GetMessage("promo.banner.not.found"); return(response); } if (promo != null) { PromoHelper.CopyFromEntity(dto, promo); } response = dto; response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("promo.banner.found"); } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }