Example #1
0
        public async Task <IActionResult> PutPersonalDetail(int id, PersonalDetail personalDetail)
        {
            if (id != personalDetail.PId)
            {
                return(BadRequest());
            }

            _context.Entry(personalDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonalDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
 private void GetDropDownPersonal(PersonalDetail objPersonalDetail)
 {
     using (SalutationModel objSalutation = new SalutationModel())
     {
         objPersonalDetail.salutationList = objSalutation.GetSalutationList().OrderBy(o => o.Salutation).ToList();
     }
 }
Example #3
0
        public async Task <IActionResult> PutPersonalDetail([FromRoute] string id, [FromBody] PersonalDetail personalDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != personalDetail.RegNo)
            {
                return(BadRequest());
            }

            _context.Entry(personalDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonalDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public IActionResult EditPerson(int personDetailId)
        {
            PersonalDetail pd = new PersonalDetail();

            pd = people.Where(item => item.PersonalDetailId == personDetailId).FirstOrDefault();
            return(View(pd));
        }
Example #5
0
        public IActionResult CreatePerson(PersonalDetail person)
        {
            if (ModelState.IsValid)
            {
                if (Request.Form.Files["profile-image"] != null)
                {
                    //saving
                    if (Request.Form.Files["profile-image"].Length > 10 * 1024 * 1024)
                    {
                        person.ErrorMsg = "File is not within size limit of 10MB.";
                        return(View(person));
                    }
                    string pathToFolder = Path.Combine(_env.WebRootPath, "UploadedFiles", Request.Form.Files["profile-image"].FileName);
                    var    fileStream   = new FileStream(pathToFolder, FileMode.Create);
                    Request.Form.Files["profile-image"].CopyTo(fileStream);
                    person.ImageLocation = pathToFolder;
                    /*person.ImageLocation = "UploadedFiles" + Request.Form.Files["profile-image"].FileName;*/
                }
                var personDetailList = PersonMemory.GetPersons();
                int personsCount     = personDetailList.Count;
                person.PersonalDetailId = ++personsCount;

                personDetailList.Add(person);
                return(RedirectToAction("Persons"));
            }

            else
            {
                return(View(person));
            }
        }
        public ActionResult CretePersonDetail(PersonalDetail pd)
        {
            if (Request.Form.Files["profile-image"] != null)
            {
                //saving
                if (Request.Form.Files["profile-image"].Length > 10 * 1024 * 1024)
                {
                    pd.ErrorMsg = "File Size not valid !!";
                    return(View(pd));
                }
                string pathToFolder = Path.Combine(_env.WebRootPath, "uploadedfiles", Request.Form.Files["profile-image"].FileName);

                using (var fileStreams = new FileStream(pathToFolder, FileMode.Create))
                {
                    Request.Form.Files["profile-image"].CopyTo(fileStreams);
                    pd.ImageLocation = pathToFolder;
                    fileStreams.Flush();
                }
            }
            var persondetailList   = PersonMemory.GetPersons();
            int currentPersonCount = persondetailList.Count;

            currentPersonCount  = currentPersonCount + 1;
            pd.PersonalDetailId = currentPersonCount;
            persondetailList.Add(pd);
            return(RedirectToAction("Persons"));
        }
        public ViewResult PersonalDetailEdit(int personDetailId)
        {
            PersonalDetail pdetail = new PersonalDetail();

            pdetail = PersonMemory.GetPersons().Where(x => x.PersonalDetailId == personDetailId).FirstOrDefault();
            return(View(pdetail));
        }
 public string CreatePersonalDetail(PersonalDetail personalDetail)
 {
     if (personalDetail != null)
     {
         var userId = User.Identity.GetUserId();
         var obj    = new PersonalDetail()
         {
             FirstName   = personalDetail.FirstName,
             LastName    = personalDetail.LastName,
             Title       = personalDetail.Title,
             DateOfBirth = personalDetail.DateOfBirth,
             IdNumber    = personalDetail.IdNumber,
             Gender      = personalDetail.Gender,
             Disable     = personalDetail.Disable,
             UserId      = userId
         };
         db.PersonalDetails.Add(obj);
         db.SaveChanges();
         return("Personal details Added Successfully");
     }
     else
     {
         return("Personal details Not Inserted! Try Again");
     }
 }
        public string EditPersonalDetail(PersonalDetail personalDetail)
        {
            if (personalDetail != null)
            {
                var            userId          = User.Identity.GetUserId();
                var            personalDetail_ = db.Entry(personalDetail);
                PersonalDetail personalDetails = db.PersonalDetails.FirstOrDefault(x => x.UserId == userId);

                personalDetails.FirstName   = personalDetail.FirstName;
                personalDetails.LastName    = personalDetail.LastName;
                personalDetails.Title       = personalDetail.Title;
                personalDetails.DateOfBirth = personalDetail.DateOfBirth;
                personalDetails.IdNumber    = personalDetail.IdNumber;
                personalDetails.Gender      = personalDetail.Gender;
                personalDetails.Disable     = personalDetail.Disable;
                personalDetails.UserId      = userId;

                db.SaveChanges();
                return("PersonalDetail Updated Successfully");
            }
            else
            {
                return("PersonalDetail Not Updated! Try Again");
            }
        }
        public void Delete(int Id)
        {
            PersonalDetail user = db.PersonalDetails.Find(Id);

            db.PersonalDetails.Remove(user);
            Save();
        }
Example #11
0
        public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,Title,DateOfBirth,IdNumber,Gender,Disable")] PersonalDetail personalDetail)
        {
            var userId = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                var obj = new PersonalDetail()
                {
                    FirstName   = personalDetail.FirstName,
                    LastName    = personalDetail.LastName,
                    Title       = personalDetail.Title,
                    DateOfBirth = personalDetail.DateOfBirth,
                    IdNumber    = personalDetail.IdNumber,
                    Gender      = personalDetail.Gender,
                    Disable     = personalDetail.Disable,
                    UserId      = userId
                };
                db.PersonalDetails.Add(obj);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(personalDetail));
        }
        private void SetUpData()
        {
            this.targetService = new PhotoService();
            this.person = new Person();
            CrewmemberCollection crewMembers = new CrewmemberCollection();
            var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty };
            crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail });
            this.person.AssignCrewmembers(crewMembers);

            GuestCollection guests = new GuestCollection();

            var checkInDetail = new CheckInDetail
            {
                ApplicationId = string.Empty,
                LocationId = "1",
                LocationTypeId = "1",
                MachineName = "Machine",
                Station = "station",
                UserId = "user"
            };
            var cruiseDetail = new GuestCruiseDetail
            {
                BeaconId = string.Empty,
                CheckInDetail = checkInDetail,
                LoyaltyLevelTypeId = "1",
                ReservationId = "1",
                Stateroom = stateroom,
                ReservationStatusId = "0000089",
                StateroomCategoryTypeId = "3"
            };

            var guest = new Guest
            {
                GuestId = PersonId,
                PersonalDetail = personDetail,
                Age = 0,
                CruiseDetail = cruiseDetail,
                SecurityPhotoAddress = string.Empty,
            };

            guests.Add(guest);

            this.person.AssignGuests(guests);

            PortDebarkAuthorization pda = new PortDebarkAuthorization { PortId = "1", PersonId = "00001", CanDebarkAlone = true, IsActivePort = true, PortOrder = 1 };

            DebarkAuthorizedPersonCollection dapCollection = new DebarkAuthorizedPersonCollection();

            dapCollection.Add(new DebarkAuthorizedPerson { PersonTypeId = "2", Person = this.FilledPerson(), PersonId = PersonId, PersonType = PersonType.Guest });
            pda.AssignDebarkAuthorizedPersons(dapCollection);

            PortDebarkAuthorizationCollection portDebarkAuthorizations = new PortDebarkAuthorizationCollection();
            portDebarkAuthorizations.Add(pda);
            guest.AssignPortAuthorizations(portDebarkAuthorizations);
            guests.Add(guest);

            this.listOfPDA.Add(pda);

            person.AssignGuests(guests);
        }
        public async Task <IActionResult> Edit(int id, [Bind("PersonalID,FullName,FathersName,MothersName,DateOfBirth,Religion,Nationality,MaritalStatus,UserPicture")] PersonalDetail personalDetail)
        {
            if (id != personalDetail.PersonalID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personalDetail);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonalDetailExists(personalDetail.PersonalID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(personalDetail));
        }
 public IActionResult AddUpdate(PersonalDetail personalDetail, string returnUrl)
 {
     if (personalDetail.IsNew)
     {
         personalDetail.UserId = User.GetId();
         if (DbContext.PersonalDetail.Create(personalDetail) > 0)
         {
             ShowSavedSuccessfullyToast();
         }
         else
         {
             ShowTaskFailedToast();
         };
     }
     else
     {
         if (DbContext.PersonalDetail.Update(personalDetail))
         {
             ShowUpdateSuccessfullyToast();
         }
         else
         {
             ShowTaskFailedToast();
         }
         ;
     }
     return(Redirect(returnUrl));
 }
