public ActionResult CreatePerson(NewPerson vm) { var db = new DatabaseContext(); var place = db.Places.FirstOrDefault(place => place.Id == vm.PlaceId); if (place == null) { return(NotFound()); } else { var newPerson = new Person { CharacterName = vm.CharacterName, ActorName = vm.ActorName, MainCharacter = vm.MainCharacter, Human = vm.Human, PlaceId = vm.PlaceId }; db.Persons.Add(newPerson); db.SaveChanges(); var rv = new CreatedPerson { Id = newPerson.Id, CharacterName = newPerson.CharacterName, ActorName = newPerson.ActorName, MainCharacter = newPerson.MainCharacter, PlaceId = newPerson.PlaceId, Human = newPerson.Human }; return(Ok(rv)); } }
protected override void LoadData() { try { ErrorMsg = string.Empty; InfoMsg = string.Empty; IscmdNewRegisterVisible = false; RoleList = new ObservableCollection <string>(); var lip = _DataService.LoggedInUser as PersonDetails; if (lip == null) { RoleList.Add("Diák"); IsCancelCommandVisible = true; } else { RoleList.Add("Diák"); RoleList.Add("Tanár"); RoleList.Add("Admin"); IsCancelCommandVisible = false; } NewPersonInst = NewPerson.Create(); RegisterCommand.RaiseCanExecuteChanged(); } catch (SessionExpiredException) { MessengerInstance.Send <NavigationMessage>(new NavigationMessage { View = ViewEnum.Login, UserState = "SessionExpired" }); } }
public ActionResult Register([Bind(Include = "LastName," + "FirstName," + "Email," + "PlainPassword," + "Apartment," + "Street," + "City," + "State," + "Zipcode," + "Phone")] NewPerson np) { Message msg = new Message(); int result = db.usp_Register(np.LastName, np.FirstName, np.Email, np.PlainPassword, np.Apartment, np.Street, np.City, np.State, np.Zipcode, np.Phone); if (result != -1) { msg.MessageText = "Welcome! Congrats on Registering, " + np.FirstName + " " + np.LastName; //return RedirectToAction("Login","Index"); } else { msg.MessageText = "Something went wrong! You need to try again. Do better! Be better!"; } return(View("Result", msg)); }
/// <summary> /// Handles the PagePropertiesChanging event of the lvAddFamily control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="PagePropertiesChangingEventArgs"/> instance containing the event data.</param> protected void lvAddFamily_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { var newFamilyList = new List <NewPerson>(); if (ViewState["newFamily"] != null) { newFamilyList = (List <NewPerson>)ViewState["newFamily"]; int personOffset = 0; foreach (ListViewItem item in lvAddFamily.Items) { var rowPerson = new NewPerson(); rowPerson.FirstName = ((TextBox)item.FindControl("tbFirstName")).Text; rowPerson.LastName = ((TextBox)item.FindControl("tbLastName")).Text; rowPerson.BirthDate = ((DatePicker)item.FindControl("dpBirthDate")).SelectedDate; rowPerson.Gender = ((RockDropDownList)item.FindControl("ddlGender")).SelectedValueAsEnum <Gender>(); rowPerson.Ability = ((RockDropDownList)item.FindControl("ddlAbilityGrade")).SelectedValue; rowPerson.AbilityGroup = ((RockDropDownList)item.FindControl("ddlAbilityGrade")).SelectedItem.Attributes["optiongroup"]; newFamilyList[System.Math.Abs(e.StartRowIndex - e.MaximumRows) + personOffset] = rowPerson; personOffset++; // check if the list should be expanded if (e.MaximumRows + e.StartRowIndex + personOffset >= newFamilyList.Count) { newFamilyList.AddRange(Enumerable.Repeat(new NewPerson(), e.MaximumRows)); } } } ViewState["newFamily"] = newFamilyList; dpAddFamily.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); lvAddFamily.DataSource = newFamilyList; lvAddFamily.DataBind(); mpeAddFamily.Show(); }
public ActionResult Index( [Bind(Include = "LastName, FirstName, Email, Phone, PlainPasswrod," + "Apartment, Street, City, State, Zipcode") ] NewPerson np) { int result = db.usp_Register( np.LastName, np.FirstName, np.Email, np.PlainPassword, np.Apartment, np.Street, np.City, np.State, np.Zipcode, np.Phone); Message m = new Message(); if (result == -1) { m.MessageText = "Sorry, but something seems to have gone wrong with the registration."; } else { m.MessageText = "Thanks for registering."; } return(View("Result", m)); }
public void RegisterPerson(NewPerson personinst) { using (JolTudomEWSClient client = new JolTudomEWSClient()) { try { client.NewUser(_Token, personinst.UserName, personinst.Prefix, personinst.LastName, personinst.MiddleName, personinst.FirstName, personinst.Password, personinst.RoleId); if (_Token == null) { Messenger.Default.Send <NavigationMessage>(new NavigationMessage { View = ViewEnum.Login }); } else { Messenger.Default.Send <NavigationMessage>(new NavigationMessage { View = ViewEnum.Admin, UserState = "NewPerson" }); } } catch (FaultException <ExceptionDetail> exc) { if (ExceptionHandler.IsSessionNotAvailableException(exc)) { throw new SessionExpiredException(); } else if (ExceptionHandler.IsSqlException(exc)) { throw new TranslatedException(ExceptionHandler.GetUserFriendlyErrorMessage(exc)); } else { throw; } } } }
public ActionResult Index([Bind(Include = "LastName, FirstName, Email, PlainPassword, Apartment, Street, City, State, Zipcode, Phone")] NewPerson p) { int result = np.usp_Register( p.LastName, p.FirstName, p.Email, p.PlainPassword, p.Apartment, p.Street, p.City, p.State, p.Zipcode, p.Phone); if (result != -1) { // Registration succeeded Message m = new Message(); m.MessageTitle = "Registration"; m.MessageText = "Thank You, " + p.FirstName + " for registering"; return(RedirectToAction("Result", m)); } Message bad = new Message(); bad.MessageTitle = "Registration"; bad.MessageText = "Sorry, misaglignment of quantum entanglement occured, your registration failed"; return(View("Result", bad)); }
public ActionResult Index([Bind(Include = "LastName,FirstName, Email, Phone, PlainPassword," + "Apartment,Street, City, State, Zipcode")] NewPerson r) { Message m = new Message(); int result = db.usp_Register(r.LastName, r.FirstName, r.Email, r.PlainPassword, r.Apartment, r.Street, r.City, r.State, r.Zipcode, r.Phone); if (result != -1) { m.Messagetext = "Welcome, " + r.LastName; } else { m.Messagetext = "Something went horribly wrong"; } return(View("Result", m)); }
public void TestConstructor_CheckIsDateOfBirthUnknown() { var user = new User(1); var isSingleName = false; var firstName = "first"; var lastName = "last"; var projectId = 1; var participantTypeId = ParticipantType.ForeignNonTravelingParticipant.Id; var gender = Gender.Female.Id; var dateOfBirth = DateTime.Now; var isDateOfBirthUnknown = true; var isDateOfBirthEstimated = false; var isPlaceOfBirthUnknown = false; var cityOfBirth = 5; var countriesOfCitizenship = new List <int> { 1 }; var instance = new NewPerson(user, projectId, participantTypeId, isSingleName, firstName, lastName, gender, dateOfBirth, isDateOfBirthUnknown, isDateOfBirthEstimated, isPlaceOfBirthUnknown, cityOfBirth, countriesOfCitizenship); Assert.AreEqual(isDateOfBirthUnknown, instance.IsDateOfBirthUnknown); }
public async Task CanEdit() { var pipedrive = Helper.GetAuthenticatedClient(); var fixture = pipedrive.Person; var newPerson = new NewPerson("new-name"); var person = await fixture.Create(newPerson); var editPerson = person.ToUpdate(); editPerson.Name = "updated-name"; editPerson.Email = new List <Email> { { new Email { Value = "*****@*****.**", Primary = true } } }; var updatedPerson = await fixture.Edit(person.Id, editPerson); Assert.Equal("updated-name", updatedPerson.Name); Assert.Equal("*****@*****.**", updatedPerson.Email[0].Value); Assert.True(updatedPerson.Email[0].Primary); // Cleanup await fixture.Delete(updatedPerson.Id); }
public ActionResult Register([Bind(Include = "lastname, firstname, email, password, " + "apartmentNumbr, street, city, state, zipcode, phone")] NewPerson R) { int result = db.usp_Register( R.lastname, R.firstname, R.email, R.password, R.apartmentNumber, R.street, R.city, R.state, R.zipcode, R.phone); Class1Messages m = new Class1Messages(); if (result != -1) { m.MessageText = "thanks for registering"; return(RedirectToAction("Result", m)); } m.MessageText = "opps, try again"; return(RedirectToAction("Result", m)); }
public ActionResult Index([Bind(Include = "LastName, " + "FirstName, " + "Apartment, " + "Street, " + "City, " + "State, " + "ZIPCode, " + "Phone, " + "EMail, " + "PlainPassword" )] NewPerson np) { int result = ca.usp_Register( np.LastName, np.FirstName, np.EMail, np.PlainPassword, np.Apartment, np.Street, np.City, np.State, np.ZIPCode, np.Phone ); Message msg = new Message(); msg.Succeeded = result != -1; // The stored procedure usp_Register has been set up to return -1 if it fails. return(View("Result", msg)); }
private void newPersonButton_Click(object sender, EventArgs e) { if (addressListBox.SelectedItem != null) { NewPerson test = new NewPerson(((Address)addressListBox.SelectedItem).name); test.Owner = this; test.Show(); } }
public ActionResult Register([Bind(Include = "lastname, firstname, email, password, apartmentNumber, street, city, state, zipcode, phone")] NewPerson newPerson) { int result = db.usp_Register(newPerson.LastName, newPerson.FirstName, newPerson.Email, newPerson.PlainPassword, newPerson.ApartmentNumber, newPerson.Street, newPerson.City, newPerson.State, newPerson.ZipCode, newPerson.Phone); if (result != -1) { return(RedirectToAction("Success")); } return(RedirectToAction("Failure")); }
public ActionResult Register([Bind(Include = "LastName, FirstName, Email, PlanPassword, Apartment, Street, City, State, Zipcode, Phone")] NewPerson p) { int result = db.usp_Register(p.LastName, p.FirstName, p.Email, p.PlainPassword, p.Apartment, p.Street, p.City, p.State, p.Zipcode, p.Phone); if (result != -1) { return(RedirectToAction("Index")); } return(View()); }
/// <summary> /// Functio static to Convert an object NewPerson from Client to Dal CL.Entities.Person from Dal /// </summary> /// <param name="entity">Client NewPerson</param> /// <returns>DAL CL.Entities.Person </returns> public static DAL.Entities.Person ToDal(this NewPerson entity) { if (entity == null) { return(null); } return(new DAL.Entities.Person { FirstName = entity.FirstName, LastName = entity.LastName }); }
public void PostsToTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new PersonsClient(connection); var newPerson = new NewPerson("name"); client.Create(newPerson); connection.Received().Post <Person>(Arg.Is <Uri>(u => u.ToString() == "persons"), Arg.Is <NewPerson>(d => d.Name == "name")); }
static void Main() { NewPerson obj = new NewPerson(); obj.NewPersonInfo(); // Здесь будет загружаться модуль Person.netmodule Person obj1 = new Person(); obj1.AboutPerson(); Console.ReadLine(); }
public ActionResult Register([Bind(Include = "LastName, FirstName, Email, " + "Phone")] NewPerson p) { int result = db.uRegister(p.LastName, p.FirstName, p.Email, p.Phone); if (result != -1) { return(RedirectToAction("Success")); } return(RedirectToAction("Failure")); }
public ActionResult Register([Bind(Include = "lastName, firstName, email, password, " + "apartmentNumber, street, city, state, zipcode, phone")] NewPerson p) { int result = db.usp_Register(p.LastName, p.FirstName, p.Email, p.Password, p.ApartmentNumber, p.Street, p.City, p.State, p.ZipCode, p.Phone); if (result != -1) { return(RedirectToAction("ThankYou")); } return(View()); }
public async Task <ActionResult <FindPersonResult> > Post(NewPerson newPerson) { await _commandProcessor.SendAsync(new AddPerson(newPerson.Name)); var addedPeson = await _queryProcessor.ExecuteAsync(new FindPersonByName(newPerson.Name)); if (addedPeson == null) { return(new NotFoundResult()); } return(Ok(addedPeson)); }
public ActionResult Register([Bind(Include = "LastName, FirstName, Email, Password, Apartment, Street, City, State, Zipcode, Phone")] NewPerson person) { int result = db.usp_Register(person.LastName, person.FirstName, person.Email, person.PlainPassword, person.Apartment, person.Street, person.City, person.State, person.Zipcode, person.Phone); Message m = new Message(); if (result != -1) { m.MessageText = "Thanks for registering."; return(RedirectToAction("Result", m)); } m.MessageText = "Sorry, but something seems to have gone wrong with registration."; return(RedirectToAction("Result", m)); }
public ActionResult Index([Bind(Include = "NewPersonLastName,NewPersonFirstName,NewPersonEmail,NewPersonPlainPassword,NewPersonApartment,NewPersonStreet,NewPersonCity,NewPersonState,NewPersonZipcode,NewPersonPhone")] NewPerson r) { CommunityAssist2017Entities db = new CommunityAssist2017Entities(); int result = db.usp_Register(r.NewPersonLastName, r.NewPersonFirstName, r.NewPersonEmail, r.NewPersonPlainPassword, r.NewPersonApartment, r.NewPersonStreet, r.NewPersonCity, r.NewPersonState, r.NewPersonZipcode, r.NewPersonPhone); if (result != -1) { return(RedirectToAction("Result")); } return(View("Index")); }
private void btnInsert_Click(object sender, RoutedEventArgs e) { stackPanel.Visibility = Visibility.Visible; //if (checkProperties(out count_mistakes) == 0) { checkProperties(); string status; bool is_male = false; if (checkMale.IsChecked == true) { is_male = true; } bool is_student = (checkStudent.IsChecked == true) ? true : false; bool on_budget = (is_student == true) && checkBudget.IsChecked.HasValue ? checkBudget.IsChecked.Value : false; try { NewPerson person = new NewPerson { SurName = txtSurname.Text, Name = txtName.Text, LastName = txtSecondName.Text, Passport = Convert.ToInt64(txtPassport.Text), IsMale = is_male, IsStudent = is_student, IsBudget = on_budget, Country = comboCountry.SelectedItem.ToString(), Contract = txtContract.Text, Floor = int.Parse(txtFloor.Text), Room = int.Parse(txtRoom.Text), RoomTypeName = comboRoomType.SelectedItem.ToString(), DateStart = dateStart.SelectedDate.Value, DateFinish = dateFinish.SelectedDate.Value }; using (IUnitOfWork unitOfWork = App.kernel.Get <IUnitOfWork>()) { status = unitOfWork.InsertNewPerson(person, AppSettings.Admin, AppSettings.DormId); unitOfWork.Complete(); } lblProgress.Content = "Выполнено. " + status; } catch (Exception ex) { lblProgress.Content = "Произошла ошибка..."; Debug.WriteLine(ex.ToString()); } } }
public ActionResult Index([Bind(Include = "lastname, firstname, email, password,ApartmentNumber, Street, City, State, Zipcode, Phone")] NewPerson n) { Message m = new Message(); int result = db.usp_Register(n.lastName, n.firstName, n.email, n.password, n.ApartmentNumber, n.Street, n.City, n.State, n.Zipcode, n.Phone); if (result != -1) { m.MessageText = "Welcome, " + n.firstName + n.firstName; } else { m.MessageText = "Something went horribly wrong"; } return(View("Result", m)); }
public ActionResult Index([Bind(Include = "LastName, FirstName, Email, Phone, PlainPassword, Apartment, Street, City, State, Zipcode")] NewPerson np) { Message m = new Message(); int result = db.usp_Register(np.LastName, np.FirstName, np.Email, np.PlainPassword, np.Apartment, np.Street, np.City, np.State, np.Zipcode, np.Phone); if (result != -1) { m.MessageText = "Welcome, " + np.FirstName; } else { m.MessageText = "Something went wrong"; } return(View("Result", m)); }
public ActionResult Register([Bind(Include = "PersonLastName, PersonFirstName, PersonEmail, PersonPhone, PersonPlainPassword")] NewPerson np) { Message m = new Message(); int result = db.usp_NewPerson(np.PersonLastName, np.PersonFirstName, np.PersonEmail, np.PersonPhone, np.PersonPlainPassword); if (result != -1) { m.MessageText = "Welcome, " + np.PersonFirstName; } else { m.MessageText = "Sorry, but something seems to have gone wrong with the registration."; } return(View("Result", m)); }
public ActionResult Index([Bind(Include = "LastName, FirstName, Email, Phone, Password")] NewPerson np) { Message m = new Message(); int result = db.usp_newPerson(np.LastName, np.FirstName, np.Email, np.Phone, np.Password); if (result != -1) { m.MessageText = "Welcome, " + np.FirstName; } else { m.MessageText = "Oops, something went wrong with the registration. Please try again!"; } return(View("Result", m)); }
public ActionResult Index([Bind(Include = "LastName, FirstName, Email, PlainPassword, Apartment, Street, City, State, Zipcode, Phone")] NewPerson p) { Message m = new Message(); int result = db.usp_Register(p.LastName, p.FirstName, p.Email, p.PlainPassword, p.Apartment, p.Street, p.City, p.State, p.Zipcode, p.Phone); if (result != -1) { m.MessageText = "Welcome, " + p.FirstName; } else { m.MessageText = "Registration has failed."; } return(View("Result", m)); }
public ActionResult Index([Bind(Include = "PersonLastName, PersonFirstName, PersonEmail, PersonPrimaryPhone, PersonAddressApt, PersonAddressStreet, PersonAddressCity, PersonAddressState, PersonAddressPostal, PersonPlainPassword")] NewPerson np) { int result = db.usp_Register(np.PersonLastName, np.PersonFirstName, np.PersonEmail, np.PersonPlainPassword, np.PersonAddressApt, np.PersonAddressStreet, np.PersonAddressCity, np.PersonAddressState, np.PersonAddressPostal, np.PersonPrimaryPhone); var resultMessage = new Message(); if (result != -1) { resultMessage.MessageText = "Thanks for registering."; } else { resultMessage.MessageText = "Sorry, but something seems to have gone wrong with the registration."; } return(View("Result", resultMessage)); }
/// <summary> /// Handles the Click event of the lbAddFamilySave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void lbSaveFamily_Click( object sender, EventArgs e ) { var newFamilyList = (List<NewPerson>)ViewState["newFamily"]; var checkInFamily = new CheckInFamily(); CheckInPerson checkInPerson; NewPerson newPerson; // add the new people foreach ( ListViewItem item in lvAddFamily.Items ) { newPerson = new NewPerson(); newPerson.FirstName = ( (TextBox)item.FindControl( "tbFirstName" ) ).Text; newPerson.LastName = ( (TextBox)item.FindControl( "tbLastName" ) ).Text; newPerson.BirthDate = ( (DatePicker)item.FindControl( "dpBirthDate" ) ).SelectedDate; newPerson.Gender = ( (RockDropDownList)item.FindControl( "ddlGender" ) ).SelectedValueAsEnum<Gender>(); newPerson.Ability = ( (RockDropDownList)item.FindControl( "ddlAbilityGrade" ) ).SelectedValue; newPerson.AbilityGroup = ( (RockDropDownList)item.FindControl( "ddlAbilityGrade" ) ).SelectedItem.Attributes["optiongroup"]; newFamilyList.Add( newPerson ); } var lastName = newFamilyList.Where( p => p.BirthDate.HasValue ).OrderBy( p => p.BirthDate ).Select( p => p.LastName ).FirstOrDefault(); var familyGroup = CreateFamily( lastName ); // create people and add to checkin foreach ( NewPerson np in newFamilyList.Where( np => np.IsValid() ) ) { var person = CreatePerson( np.FirstName, np.LastName, np.BirthDate, (int)np.Gender, np.Ability, np.AbilityGroup ); var groupMember = AddGroupMember( familyGroup.Id, person ); familyGroup.Members.Add( groupMember ); checkInPerson = new CheckInPerson(); checkInPerson.Person = person; checkInPerson.Selected = true; checkInPerson.FamilyMember = true; checkInFamily.People.Add( checkInPerson ); } checkInFamily.Group = familyGroup; checkInFamily.Caption = familyGroup.Name; checkInFamily.SubCaption = string.Join( ",", checkInFamily.People.Select( p => p.Person.FirstName ) ); checkInFamily.Selected = true; CurrentCheckInState.CheckIn.Families.Clear(); CurrentCheckInState.CheckIn.Families.Add( checkInFamily ); ProcessFamily(); RefreshFamily(); }
/// <summary> /// Handles the PagePropertiesChanging event of the lvAddFamily control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="PagePropertiesChangingEventArgs"/> instance containing the event data.</param> protected void lvAddFamily_PagePropertiesChanging( object sender, PagePropertiesChangingEventArgs e ) { var newFamilyList = new List<NewPerson>(); if ( ViewState["newFamily"] != null ) { newFamilyList = (List<NewPerson>)ViewState["newFamily"]; int personOffset = 0; foreach ( ListViewItem item in lvAddFamily.Items ) { var rowPerson = new NewPerson(); rowPerson.FirstName = ( (TextBox)item.FindControl( "tbFirstName" ) ).Text; rowPerson.LastName = ( (TextBox)item.FindControl( "tbLastName" ) ).Text; rowPerson.BirthDate = ( (DatePicker)item.FindControl( "dpBirthDate" ) ).SelectedDate; rowPerson.Gender = ( (RockDropDownList)item.FindControl( "ddlGender" ) ).SelectedValueAsEnum<Gender>(); rowPerson.Ability = ( (RockDropDownList)item.FindControl( "ddlAbilityGrade" ) ).SelectedValue; rowPerson.AbilityGroup = ( (RockDropDownList)item.FindControl( "ddlAbilityGrade" ) ).SelectedItem.Attributes["optiongroup"]; newFamilyList[System.Math.Abs( e.StartRowIndex - e.MaximumRows ) + personOffset] = rowPerson; personOffset++; // check if the list should be expanded if ( e.MaximumRows + e.StartRowIndex + personOffset >= newFamilyList.Count ) { newFamilyList.AddRange( Enumerable.Repeat( new NewPerson(), e.MaximumRows ) ); } } } ViewState["newFamily"] = newFamilyList; dpAddFamily.SetPageProperties( e.StartRowIndex, e.MaximumRows, false ); lvAddFamily.DataSource = newFamilyList; lvAddFamily.DataBind(); mpeAddFamily.Show(); }