public AuthorAdd() { InitializeComponent(); var personRepo = new PersonRepo(); _authorRepo = new AuthorRepo(personRepo); }
public void DelButton_Click(object sender, EventArgs e) { var p = accountDataGrid.CurrentRow?.DataBoundItem as Person; if (p == null) { return; } if (MessageBox.Show(@"Видалити обране поле?", @"Видалення", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { try { using (var repo = new PersonRepo()) { repo.Delete(p); } } catch (Exception ex) { MessageBox.Show(ex.Message); } UpdateGrid(); } }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { var person = Mapper.ToPerson(model, user.Id); PersonRepo.Create(person); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void ProcessTest_GetAll() { var repo = new PersonRepo(); var data = repo.GetData(); Assert.IsTrue(data.Count > 0); }
public static void AddBdayMenu() { Console.ForegroundColor = ConsoleColor.Green; Console.Write("1"); Console.ForegroundColor = ConsoleColor.White; Console.Write("-Add more people | "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("2"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("-Back to main menu"); string inputAddMenu = Console.ReadLine(); Console.WriteLine(); if (inputAddMenu == "1") { PersonRepo.AddToList(); AddBdayMenu(); } else if (inputAddMenu == "2") { Starter(); } }
private void PopulatePersonTable(string query = "select * from person") { PersonRepo p = new PersonRepo(); this.dgvPersonView.AutoGenerateColumns = false; this.dgvPersonView.DataSource = p.GetAllPersons(query); }
public ActionResult Index() { var person = new PersonRepo(); var personList = person.GetData(); return(View(personList)); }
// // GET: /Manage/Index public async Task <ActionResult> Index(ManageMessageId?message) { ViewBag.StatusMessage = message == ManageMessageId.ChangePasswordSuccess ? "Ваш пароль змінено." : message == ManageMessageId.SetPasswordSuccess ? "Ваш пароль встановлено." : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set." : message == ManageMessageId.Error ? "An error has occurred." : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added." : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed." : ""; var userId = User.Identity.GetUserId(); var user = PersonRepo.Get(userId); var model = new IndexViewModel { HasPassword = HasPassword(), PhoneNumber = user.PhoneNumber,//await UserManager.GetPhoneNumberAsync(userId), TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId), Logins = await UserManager.GetLoginsAsync(userId), BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId), BirthDate = user.BirthDate, FirstName = user.FName, LastName = user.LName, MiddleName = user.MName, NickName = user.NickName, UniversityId = user.UniversityId, Email = user.Email, TeamName = user.TeamName }; return(View(model)); }
public void AcceptButton_Click(object sender, EventArgs e) { try { using (var repo = new PersonRepo()) { if (p == null) { repo.Add(new Person() { Name = personNameBox.Text }); } else { p.Name = Name = personNameBox.Text; repo.Save(p); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ActionResult Sort(int id) { List <PersonVM> personList = new List <PersonVM>(); if (TempData["memoryList"] != null) { personList = TempData["memoryList"] as List <PersonVM>; } else { personList = PersonRepo.GetAllPersonVM(); } switch (id) { case 1: personList = personList.OrderBy(p => p.Fname).ToList(); break; case 2: personList = personList.OrderBy(p => p.Lname).ToList(); break; case 3: personList = personList.OrderBy(p => p.PersonTypeName).ToList(); break; default: break; } TempData["list"] = personList; return(RedirectToAction("Index")); }
public ActionResult Index(int?id) { TempData["memoryList"] = null; if (TempData["list"] != null) { var result = TempData["list"] as List <PersonVM>; return(View(result)); } else { if (id.HasValue) { var result = PersonRepo.GetAllPersonVM((int)id); TempData["memoryList"] = result; return(View(result)); } else { var result = PersonRepo.GetAllPersonVM(); result = result.OrderBy(p => p.Fname).ToList(); return(View(result)); } } }
public SubscriberExtendByMonth() { _personRepo = new PersonRepo(); _subscriberRepo = new SubscriberRepo(_personRepo); InitializeComponent(); AdjustList(); }
public void CheckIfCorrectMethodCalled() { var sturbRepo = MockRepository.GenerateMock <IRepo>(); var controll = new PersonRepo(sturbRepo); sturbRepo.Expect(m => m.TestConnection()); controll.TestConnection(); }
// GET: Person public ActionResult Index() { //return "Hello from controller!"; var model = PersonRepo.CurrentPerson(); return(View("Index", model)); }
public ActionResult Index() { var repo = new PersonRepo(Properties.Settings.Default.ConStr); return(View(new HomePageViewModel { People = repo.GetPeople() })); }
public Form1() { InitializeComponent(); _personRepo = new PersonRepo(); listBox1.DisplayMember = "Name"; }
public BookByAuthor() { InitializeComponent(); _personRepo = new PersonRepo(); _authorRepo = new AuthorRepo(_personRepo); InitializeList(); RefreshInfo(); }
public ActionResult AddDetail(string detail) { var model = PersonRepo.CurrentPerson(); model.Details.Add(detail); return(View("Index", model)); }
private void PopulatePersonTable(string query = sql) { PersonRepo p = new PersonRepo(); this.dgvHireEmp.AutoGenerateColumns = false; // this.dgvHireEmp.DataSource = p.GetAllPersons(query); this.dgvHireEmp.DataSource = DataAccess.GetDataTable(query); }
private void btnSave_Click(object sender, EventArgs e) { try { this.CheckIfFieldEmpty(); PersonRepo p = new PersonRepo(); p.Name = this.txtFullName.Text; p.Age = Convert.ToInt32(this.txtAge.Text); p.Gender = this.cmbGender.Text; p.BloodGroup = this.cmbBloodGrp.Text; p.Phone = this.txtPhoneNumber.Text; EmployeeRepo e1 = new EmployeeRepo(); e1.Salary = Convert.ToInt32(this.txtSalary.Text); e1.Designation = this.cmbDesignation.Text; //e1.PersonIdOfEmp = Convert.ToInt32(this.txtId.Text); DoctorRepo dr = new DoctorRepo(); dr.Specialty = this.txtSpecialty.Text; dr.AvailableDays = this.cmbAvailableDays.Text; //dr.EmployeeIdOfDoctor = Convert.ToInt32(this.txtEmpId.Text); //person created p.CreatePerson(p.Name, p.Age, p.Gender, p.BloodGroup, p.Phone); this.PopulatePersonTable(); //refrsh //get last person DataTable lastperson = p.GetLastPerson(); //DataTable lastperson = p.GetLastPerson(); this.personID = Convert.ToInt32(lastperson.Rows[0]["personid"].ToString()); //getpersonid //this.personID = Convert.ToInt32(lastperson.Rows[0]["personid"].ToString()); //create emplyee e1.CreateEmployee(e1.Designation, e1.Salary, this.personID); if (this.cmbDesignation.Text == "Doctor") { DataTable lastemp = e1.GetLastEmployee(); this.empID = Convert.ToInt32(lastemp.Rows[0]["empid"].ToString()); //create doctor dr.CreateDoctor(dr.Specialty, dr.AvailableDays, empID); } MessageBox.Show("Successfully added!"); this.PopulatePersonTable(); this.ClearAll(); } catch (Exception exc) { MessageBox.Show("error!" + exc); } }
public AuthorRemove() { InitializeComponent(); var personRepo = new PersonRepo(); _authorRepo = new AuthorRepo(personRepo); _index = 0; SetData(); }
public MemberRemove() { InitializeComponent(); var personRepo = new PersonRepo(); _memberRepo = new MemberRepo(personRepo); _index = 0; SetData(); }
public StaffAdd() { InitializeComponent(); var personRepo = new PersonRepo(); _staffRepo = new StaffRepo(personRepo); _firstIteration = true; NewForm(); }
public StaffRemove() { InitializeComponent(); var personRepo = new PersonRepo(); _staffRepo = new StaffRepo(personRepo); _index = 0; SetData(); }
public SubscriberRemove() { InitializeComponent(); var personRepo = new PersonRepo(); _subscriberRepo = new SubscriberRepo(personRepo); _index = 0; SetData(); }
public void CheckIfWhenWrongMethodCalled() { var sturbRepo = MockRepository.GenerateMock <IRepo>(); var controll = new PersonRepo(sturbRepo); sturbRepo.Expect(m => m.TestConnection()); controll.Test(); sturbRepo.Stub(x => x.TestConnection()).Throw(new ArgumentException("IRepo.TestConnection(); Expected #1, Actual #0")); new PersonRepo().Test(); }
public SubscriberAdd() { InitializeComponent(); var personRepo = new PersonRepo(); _subscriptionRepo = new SubscriptionRepo(); _subscriberRepo = new SubscriberRepo(personRepo); _firstIteration = true; NewForm(); }
public StaffEdit() { InitializeComponent(); var personRepo = new PersonRepo(); _staffRepo = new StaffRepo(personRepo); _index = 0; _firstIteration = true; SetData(); }
public MemberAdd() { InitializeComponent(); var personRepo = new PersonRepo(); _memberRepo = new MemberRepo(personRepo); _institutionRepo = new InstitutionRepo(); _firstIteration = true; NewForm(); }
public MemberEdit() { InitializeComponent(); var personRepo = new PersonRepo(); _memberRepo = new MemberRepo(personRepo); _institutionRepo = new InstitutionRepo(); _firstIteration = true; _index = 0; SetData(); }
public void setup() { personRepo = new PersonRepo(); personRepo.add(new Person { First_Name = "Jake", Last_Name = "Ellis", Role_ID = 1, User_Name = "McLovin", E_Mail = "*****@*****.**", Phone = 1111, //phone number should probably be a long not an int Facebook_Key = "FB", Twitter_Key = "TW", Profile_ID = 12345, Party_Owner_ID = 918, Party_Participant = 1, IsActive = true } ); personRepo = new PersonRepo(); personRepo.add(new Person { First_Name = "J", Last_Name = "E", Role_ID = 2, User_Name = "McMuffin", E_Mail = "*****@*****.**", Phone = 2222, //phone number should probably be a long not an int Facebook_Key = "Face", Twitter_Key = "Twit", Profile_ID = 678910, Party_Owner_ID = 500, Party_Participant = 2 } ); }
public void setup() { songrepo = new SongRepo(); songrepo.add(new Song { Song_ID = 11111, HREF = "3240asfsadf92g342", Song_Name = "Get on My Level", Artist = "Steven", Popularity = "High" }); playlistrepo = new PlaylistRepo(); playlistrepo.add(new Playlist { Song_ID = "4", Playlist_ID = 4, Playlist_Title = "mongo", Party_ID = 4, Song_Vote = 1, Song_Title = "Get on My Level" }); partyrepo = new PartyRepo(); partyrepo.add(new Party { Party_ID = 4, Playlist = 4, Party_Title = "TEST", Participant_Count = 4, Genre_Limitation = "4", Repeat_Contraint = 1 }); role_permissionrepo = new Role_PermissionRepo(); role_permissionrepo.add(new Role_Permission { Role_Permission_Combo_ID = 4, Permission1 = true, Permission2 = true, PermissionN = 4 }); personrolerepo = new Person_RoleRepo(); personrolerepo.add(new Person_Role { Person_Role_ID = 4, Role_Title = "TEST", Role_Permission_Combo_ID = 4 }); personrepo = new PersonRepo(); personrepo.add(new Person { Person_ID = 4, Last_Name = "TEST", First_Name = "TEST", Role_ID = 4, User_Name = "TEST", Sex = null, E_Mail = "TEST@TEST", Phone = 1234567891, Facebook_Key = null, Twitter_Key = null, Spotify_Key = null, Profile_ID = 4, Party_Owner_ID = 4, Party_Participant = 4, IsActive = true, User_Password = "******", Security_Question1 = "test", Security_Question2 = "testtest", Secuirty_Answer1 = "test", Security_Answer2 = "testtest" }); }