Exemple #1
0
        public async Task Post_ReturnsCreatedAtRouteResult()
        {
            // Given
            var request = new NameCreateRequestModel {
                Name = "Joe Bloggs"
            };
            var id           = 1;
            var repoResponse = new NameModel {
                Id = id, Name = request.Name, DateCreated = DateTime.Now
            };

            _mockNameRepository.Setup(repo => repo.AddNameAsync(It.IsAny <string>()))
            .ReturnsAsync(repoResponse);

            // When
            var actionResult = await _nameController.PostAsync(request);

            // Then
            var createdAtRouteResult = actionResult.Result as CreatedAtRouteResult;

            Assert.NotNull(createdAtRouteResult);

            Assert.Equal(nameof(_nameController.GetByIdAsync), createdAtRouteResult.RouteName);
            createdAtRouteResult.RouteValues.TryGetValue("Id", out var IdRouteValue);
            Assert.Equal(id, (int)IdRouteValue);
        }
Exemple #2
0
        public JsonResult getJournal(string name)
        {
            List <NameModel> result = new List <NameModel> ();
            var connString          = ConnectionSettings.getConnectionString();

            using (var conn = new NpgsqlConnection(connString)) {
                conn.Open();
                string command =
                    @"SELECT name
            FROM journal
            WHERE lower(name) LIKE lower(@p1);";

                using (var cmd = new NpgsqlCommand(command, conn)) {
                    cmd.Parameters.AddWithValue("p1", "%" + (string.IsNullOrEmpty(name) ? "" : name) + "%");

                    using (var reader = cmd.ExecuteReader()) {
                        while (reader.Read())
                        {
                            NameModel row = new NameModel(reader);
                            result.Add(row);
                        }
                    }
                }
            }
            JsonResult js = Json(result);

            return(js);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual ActionResult Modify(NameModel model)
        {
            var data = this.GetEntity <AccountEntity>(Identity.Id);

            if (data == null)
            {
                return(null);
            }
            if (data.Name != model.Name)
            {
                var account = new AccountEntity
                {
                    Id       = Identity.Id,
                    Name     = model.Name,
                    SaveType = SaveType.Modify
                };
                account.SetProperty(it => it.Name);
                model.Errors             = account.Errors;
                account.AccountIdentites = new List <AccountIdentityEntity>();
                var accountIdentiy = GetAccountIdentity(data.Name);
                accountIdentiy.SaveType = SaveType.Remove;
                account.AccountIdentites.Add(new AccountIdentityEntity
                {
                    Account  = account,
                    Name     = "Name",
                    Number   = model.Name,
                    SaveType = SaveType.Add
                });
            }

            return(View("~/Views/Account/Name/Index.cshtml", model));
        }
 public UserProfile UpdateName(NameModel model)
 {
     this.SurName    = model.SurName;
     this.FirstName  = model.FirstName;
     this.Patronymic = model.Patronymic;
     return(this);
 }
        public ActionResult Name()
        {
            var nm = new NameModel();

            nm.Name = UserDataEngine.getInstance().GetCurrentUser(HttpContext).RealName;
            return(View(nm));
        }
Exemple #6
0
        public async Task GetById_ReturnsName()
        {
            // Given
            var repoResponse = new NameModel {
                Id = 1, Name = "Joe Bloggs", DateCreated = DateTime.Now
            };

            _mockNameRepository.Setup(repo => repo.GetNameByIdAsync(It.IsAny <int>()))
            .ReturnsAsync(repoResponse);

            // When
            var actionResult = await _nameController.GetByIdAsync(1);

            // Then
            var okResult = actionResult.Result as OkObjectResult;

            Assert.NotNull(okResult);

            var expectedObject = okResult.Value as NameResponseModel;

            Assert.NotNull(expectedObject);
            Assert.Equal(repoResponse.Id, expectedObject.Id);
            Assert.Equal(repoResponse.Name, expectedObject.Name);
            Assert.Equal(repoResponse.DateCreated, expectedObject.DateCreated);
        }
Exemple #7
0
        /// <summary>
        /// Generic Method To Get Name
        /// </summary>
        /// <param name="namecollection"></param>
        /// <returns></returns>
        public NameModel FillName(IPNCollection namecollection)
        {
            NameModel name = new NameModel();

            if (namecollection.Count > 0)
            {
                IHL73ObjectCollection objectCollection = namecollection[0].ChildObjects;
                foreach (var item in objectCollection)
                {
                    var    test  = item.GetType();
                    string name1 = test.Name;

                    switch (name1)
                    {
                    case "adxpdeliveryAddressLine":
                        adxpdeliveryAddressLine strt = (adxpdeliveryAddressLine)item;
                        name.Createengiven = strt.Text;
                        break;

                    case "adxpstreetAddressLine":
                        adxpstreetAddressLine str = (adxpstreetAddressLine)item;
                        name.Createenfamily = str.Text;
                        break;

                    case "adxpcity":
                        adxpcity cty = (adxpcity)item;
                        name.CreateenSuffix = cty.Text;
                        break;
                    }
                }
            }
            return(name);
        }
 public AccountIndexViewModel(Customer customer)
 {
     CustomerId          = customer.Id;
     CustomerName        = NameModel.Create(customer);
     CustomerDateOfBirth = new DateTimeModel(customer.DateOfBirth);
     CustomerHomeAddress = new AddressViewModel(customer.HomeAddress);
 }
Exemple #9
0
 public ProceduralCardGenerator(IHistogram m, ImageGlossary i, CreatureModelIndex creatureModels, NameModel name)
 {
     model              = m;
     images             = i;
     creatureModelIndex = creatureModels;
     nameModel          = name;
 }
        public async Task SaveResponse_ValidModel_SavesResponse()
        {
            Mock <ISurveyResponses> mockSurveyResponse = new Mock <ISurveyResponses>();

            SurveyController surveyController = new SurveyController();
            HttpContext      context          = new DefaultHttpContext();

            surveyController.TempData = new TempDataDictionary(new DefaultHttpContext(), new Mock <ITempDataProvider>().Object);

            SummaryModel       summaryModel       = new SummaryModel();
            NameModel          nameModel          = new NameModel();
            EmailModel         emailModel         = new EmailModel();
            AddressModel       addressModel       = new AddressModel();
            LightingLevelModel lightingLevelModel = new LightingLevelModel();

            lightingLevelModel.HappyWithLightingLevel = true;
            BrightnessModel brightnessModel = new BrightnessModel();

            brightnessModel.BrightnessLevel = 5;

            summaryModel.Name          = nameModel;
            summaryModel.Email         = emailModel;
            summaryModel.Address       = addressModel;
            summaryModel.LightingLevel = lightingLevelModel;
            summaryModel.Brightness    = brightnessModel;

            RedirectToActionResult result = (RedirectToActionResult)await surveyController.SaveResponse(mockSurveyResponse.Object, summaryModel);

            Assert.IsNotNull(result);
            Assert.AreEqual("Confirmation", result.ActionName);

            mockSurveyResponse.Verify(s => s.SaveSurveyResponse(It.IsAny <LightingSurvey>()), Times.Once);
        }
Exemple #11
0
        public void Test_Create_NameModel(NameModel name)
        {
            var validationContext = new ValidationContext(name);
            var actual            = Validator.TryValidateObject(name, validationContext, null, true);

            Assert.True(actual);
        }
        public string FillInformantInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string informantdetais = string.Empty;
            var    informant       = clinicalDoc.Informant.Append();

            //assignedEntity.Time.AsDateTime = DateTime.Now;
            //var assignedAuthor = assignedEntity.AssignedAuthor;
            hl7III = informant.AsAssignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6", "KP00017");
            IPN AsName = hl7factory.CreatePN();

            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();
            informant.AsAssignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END

            contactinfo             = new PhNoModel();                                                 ///FIll Clinic Contact Number
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
            contactinfo.nullFlavor  = "UNK";
            informant.AsAssignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END

            AsName   = informant.AsAssignedEntity.AssignedPerson.Name.Append();                        ///Manage Clinic Name
            nameinfo = new NameModel();
            nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName;
            addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name

            informantdetais = clinicalDoc.Xml;
            return(informantdetais);
        }
        public override NameModel CreatePackageName(HtmlNode anchor, HttpModel httpGet)
        {
            // example: https://www.ris.bka.gv.at/Dokument.wxe?ResultFunctionToken=8df6bc29-1253-484d-a41d-5db518f80b23&Abfrage=Bvwg&Entscheidungsart=Undefined&SucheNachRechtssatz=True&SucheNachText=True&GZ=&VonDatum=01.01.2014&BisDatum=14.05.2019&Norm=&ImRisSeitVonDatum=&ImRisSeitBisDatum=&ImRisSeit=Undefined&ResultPageSize=100&Suchworte=&Dokumentnummer=BVWGT_20190502_W170_2208106_1_00

            var documentNumber = new Uri(anchor.Href()).GetQueryFragmentsMap()["Dokumentnummer"];

            return NameModel.Create(documentNumber);
        }
