Пример #1
0
        public ActionResult WorkerDemandList(int UserID)
        {
            DemandService    demandSer = new DemandService();
            List <DecDemand> list      = demandSer.GetDecDemandListByUserIDAndType(UserID, "WebUser");

            return(View(list));
        }
Пример #2
0
        public async Task Then_The_Item_Is_Created_In_The_Cache_For_Thirty_Minutes(
            ICourseDemand item,
            [Frozen] Mock <ICacheStorageService> cacheStorageService,
            DemandService service)
        {
            //Act
            await service.CreateCacheCourseDemand(item);

            //Assert
            cacheStorageService.Verify(x => x.SaveToCache($"{item.Id}", item, TimeSpan.FromMinutes(30)));
        }
        public async Task Then_If_It_Doesnt_Exist_Null_Is_Returned(
            Guid employerDemandKey,
            [Frozen] Mock <ICacheStorageService> cacheStorageService,
            DemandService service)
        {
            //Arrange
            cacheStorageService.Setup(x => x.RetrieveFromCache <ICourseDemand>(It.IsAny <string>()))
            .ReturnsAsync((ICourseDemand)null);

            //Act
            var actual = await service.GetCachedCourseDemand(employerDemandKey);

            //Assert
            actual.Should().BeNull();
        }
        public async Task Then_The_Item_Is_Retrieved_From_The_Cache(
            Guid employerDemandKey,
            CourseDemandRequest item,
            [Frozen] Mock <ICacheStorageService> cacheStorageService,
            DemandService service)
        {
            //Arrange
            cacheStorageService.Setup(x => x.RetrieveFromCache <CourseDemandRequest>(employerDemandKey.ToString()))
            .ReturnsAsync(item);

            //Act
            var actual = await service.GetCachedCourseDemand(employerDemandKey);

            //Assert
            actual.Should().BeEquivalentTo(item);
        }
Пример #5
0
        public async Task Then_If_There_Is_No_Course_Or_Location_It_Is_Set_To_Null(
            int trainingCourseId,
            string locationName,
            [Frozen] Mock <IApiClient> apiClient,
            DemandService service)
        {
            //Arrange
            apiClient.Setup(x =>
                            x.Get <GetCreateCourseDemandResponse>(
                                It.Is <GetCreateDemandRequest>(c => c.GetUrl.Contains(trainingCourseId.ToString()))))
            .ReturnsAsync(new GetCreateCourseDemandResponse());

            //Act
            var actual = await service.GetCreateCourseDemand(trainingCourseId, locationName);

            //Assert
            actual.Course.Should().BeNull();
            actual.Location.Should().BeNull();
        }
Пример #6
0
        public async Task Then_The_Api_Is_Called_And_Data_Returned(
            int trainingCourseId,
            string locationName,
            GetCreateCourseDemandResponse apiResponse,
            [Frozen] Mock <IApiClient> apiClient,
            DemandService service)
        {
            //Arrange
            apiClient.Setup(x =>
                            x.Get <GetCreateCourseDemandResponse>(
                                It.Is <GetCreateDemandRequest>(c => c.GetUrl.Contains(trainingCourseId.ToString()))))
            .ReturnsAsync(apiResponse);

            //Act
            var actual = await service.GetCreateCourseDemand(trainingCourseId, locationName);

            //Assert
            actual.Should().BeEquivalentTo(apiResponse);
        }
Пример #7
0
        public async Task Then_The_Cache_Is_Read_And_Api_Is_Called(
            Guid id,
            CourseDemandRequest demand,
            [Frozen] Mock <ICacheStorageService> cacheStorageService,
            [Frozen] Mock <IApiClient> apiClient,
            DemandService service)
        {
            demand.NumberOfApprentices = "10";
            cacheStorageService
            .Setup(x => x.RetrieveFromCache <CourseDemandRequest>(id.ToString()))
            .ReturnsAsync(demand);

            await service.CreateCourseDemand(id);

            apiClient.Verify(x => x.Post <Guid, PostCreateDemandData>(It.Is <PostCreateDemandRequest>(c =>
                                                                                                      c.Data.Id.Equals(demand.Id) &&
                                                                                                      c.Data.ContactEmailAddress.Equals(demand.ContactEmailAddress)
                                                                                                      )));
        }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             string             id        = Request.QueryString["id"];
             DemandService      myservice = new DemandService();
             DemandDetailsModel demand    = myservice.GetOneDemandContentByID(new Guid(id));
             LB_BussissName.Text = demand.BusinessmanName;
             LB_City.Text        = demand.DemandCity;
             LB_Content.Text     = demand.DemandContent;
             LB_Name.Text        = demand.CustomerName;
             LB_Othernum.Text    = demand.CustomerOtherConnect;
             LB_Telnum.Text      = demand.CustomerPhoneNum;
             LB_Type.Text        = demand.GroupOnType;
         }
     }
 }
Пример #9
0
        public async Task Then_The_Api_Is_Called_And_Employer_Demand_For_A_Provider_With_Filter(
            int ukprn,
            int?courseId,
            string location,
            string locationRadius,
            Guid id,
            GetProviderEmployerDemandResponse response,
            [Frozen] Mock <IApiClient> apiClient,
            DemandService service)
        {
            //Arrange
            apiClient.Setup(x =>
                            x.Get <GetProviderEmployerDemandResponse>(It.Is <GetProviderEmployerDemandRequest>(c =>
                                                                                                               c.GetUrl.Contains($"/{ukprn}?courseId={courseId}&location={HttpUtility.UrlEncode(location)}&locationRadius={locationRadius}"))))
            .ReturnsAsync(response);

            //Act
            var actual = await service.GetProviderEmployerDemand(ukprn, courseId, location, locationRadius);

            //Act
            actual.Should().BeEquivalentTo(response);
        }
Пример #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.Form["name"] != null)
         {
             string        name          = Request.Form["name"];
             string        telnumber     = Request.Form["telnumber"];
             string        othernumber   = Request.Form["othernumber"];
             string        city          = Request.Form["city"];
             string        suppliersname = Request.Form["suppliersname"];
             string        grouptype     = Request.Form["grouptype"];
             string        groupcontent  = Request.Form["groupcontent"];
             DemandService myservice     = new DemandService();
             myservice.CreateDemand(new NewDemandModel()
             {
                 BusinessmanName = suppliersname, CustomerName = name, CustomerOtherConnect = othernumber, CustomerPhoneNum = telnumber, DemandCity = city, DemandContent = groupcontent, GroupOnType = grouptype,
             });
             Response.Write("<script>alert('谢谢您,我们会在第一时间和您联系!')</script>");
         }
     }
 }
 public DemandEntryPage()
 {
     InitializeComponent();
     _demandeService = new DemandService();
 }