Example #15
0
        public async Task <ActionResult <PersonalDetail> > PostPersonalDetail(PersonalDetail personalDetail)
        {
            _context.PersonalDetails.Add(personalDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPersonalDetail", new { id = personalDetail.PId }, personalDetail));
        }
Example #16
0
        public async Task <IHttpActionResult> PutPersonalDetail(int id, PersonalDetail personalDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != personalDetail.AutoId)
            {
                return(BadRequest());
            }

            db.Entry(personalDetail).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonalDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> Index()
        {
            string userId = null;

            if (User.Identity.IsAuthenticated)
            {
                userId = User.Identity.GetUserId();

                /* var personalDetail = from a in db.PersonalDetails
                 *           where a.UserId == userId
                 *           select a;*/

                PersonalDetail personalDetail = await db.PersonalDetails.FirstOrDefaultAsync(x => x.UserId == userId);

                if (personalDetail == null)
                {
                    ViewBag.IsCreate = true;
                    return(PartialView("_CreatePersonalDetail"));
                }
                else
                {
                    ViewBag.IsCreate = false;
                    return(View(personalDetail));
                }
            }
            return(View());
        }
Example #18
0
        public IActionResult DeletePerson(int personDetailId)
        {
            PersonalDetail pd = people.Where(x => x.PersonalDetailId == personDetailId).FirstOrDefault();

            people.Remove(pd);
            return(RedirectToAction("People"));
        }
 public int SavePersonalDetails(PersonalDetail PersonalModel)
 {
     try
     {
         var existscount = dbContext.PersonalDetails.Where(b => b.PhoneNumber == PersonalModel.PhoneNumber).FirstOrDefault();
         if (existscount == null)
         {
             dbContext.PersonalDetails.Add(PersonalModel);
             dbContext.SaveChanges();
             return(100);
         }
         else
         {
             return(200);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "SavePersonalDetails";
         int error = objError.InsertError(model);
         return(400);
     }
 }
Example #20
0
        public IActionResult PersonalDetail(string person)
        {
            //this information can be accessed from database

            //hari
            PersonalDetail hari = new PersonalDetail(detailList);

            hari.FirstName  = "Hari Krishna";
            hari.Address    = "Gothatar, Kathmandu";
            hari.Age        = 56;
            hari.Occupation = "Trader";



            //bhanu
            PersonalDetail bhanu = new PersonalDetail(detailList);

            bhanu.FirstName  = "Bhanu Shrestha";
            bhanu.Address    = "Dudhpati, Bhaktapur";
            bhanu.Age        = 24;
            bhanu.Occupation = "Student";


            PersonalDetail personDetail = new PersonalDetail(detailList);

            if (person == "Hari Krishna")
            {
                personDetail = hari;
            }
            else if (person == "Bhanu Shrestha")
            {
                personDetail = bhanu;
            }
            return(View("PersonalDetails", personDetail));
        }
        public string GetDetails(string PhoneNumber)
        {
            try
            {
                PersonalDetail model           = new PersonalDetail();
                PersonalDetail PersonalRecords = objPersonal.FetchPersonalDetails(PhoneNumber);
                if (PersonalRecords == null)
                {
                    return("300");
                }
                else
                {
                    model.PersonalDetailsId = PersonalRecords.PersonalDetailsId;
                    model.PhoneNumber       = PersonalRecords.PhoneNumber;
                    model.FatherName        = PersonalRecords.FatherName;
                    model.MotherName        = PersonalRecords.MotherName;
                    model.DOB            = PersonalRecords.DOB;
                    model.MaritalStatus  = PersonalRecords.MaritalStatus;
                    model.CurrentAddress = PersonalRecords.CurrentAddress;


                    string jsonResult = JsonConvert.SerializeObject(model, Formatting.Indented);
                    return(jsonResult);
                }
            }
            catch (Exception ex)
            {
                ErrorLogDal objError = new ErrorLogDal();
                ErrorLog    model    = new ErrorLog();
                model.InnerException = ex.InnerException.InnerException.Message.ToString();
                model.Source         = "PersonalDetails-GET";
                int error = objError.InsertError(model);
                return("400");
            }
        }
Example #22
0
        public IActionResult EditPersonalDetail(PersonalDetail personDetail)
        {
            if (ModelState.IsValid)
            {
                if (Request.Form.Files["profile-image"] != null)
                {
                    //saving
                    if (Request.Form.Files["profile-image"].Length > 10 * 1024 * 1024)
                    {
                        personDetail.ErrorMsg = "File is not within size limit of 10MB.";
                        return(View(personDetail));
                    }
                    string pathToFolder = Path.Combine(_env.WebRootPath, "UploadedFiles", Request.Form.Files["profile-image"].FileName);
                    var    fileStream   = new FileStream(pathToFolder, FileMode.Create);
                    Request.Form.Files["profile-image"].CopyTo(fileStream);
                    personDetail.ImageLocation = "UploadedFiles" + Request.Form.Files["profile-image"].FileName;
                }

                var personInList = PersonMemory.GetPersons().Where(x => x.PersonalDetailId == personDetail.PersonalDetailId).FirstOrDefault();

                personInList.FirstName     = personDetail.FirstName;
                personInList.Occupation    = personDetail.Occupation;
                personInList.Age           = personDetail.Age;
                personInList.Address       = personDetail.Address;
                personInList.ImageLocation = personDetail.ImageLocation;

                return(RedirectToAction("Persons"));
            }
            else
            {
                return(View(personDetail));
            }
        }
Example #23
0
        // GET: ProfileManager
        public ActionResult Personal()
        {
            PersonalDetail objPersonalDetail = new PersonalDetail();

            GetDropDownPersonal(objPersonalDetail);
            GetUserDataPersonal(objPersonalDetail);
            return(View(objPersonalDetail));
        }
Example #24
0
        public ActionResult DeleteConfirmed(int id)
        {
            PersonalDetail personalDetail = db.PersonalDetails.Find(id);

            db.PersonalDetails.Remove(personalDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IActionResult PersonalDetail(int personDetailId)
        {
            PersonalDetail pdetail = new PersonalDetail();

            pdetail = PersonMemory.GetPersons().Where(x => x.PersonalDetailId == personDetailId).FirstOrDefault();
            return(View(pdetail));
            //return new ObjectResult(pdetail);
        }
Example #26
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            PersonalDetail personalDetail = await db.PersonalDetails.FindAsync(id);

            db.PersonalDetails.Remove(personalDetail);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
 public IActionResult PostPersonalDetail([FromBody] PersonalDetail personalDetails)
 {
     if (personalDetails == null)
     {
         return(BadRequest("PersonalDetail is null!!!!!"));
     }
     _repository.Add(personalDetails);
     return(CreatedAtRoute("GetPersonalDetails", new { Id = personalDetails.PersonalDetailID }, personalDetails));
 }
Example #28
0
        public int Save(PersonalDetail personalDetail)
        {
            if (personalDetail.CandidateId == 0)
            {
                context.PersonalDetail.Add(personalDetail);
            }

            return(context.SaveChanges());
        }
Example #29
0
        public JsonResult UploadProfilePicture()
        {
            HttpPostedFileBase httpPostedFileBase = Request.Files["ImageFile"];
            string             resumeId           = Request["resumeId"].ToString();
            string             returnfilename     = "";
            bool result = false;

            if (httpPostedFileBase != null && httpPostedFileBase.ContentLength != 0)
            {
                string extention   = Path.GetExtension(httpPostedFileBase.FileName);
                string fileName    = resumeId + "-{0}-" + DateTime.Now.Ticks + "{1}";
                string imagefolder = AppConfig.ProfileImageFolder;

                string profileImageFolderPath = Server.MapPath("~/" + imagefolder + resumeId);
                returnfilename = imagefolder + resumeId + "/" + string.Format(fileName, "full", extention);
                if (FileHelper.CreateFolderIfNeeded(profileImageFolderPath))
                {
                    try
                    {
                        Image orgImg = Bitmap.FromStream(httpPostedFileBase.InputStream);
                        foreach (var prop in orgImg.PropertyItems)
                        {
                            if (prop.Id == 0x0112) //value of EXIF
                            {
                                int            orientationValue = orgImg.GetPropertyItem(prop.Id).Value[0];
                                RotateFlipType rotateFlipType   = ImageHelper.GetOrientationToFlipType(orientationValue);
                                orgImg.RotateFlip(rotateFlipType);

                                break;
                            }
                        }
                        if (orgImg.Height > 300 || orgImg.Width > 300)
                        {
                            orgImg = ImageHelper.GetImageResize(300, 300, orgImg);
                        }
                        var qualityEncoder = Encoder.Quality;
                        var quality        = (long)80;
                        var ratio          = new EncoderParameter(qualityEncoder, quality);
                        var codecParams    = new EncoderParameters(1);
                        codecParams.Param[0] = ratio;
                        var            jpegCodecInfo   = ImageCodecInfo.GetImageEncoders();
                        PersonalDetail _PersonalDetail = _Util.Facade.CreateCVFacade.GetPersonalDetailByResumeId(resumeId);
                        _PersonalDetail.ProfilePicture = "/" + returnfilename;
                        _Util.Facade.CreateCVFacade.UpdatePersonalDetails(_PersonalDetail, out _error);
                        orgImg.Save(Path.Combine(profileImageFolderPath, string.Format(fileName, "full", extention)), GetEncoder(ImageFormat.Jpeg), codecParams);
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        result = false;
                    }
                }
            }

            return(Json(new { success = result, filename = returnfilename }));
        }
Example #30
0
        public IActionResult EditPersonDetail(PersonalDetail pd)
        {
            PersonalDetail personInList = new PersonalDetail();

            personInList            = people.Where(item => item.PersonalDetailId == pd.PersonalDetailId).FirstOrDefault();
            personInList.FirstName  = pd.FirstName;
            personInList.Occupation = pd.Occupation;
            personInList.Address    = pd.Address;
            return(RedirectToAction("People"));
        }
Example #31
0
 public ActionResult Edit([Bind(Include = "AutoId,FirstName,LastName,Age,DateOfBirth")] PersonalDetail personalDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personalDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(personalDetail));
 }
 private PersonBase FilledPerson()
 {
     var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = stateroom };
     var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty };
     var person = new PersonBase
     {
         IsOnHold = true,
         ChargeId = ChargeId,
         CruiseDetail = cruiseDetails,
         PersonalDetail = personDetail,
         LastEvent = string.Empty,
         PersonId = PersonId,
         SecurityPhotoAddress = string.Empty,
         Stateroom = stateroom,
         PersonType = PersonType.Guest
     };
     return person;
 }
 private PersonBase FilledPerson()
 {
     var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = "00088" };
     var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, PassportNo = string.Empty, Suffix = string.Empty };
     var alers = new AlertCollection();
     alers.Add(new Alert { IsDenyAshore = true, IsParentalAuthorizationAlert = false, IsOverride = true, AlertType = "custom", AlertId = "1" });
     alers.Add(new Alert { IsDenyAshore = true, IsParentalAuthorizationAlert = true, IsOverride = false, AlertType = "custom", AlertId = "1", Message = new Message() { Description = "demo", Subject = "abc" } });
     alers.Add(new Alert { IsDenyAshore = false, IsParentalAuthorizationAlert = true, IsOverride = false, AlertType = "custom", AlertId = "2", Message = new Message() { Description = "demo", Subject = "abc" } });
     var person = new PersonBase
     {
         IsOnboard = true,
         IsOnHold = true,
         ChargeId = "003",
         CruiseDetail = cruiseDetails,
         PersonalDetail = personDetail,
         LastEvent = string.Empty,
         PersonId = "001",
         PersonTypeId = "3",
         SecurityPhotoAddress = string.Empty,
         Stateroom = "00088"
     };
     person.AssignAlerts(alers);
     return person;
 }
        private void SetUpPartyManagerData()
        {
            //// var party = new PersonsParty { SelectedPerson = this.FilledPerson() };
            this.person = new Person();
            CrewmemberCollection crewMembers = new CrewmemberCollection();
            var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty };
            crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail });
            this.person.AssignCrewmembers(crewMembers);

            GuestCollection guests = new GuestCollection();
            var checkInDetail = new CheckInDetail
            {
                ApplicationId = string.Empty,
                LocationId = "1",
                LocationTypeId = "1",
                MachineName = "Machine",
                Station = "station",
                UserId = "user"
            };
            var cruiseDetail = new GuestCruiseDetail
            {
                BeaconId = string.Empty,
                CheckInDetail = checkInDetail,
                LoyaltyLevelTypeId = "1",
                ReservationId = "1",
                Stateroom = stateroom,
                ReservationStatusId = "0000089",
                StateroomCategoryTypeId = "aaasad"
            };
            guests.Add(new Guest
            {
                GuestId = "1",
                PersonalDetail = personDetail,
                Age = 0,
                CruiseDetail = cruiseDetail,
                SecurityPhotoAddress = string.Empty
            });

            this.person.AssignGuests(guests);
        }
        /// <summary>
        /// Retrieves the country.
        /// </summary>
        /// <param name="personalDetail">The personal detail.</param>
        /// <returns>The country</returns>
        private static Country RetriveCountry(PersonalDetail personalDetail)
        {
            CountryCollection allCountries = RetrieveAllCountries();

            var tempDetails = personalDetail;
            tempDetails.Country = allCountries.FirstOrDefault(a => a.CountryId.Equals(personalDetail.CitizenshipCountryId));
            if (tempDetails.Country != null)
            {
                Observable.ToAsync(async () =>
                {
                    byte[] bytes = await tempDetails.Country.CountryFlagAddress.ImageAddressToByteArray();
                    tempDetails.Country.CountryIcon = bytes.ToBitmapSource();
                    await ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => tempDetails.Country.NotifyPropertyChange(CountryIcon)));
                })().Subscribe(r => { }, ex => { });
            }

            return tempDetails.Country;
        }
        /// <summary>
        /// Setups the data.
        /// </summary>
        private void SetupData()
        {
            Domain.Dependencies.Register();
            DataAccess.Dependencies.Register();

            this.workstationMock = new Mock<Workstation>();
            DIContainer.Instance.RegisterInstance<Workstation>(this.workstationMock.Object);
            Workstation ws = DIContainer.Instance.Resolve<Workstation>();

            ws.Port = new Port { PortId = "1" };
            ws.Ship = new Ship { ShipId = "5" };
            ws.GangwayLocation = new GangwayLocation { LocationId = "1" };
            ws.GangwayServiceBaseAddress = "http://Localhost/";
            ws.ConfigurationServiceBaseAddress = "http://Localhost/";
            ws.AuthenticationServiceBaseAddress = "http://Localhost/";
            ws.AuthorizationServiceBaseAddress = "http://Localhost/";
            ws.ConnectionMode = ConnectionMode.Online;
            var intCollection = new Collection<int>();
            intCollection.Add(0);
            var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" };
            var voyageList = new List<Voyage>();
            var voyage = new Voyage { DebarkPortId = "1", EmbarkPortId = "1", DestinationId = "1", MediaItemAddress = "http://172.26.248.122/", VoyageId = "31", Name = "Carnival Voyage", IsActive = true, ShipId = "5", Number = "ccl", DebarkDate = new DateTime(2015, 3, 3), EmbarkDate = new DateTime(2015, 3, 2) };
            voyageList.Add(voyage);
            ws.AssignVoyageList(voyageList);

            ////this.repository = new Mock<IRepository>();
            ////this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>();
            this.personServiceRepositoryMock = new Mock<PersonServiceRepository>();
            this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>();
            ////this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>();
            ////this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>();
            ////this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>();
            ////this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>();
            ////this.guestClient = new Mock<IGuestClient>();
            ////this.personClient = new Mock<IPersonsClient>();
            ////DIContainer.Instance.RegisterInstance<IGuestClient>(this.guestClient.Object);
            ////DIContainer.Instance.RegisterInstance<IPersonsClient>(this.personClient.Object);

            ////DIContainer.Instance.RegisterInstance<IRepository>(this.repository.Object);
            DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object);
            ////DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object);
            ////DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object);
            ////DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object);
            DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object);
            ////DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object);

            var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = "0000" };
            var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty, DocumentTypeId = "1" };

            this.person = new Person { TotalResults = 1 };
            CrewmemberCollection crewMembers = new CrewmemberCollection();
            crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail });
            person.AssignCrewmembers(crewMembers);

            GuestCollection guests = new GuestCollection();
            var checkInDetail = new CheckInDetail
            {
                ApplicationId = string.Empty,
                LocationId = "1",
                LocationTypeId = "1",
                MachineName = "Machine",
                Station = "station",
                UserId = "user"
            };
            var cruiseDetail = new GuestCruiseDetail
            {
                BeaconId = string.Empty,
                CheckInDetail = checkInDetail,
                LoyaltyLevelTypeId = "1",
                ReservationId = "1",
                Stateroom = "00000",
                ReservationStatusId = "0000089",
                StateroomCategoryTypeId = "aaasad"
            };
            guests.Add(new Guest
            {
                GuestId = "0001",
                PersonalDetail = personDetail,
                Age = 0,
                CruiseDetail = cruiseDetail,
                SecurityPhotoAddress = string.Empty,
            });

            VisitorCollection visitors = new VisitorCollection();
            visitors.Add(new Visitor
            {
                VisitorId = "0003",
                PersonalDetail = personDetail,
                SecurityPhotoAddress = string.Empty,
            });
            this.person.AssignGuests(guests);
            this.person.AssignVisitors(visitors);
            this.personTypes = new List<PersonType>();
            personTypes.Add(PersonType.Guest);
            this.personServiceRepositoryMock.Setup(data => data.RetrievePersonsBySearchText(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<IList<PersonType>>(), It.IsAny<SearchType>(), It.IsAny<string>(), It.IsAny<string>(), 0, 0, It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(this.person));
            var documentTypes = new DocumentTypeCollection();
            documentTypes.Add(new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" });
            var referencedata = new ReferenceData();
            referencedata.AssignDocumentTypes(documentTypes);
            this.referenceDataRepositoryMock.Setup(data => data.RetrieveReferenceDataAsync()).Returns(Task.FromResult(referencedata));
            ////this.personClient.Setup(data => data.RetrievePersonsAsync("5", "ab", null, null, "0001", null, null, "Guest", null, null, null, null, null, 0, 0)).Returns(RetrieveData());
        }
Example #37
0
 /// <summary>
 /// Maps the personal detail.
 /// </summary>
 /// <param name="person">The person.</param>
 /// <param name="personalDetail">The personal detail.</param>
 private static void MapPersonalDetail(Person person, PersonalDetail personalDetail)
 {
     person.PersonalDetail = new PersonalDetail
     {
         Birthdate = personalDetail.Birthdate,
         Gender = personalDetail.Gender == "1" ? "M" : personalDetail.Gender == "2" ? "F" : personalDetail.Gender,
         FirstName = personalDetail.FirstName,
         LastName = personalDetail.LastName,
         MiddleName = personalDetail.MiddleName,
         PassportNo = personalDetail.PassportNo,
         CitizenshipCountryId = personalDetail.CitizenshipCountryId
     };
 }
        private Person FilledPerson()
        {
            var person = new Person();
            CrewmemberCollection crewMembers = new CrewmemberCollection();
            var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty };
            crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail });
            person.AssignCrewmembers(crewMembers);

            GuestCollection guests = new GuestCollection();
            var checkInDetail = new CheckInDetail
            {
                ApplicationId = string.Empty,
                LocationId = "1",
                LocationTypeId = "1",
                MachineName = "Machine",
                Station = "station",
                UserId = "user"
            };
            var cruiseDetail = new GuestCruiseDetail
            {
                BeaconId = string.Empty,
                CheckInDetail = checkInDetail,
                LoyaltyLevelTypeId = "1",
                ReservationId = "1",
                Stateroom = stateroom,
                ReservationStatusId = "0000089",
                StateroomCategoryTypeId = "aaasad"
            };
            var guest = new Guest
            {
                GuestId = PersonId,
                PersonalDetail = personDetail,
                Age = 0,
                CruiseDetail = cruiseDetail,
                SecurityPhotoAddress = string.Empty
            };

            var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = stateroom };
            //// var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, PassportNo = string.Empty, Suffix = string.Empty };
            var personBase = new PersonBase
            {
                IsOnHold = true,
                ChargeId = ChargeId,
                CruiseDetail = cruiseDetails,
                PersonalDetail = personDetail,
                LastEvent = string.Empty,
                PersonId = PersonId,
                SecurityPhotoAddress = string.Empty,
                Stateroom = stateroom
            };

            PortDebarkAuthorization pda = new PortDebarkAuthorization { PortId = "1", PersonId = "00001", CanDebarkAlone = true, IsActivePort = true, PortOrder = 1 };

            DebarkAuthorizedPersonCollection dapCollection = new DebarkAuthorizedPersonCollection();

            dapCollection.Add(new DebarkAuthorizedPerson { PersonTypeId = "2", Person = personBase, PersonId = PersonId, PersonType = PersonType.Guest });
            pda.AssignDebarkAuthorizedPersons(dapCollection);

            PortDebarkAuthorizationCollection portDebarkAuthorizations = new PortDebarkAuthorizationCollection();
            portDebarkAuthorizations.Add(pda);
            guest.AssignPortAuthorizations(portDebarkAuthorizations);
            guests.Add(guest);

            person.AssignGuests(guests);
            return person;
        }
 /// <summary>
 /// Retrieves the countries.
 /// </summary>
 /// <param name="personalDetails">The personal details.</param>
 private void RetrieveCountries(PersonalDetail personalDetails)
 {
     personalDetails.Country = this.allCountries.FirstOrDefault(a => !string.IsNullOrEmpty(a.CountryId) && a.CountryId.Equals(personalDetails.CitizenshipCountryId, StringComparison.OrdinalIgnoreCase));
 }