Exemple #14
0
        //https://localhost:44363/Names/Detail?name=RP
        public ActionResult Detail(string name)
        {
            var model = new NameModel {
                Name = name
            };

            return(View(model));
        }
        public NameModel AppendData(string person)
        {
            NameModel model = new NameModel();

            model.FullName  = person;
            model.IndexName = person.Split(" ", StringSplitOptions.RemoveEmptyEntries).Last();

            return(model);
        }
 public void StudentNameIsEdited()
 {
     _nameModel = new NameModel
     {
         FirstName = "New",
         LastName  = "Beginning"
     };
     _profilePage.EditName(_nameModel);
 }
Exemple #17
0
 public ProfilePage EditName(NameModel nameModel)
 {
     Execute.Script("$('#edit-student-name-button').click()");
     Execute.Script("$('#FirstName').val('" + nameModel.FirstName + "')");
     Execute.Script("$('#LastName').val('" + nameModel.LastName + "')");
     Execute.Script("$('#save-student-name-edit').click()");
     WaitFor.AjaxCallsToComplete();
     return(this);
 }
Exemple #18
0
        public IActionResult ValidateWithAttribute([FromBody] NameModel model)

        {
            if (ModelState.IsValid)
            {
                return(Ok(model));
            }

            return(BadRequest(ModelState));
        }
