Esempio n. 1
0
 public void UpdateType(VisaType type)
 {
     Apply(new VisaEvents.TypeUpdated
     {
         Type = type
     });
 }
        /// <summary>
        /// Updates or creates a resource based on the resource identifier. The PUT operation is used to update or create a resource by identifier.  If the resource doesn't exist, the resource will be created using that identifier.  Additionally, natural key values cannot be changed using this operation, and will not be modified in the database.  If the resource &quot;id&quot; is provided in the JSON body, it will be ignored as well.
        /// </summary>
        /// <param name="id">A resource identifier specifying the resource to be updated.</param>
        /// <param name="IfMatch">The ETag header value used to prevent the PUT from updating a resource modified by another consumer.</param>
        /// <param name="body">The JSON representation of the &quot;visaType&quot; resource to be updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PutVisaType(string id, string IfMatch, VisaType body)
        {
            var request = new RestRequest("/visaTypes/{id}", Method.PUT);

            request.RequestFormat = DataFormat.Json;

            request.AddUrlSegment("id", id);
            // verify required params are set
            if (id == null || body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddHeader("If-Match", IfMatch);
            request.AddBody(body);
            request.Parameters.First(param => param.Type == ParameterType.RequestBody).Name = "application/json";
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VisaType visaType = db.VisaTypes.Find(id);

            db.VisaTypes.Remove(visaType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
 public static VisaTypeListViewModel Create(VisaType Entity)
 {
     return(new VisaTypeListViewModel()
     {
         VisaTypeId = Entity.VisaTypeId,
         Description = Entity.Description
     });
 }
Esempio n. 5
0
 public Visa(VisaType type)
 {
     Requirements = new List <Requirement>();
     Apply(new VisaEvents.Created
     {
         Id   = Guid.NewGuid(),
         Type = type
     });
 }
 public ActionResult Edit([Bind(Include = "VisaID,VisaTypes")] VisaType visaType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visaType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(visaType));
 }
Esempio n. 7
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            VisaType visaType = db.VisaTypes.Find(id);

            visaType.IsDelete   = true;
            visaType.DeleteDate = DateTime.Now;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "VisaID,VisaTypes")] VisaType visaType)
        {
            if (ModelState.IsValid)
            {
                db.VisaTypes.Add(visaType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(visaType));
        }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "Id,Title,IsDelete,DeleteDate,SubmitDate,LastModificationDate")] VisaType visaType)
 {
     if (ModelState.IsValid)
     {
         visaType.IsDelete        = false;
         db.Entry(visaType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(visaType));
 }
Esempio n. 10
0
            public void CreateVisa_ValidParameters()
            {
                // Arrange
                const VisaType type = VisaType.D;

                // Act
                var visa = new Visa(type);

                //Assert
                Assert.Equal(type, visa.Type);
                Assert.False(visa.Id == null);
            }
Esempio n. 11
0
            public void SetVisaGoal_ValidGoal()
            {
                // Arrange
                const VisaType type = VisaType.D;
                var            visa = new Visa(type);
                var            goal = VisaGoal.FromString("Education");

                // Act
                visa.SetGoal(goal);

                //Assert
                Assert.Equal(goal, visa.Goal);
            }
Esempio n. 12
0
        public ActionResult Create([Bind(Include = "Id,Title,IsDelete,DeleteDate,SubmitDate,LastModificationDate")] VisaType visaType)
        {
            if (ModelState.IsValid)
            {
                visaType.IsDelete   = false;
                visaType.SubmitDate = DateTime.Now;
                visaType.Id         = Guid.NewGuid();
                db.VisaTypes.Add(visaType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(visaType));
        }
Esempio n. 13
0
            public void ThrowException_ValidRequirementButExpectedProcessingTimeNotSet()
            {
                // Arrange
                const VisaType type                   = VisaType.D;
                var            visa                   = new Visa(type);
                var            requirementName        = RequirementName.FromString("Invitation Letter");
                var            requirementDescription =
                    RequirementDescription.FromString("A letter of acceptance from a foreign university.");
                var requirementExample = RequirementExample.FromString("acceptance_letter_example.png");

                // Act & Assert
                Assert.Throws <Exceptions.InvalidEntityState>(() =>
                                                              visa.AddRequirement(requirementName, requirementDescription, requirementExample));
            }
        // GET: VisaTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisaType visaType = db.VisaTypes.Find(id);

            if (visaType == null)
            {
                return(HttpNotFound());
            }
            return(View(visaType));
        }
Esempio n. 15
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            VisaType = await _context.VisaTypes.FirstOrDefaultAsync(m => m.Id == id);

            if (VisaType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 16
0
        public async Task <IActionResult> AddUpdateVisaType(MenuViewModel model)
        {
            if (ModelState.IsValid)
            {
                var visaType = new VisaType()
                {
                    Description = model.VisaTypeName
                };
                await _repository.Add(visaType);

                await _repository.Save();

                ModelState.AddModelError("", "Visa Added Successfully");
            }
            return(View());
        }
Esempio n. 17
0
            public void AddRequirement_ValidRequirementAndExpectedProcessingTimeSet()
            {
                // Arrange
                const VisaType type                   = VisaType.D;
                var            visa                   = new Visa(type);
                var            requirementName        = RequirementName.FromString("Invitation Letter");
                var            requirementDescription =
                    RequirementDescription.FromString("A letter of acceptance from a foreign university.");
                var requirementExample = RequirementExample.FromString("acceptance_letter_example.png");

                visa.SetExpectedProcessingTime(VisaExpectedProcessingTime.FromInt(30));

                // Act
                visa.AddRequirement(requirementName, requirementDescription, requirementExample);

                //Assert
                Assert.NotEmpty(visa.Requirements);
            }
Esempio n. 18
0
        public string Update(int id, string name, string description)
        {
            string msg;

            try
            {
                VisaType model = service.GetById(id);
                model.Name        = name;
                model.Description = description;
                model.ChangedBy   = User.Identity.GetUserId();
                service.Update(model);
                msg = "Saved Successfully";
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }
Esempio n. 19
0
 public ForeignPassport(string nationality, string firstName, string lastName, DateTime dateOfBirth, SexxType sexx, string placeOfBirth, string issuingAuthority,
                        string passportNumber, DateTime whenissued, DateTime whenToExpire, PagesNumber pagesNum, VisaType visa, string countriesBeenTo,
                        string passportSeries)
 {
     Nationality      = nationality;
     FirstName        = firstName;
     LastName         = lastName;
     DateOfBirth      = dateOfBirth;
     Sexx             = sexx;
     PlaceOfBirth     = placeOfBirth;
     IssuingAuthority = issuingAuthority;
     PassportNumber   = passportNumber;
     WhenIssued       = whenissued;
     WhenToExpire     = whenToExpire;
     PagesNum         = pagesNum;
     Visa             = visa;
     CountriesBeenTo  = countriesBeenTo;
     PassportSeries   = passportSeries;
 }
Esempio n. 20
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            VisaType = await _context.VisaTypes.FindAsync(id);

            if (VisaType != null)
            {
                if (!VisaType.IsSystem)
                {
                    VisaType.IsDeleted = true;
                    await _context.SaveChangesAsync();
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 21
0
        public async Task <IActionResult> AddVisaType(string Visa)
        {
            if (Visa != null)
            {
                var newVisa = new VisaType()
                {
                    Description = Visa
                };
                await _repository.Add(newVisa);

                if (await _repository.Save())
                {
                    return(Json(true));
                }
                else
                {
                    return(Json(false));
                }
            }
            return(Json(false));
        }
Esempio n. 22
0
        /// <summary>
        /// Creates or updates resources based on the natural key values of the supplied resource. The POST operation can be used to create or update resources. In database terms, this is often referred to as an &quot;upsert&quot; operation (insert + update).  Clients should NOT include the resource &quot;id&quot; in the JSON body because it will result in an error (you must use a PUT operation to update a resource by &quot;id&quot;). The web service will identify whether the resource already exists based on the natural key values provided, and update or create the resource appropriately.
        /// </summary>
        /// <param name="body">The JSON representation of the &quot;visaType&quot; resource to be created or updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PostVisaTypes(VisaType body)
        {
            var request = new RestRequest("/visaTypes", Method.POST);

            request.RequestFormat = DataFormat.Json;

            // verify required params are set
            if (body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddBody(body);
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
Esempio n. 23
0
 public void Update(VisaType entity)
 {
     repository.Update(entity);
 }
Esempio n. 24
0
 public void Create(VisaType entity)
 {
     entity.DateCreated = DateTime.Now;
     entity.DateChanged = DateTime.Now;
     repository.Insert(entity);
 }
Esempio n. 25
0
 private static string ConvertVisaType(VisaType p)
 {
     var data = new[] { "A", "B", "C", "D" };
     return data[(int)p];
 }
Esempio n. 26
0
        private static async Task InsertData(IServiceProvider serviceProvider)
        {
            //var owners = new ProductOwner[]
            //{
            //    new ProductOwner { Name = "Themesoft Inc", CreatedUser = "******", CreatedDate = DateTime.UtcNow },
            //    new ProductOwner { Name = "Amor Sai Inc", CreatedUser = "******", CreatedDate = DateTime.UtcNow },
            //    new ProductOwner { Name = "My Productowner Inc", CreatedUser = "******", CreatedDate = DateTime.UtcNow },
            //};

            //await AddOrUpdateAsync(serviceProvider, a => a.ProductOwnerId, owners);

            var taxStatuses = new TaxStatus[]
            {
                new TaxStatus {
                    TaxStatusCode = "1099", Description = "1099", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new TaxStatus {
                    TaxStatusCode = "W2", Description = "W2", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new TaxStatus {
                    TaxStatusCode = "C2C", Description = "C2C", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                }
            };

            await AddOrUpdateAsync(serviceProvider, a => a.TaxStatusCode, taxStatuses);

            var employmentTypes = new EmploymentType[]
            {
                new EmploymentType {
                    EmploymentTypeCode = "1", Description = "Placement", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new EmploymentType {
                    EmploymentTypeCode = "2", Description = "Passthrough", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                }
            };

            await AddOrUpdateAsync(serviceProvider, a => a.EmploymentTypeCode, employmentTypes);

            var VisaStatuses = new VisaType[]
            {
                new VisaType {
                    VisaTypeCode = "1", Description = "US Citizen", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "2", Description = "H1-B", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "3", Description = "GC", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "4", Description = "OPT EAD", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "5", Description = "H4 EAD", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "6", Description = "GC EAD", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
                new VisaType {
                    VisaTypeCode = "7", Description = "TN", CreatedUser = "******", CreatedDate = DateTime.UtcNow
                },
            };

            await AddOrUpdateAsync(serviceProvider, a => a.VisaTypeCode, VisaStatuses);

            //var endClient = new EndClient[]
            //{
            //    new EndClient { CompanyName="Walmart", TaxId="17-2466710", AddressLine1 ="Walmart Line 1", AddressLine2="Walmart Line 2", City= "Wal City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new EndClient { CompanyName="Berkshire Hathaway", TaxId="17-2466711", AddressLine1 ="Berkshire Hathaway Line 1", AddressLine2="Berkshire Hathaway Line 2", City= "Berk City", State ="NY", Zip ="12315", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new EndClient { CompanyName="Apple", TaxId="17-2466712", AddressLine1 ="Apple Line 1", AddressLine2="Apple Line 2", City= "Wal City", State ="NY", Zip ="12316", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //};

            //await AddOrUpdateAsync(serviceProvider, a => a.EndClientId, endClient);

            //var client = new Client[]
            //{
            //    new Client { CompanyName="Exxon Mobil", TaxId="17-2466713", AddressLine1 ="Exxon Mobil Line 1", AddressLine2="Exxon Mobil Line 2", City= "Wal City", State ="NY", Zip ="12317", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Client { CompanyName="UnitedHealth Group", TaxId="17-2466714", AddressLine1 ="UnitedHealth Group Line 1", AddressLine2="UnitedHealth Group Line 2", City= "Wal City", State ="NY", Zip ="12318", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Client { CompanyName="CVS Health", TaxId="17-2466715", AddressLine1 ="CVS Health Line 1", AddressLine2="CVS Health Line 2", City= "Wal City", State ="NY", Zip ="12319", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Client { CompanyName="General Motors", TaxId="17-2466716", AddressLine1 ="General Motors Line 1", AddressLine2="General Motors Line 2", City= "Wal City", State ="NY", Zip ="12312", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //};

            //await AddOrUpdateAsync(serviceProvider, a => a.ClientId, client);

            //var vendor = new Vendor[]
            //{
            //    new Vendor { CompanyName="Deloitte Consulting", TaxId="17-2466710", AddressLine1 ="Deloitte Consulting Line 1", AddressLine2="Deloitte Consulting Line 2", City= "D City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Vendor { CompanyName="Accenture", TaxId="17-2466711", AddressLine1 ="Accenture Line 1", AddressLine2="Accenture Line 2", City= "A City", State ="NY", Zip ="12315", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Vendor { CompanyName="Mahindra", TaxId="17-2466712", AddressLine1 ="Mahindra Line 1", AddressLine2="Mahindra Line 2", City= "M City", State ="NY", Zip ="12316", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //    new Vendor { CompanyName="IBM Global", TaxId="17-2466714", AddressLine1 ="IBM Global Line 1", AddressLine2="IBM Global Line 2", City= "I City", State ="NY", Zip ="12318", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow  },
            //};

            //await AddOrUpdateAsync(serviceProvider, a => a.VendorId, vendor);

            //var candidate = new Candidate[]
            //{
            //    new Candidate {FirstName= "John", LastName= "Lenon", MI= "", Gender= "M", SSN= "123231224", Email= "*****@*****.**", Phone= "1234567111", Phone2= "", AddressLine1 ="John Line 1", AddressLine2="John Line 2", City= "J City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Candidate {FirstName= "Jerry", LastName= "Lewls", MI= "", Gender= "M", SSN= "123231212", Email= "*****@*****.**", Phone= "1244467890", Phone2= "", AddressLine1 ="Jerry Line 1", AddressLine2="Jerry Line 2", City= "je City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Candidate {FirstName= "Shawn", LastName= "Grandy", MI= "", Gender= "M", SSN= "123231120", Email= "*****@*****.**", Phone= "1234561290", Phone2= "", AddressLine1 ="Grandy Line 1", AddressLine2="Grandy Line 2", City= "g City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Candidate {FirstName= "Chelsey", LastName= "Charbeneau", MI= "", Gender= "F", SSN= "121131226", Email= "*****@*****.**", Phone= "1114445544", Phone2= "", AddressLine1 ="chelsey Line 1", AddressLine2="chelsey Line 2", City= "c City", State ="NY", Zip ="12310", ProductOwnerId=4,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //};

            //await AddOrUpdateAsync(serviceProvider, a => a.CandidateId, candidate);

            //var enroll = new Enrollment[]
            //{
            //    new Enrollment {Internal= "I", HRUserId= 1, JobTitle= "Job Title 1", DurationYears= 1, DurationMonths= 0, BillRate= 75, PayRate= 71, StartDate= new DateTime(2017, 1, 1), EndDate= new DateTime(2018, 1, 1), VendorPO= "125jh6", CandidateId= 1005, EmploymentTypeCode= "1", TaxStatusCode= "C2C", ClientId= 4, EndClientId= 1, VendorId= 1,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Enrollment {Internal= "I", HRUserId= 1, JobTitle= "Job Title 2", DurationYears= 1, DurationMonths= 6, BillRate= 80, PayRate= 75, StartDate= new DateTime(2017, 3, 1), EndDate= new DateTime(2019, 8, 1), VendorPO= "163454", CandidateId= 1006, EmploymentTypeCode= "1", TaxStatusCode= "C2C", ClientId= 1, EndClientId= 2, VendorId= 2,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Enrollment {Internal= "I", HRUserId= 1, JobTitle= "Job Title 1", DurationYears= 2, DurationMonths= 0, BillRate= 60, PayRate= 45, StartDate= new DateTime(2016, 1, 1), EndDate= new DateTime(2018, 1, 1), VendorPO= "k23452", CandidateId= 1007, EmploymentTypeCode= "1", TaxStatusCode= "1099", ClientId= 2, EndClientId= 3, VendorId= 3,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //    new Enrollment {Internal= "I", HRUserId= 1, JobTitle= "Job Title 3", DurationYears= 0, DurationMonths= 6, BillRate= 55, PayRate= 50, StartDate= new DateTime(2017, 3, 1), EndDate= new DateTime(2017, 9, 1), VendorPO= "er3457", CandidateId= 1008, EmploymentTypeCode= "1", TaxStatusCode= "C2C", ClientId= 3, EndClientId= 2, VendorId= 3,  CreatedUser = "******", CreatedDate = DateTime.UtcNow},
            //};
            //await AddOrUpdateAsync(serviceProvider, a => a.EnrollmentId, enroll);
        }