Exemple #19
0
    public string ToString(string?format, IFormatProvider?provider)
    {
        if (string.IsNullOrWhiteSpace(format))
        {
            return(DefaultName());
        }
        var culture = provider is null ? CultureInfo.CurrentCulture : (CultureInfo)provider;

        return(NameModel.FromUserModel(this) !.ToString(format, culture));
    }
 public void Init()
 {
     IdentificatorModel = new IdentificatorModel(this, _idControl);
     NameModel          = new NameModel(this);
     RelationshipModel  = GetRelationshipModel2(Model, new FamilyModel(this));
     RegstatusModel     = new RegstatusModel(this);
     AdressModel        = new AdressModel(this);
     SivilstatusModel   = new SivilstatusModel(this);
     _randomizer        = new Randomizer();
 }
Exemple #21
0
        public PersonPreg(Person person)
        {
            _person = person;
            DateWhenNameRegistered = NameModel.GetDateWhenNameRegistered(person);
            MaidenName             = person.WithoutLegalCapacity; //"låner" WithoutLegalCapacity, siden det ikke brukes
            var isFemale = CommonFunctions.IsFemale(person.NIN);

            GenderBackingValue = isFemale.HasValue ? (isFemale.Value ? 0 : 1) : 0;
            UpdatedDate        = PersonWithMetadata.GetLastUpdated(person);
            CreatedDate        = PersonWithMetadata.GetCreatedDate(person);
        }
Exemple #22
0
        public IActionResult Name()
        {
            NameModel nameModel = new NameModel();

            if (TempData.ContainsKey(NameTag) && !string.IsNullOrWhiteSpace((string)TempData.Peek(NameTag)))
            {
                nameModel.FullName = (string)TempData.Peek(NameTag);
            }

            return(View(nameModel));
        }
Exemple #23
0
        public HttpResponseMessage Create(NameModel data)
        {
            return(WrapInTryCatch(() =>
            {
                if (string.IsNullOrEmpty(data.Name))
                {
                    throw new ArgumentNullException();
                }

                _paperTypeService.Create(data.Name);
                return new HttpResponseMessage(HttpStatusCode.Created);
            }));
        }
Exemple #24
0
    public async Task <IEnumerable <NameModel> > GetNamesAsync()
    {
        var users = await GetAsync();

        List <NameModel> ret = new();

        foreach (var user in users)
        {
            var name = NameModel.FromUserModel(user) !;
            ret.Add(name);
        }
        return(ret);
    }
Exemple #25
0
 public ScimUserResponseModel(OrganizationUserUserDetails orgUser)
     : this()
 {
     Id          = orgUser.Id.ToString();
     ExternalId  = orgUser.ExternalId;
     UserName    = orgUser.Email;
     DisplayName = orgUser.Name;
     Emails      = new List <EmailModel> {
         new EmailModel(orgUser.Email)
     };
     Name   = new NameModel(orgUser.Name);
     Active = orgUser.Status != Core.Enums.OrganizationUserStatusType.Revoked;
 }
Exemple #26
0
        public HttpResponseMessage Update(string id, NameModel data)
        {
            return(WrapInTryCatch(() =>
            {
                if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(data.Name))
                {
                    throw new ArgumentNullException();
                }

                _queryTypeService.Upadate(id, data.Name);
                return new HttpResponseMessage(HttpStatusCode.OK);
            }));
        }
Exemple #27
0
        public async Task <NameModel> GetNameAsync()
        {
            var result = await GetDataAsync(_namesUri);

            if (result.Item1)
            {
                NameModel model = JsonConvert.DeserializeObject <NameModel>(result.Item2);
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #28
0
        public async Task <IActionResult> Post([FromBody] NameModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var name = Factory.Create(model);

            name.UserId = this.User.Identity.Name;
            int id = await Repository.AddName(name);

            return(Ok(id));
        }
Exemple #29
0
    public static async Task <IResult> GetName(string email, IUserService userService)
    {
        if (string.IsNullOrWhiteSpace(email))
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "email"))));
        }
        var user = await userService.ReadAsync(email);

        if (user is null)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.ItemNotFound, "user", "email", email))));
        }
        return(Results.Ok(NameModel.FromUserModel(user)));
    }
Exemple #30
0
        public string FillComponentInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string documentationOfdetais = string.Empty;

            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.Code        = patientinfo.EncounterCode;
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.DisplayName = patientinfo.EncounterDescription;
            IVXB_TS low = new IVXB_TS();

            if (patientinfo.EncounterNoteDate != null && patientinfo.EncounterNoteDate != "")
            {
                low.Init(Convert.ToDateTime(patientinfo.EncounterNoteDate));
                clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime = new IVL_TS().Init(low: low);
            }
            else
            {
                var times = hl7factory.CreateIVXB_TS();
                clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime.Init(null, times, times);
            }

            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");

            var EnName = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.AssignedPerson.Name.Append();

            addressphno             = new GenerateAddressPhNo();
            nameinfo                = new NameModel();
            nameinfo.Createenfamily = patientinfo.EncounterStaffName;
            addressphno.FillName(nameinfo, EnName, hl7factory);

            var EncounterParticipant = clinicalDoc.ComponentOf.EncompassingEncounter.EncounterParticipant.Append();

            hl7III = EncounterParticipant.AssignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");
            var ParticipantName = EncounterParticipant.AssignedEntity.AssignedPerson.Name.Append();

            addressphno.FillName(nameinfo, ParticipantName, hl7factory);

            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystem     = "2.16.840.1.113883.12.112";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.Code           = "01";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.DisplayName    = "Routine Discharge";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystemName = "HL7 Discharge Disposition";
            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Location.HealthCareFacility.Id.Append();
            hl7III.Init("2.16.540.1.113883.19.2");

            documentationOfdetais = clinicalDoc.Xml;
            return(documentationOfdetais);
        }