public void ImportFromExcelFile(string path) { var excelRepository = new ExcelRepository(); var data = excelRepository.GetAllDataFrom(path, "ESPECIALIDADES.xls", "Plan1"); var list = new List<Specialty>(); foreach (DataRow row in data.Rows) { var specialty = new Specialty(); foreach (DataColumn column in data.Columns) { switch (column.Caption) { case "Código do Termo": specialty.CodeTerm = row[column].ToString(); break; case "Termo": specialty.Description = row[column].ToString(); break; } } list.Add(specialty); } var specialties = new Specialties(); specialties.SaveList(list); }
public JsonResult GetDoctorsWithSpeciality(Specialties speciality) { var doctors = new Dictionary <string, string>(); _userService.GetDoctors() .Result .Where(x => x.IsDoctor() && x.Doctor.Speciality.Equals(speciality)) .ToList() .ForEach(x => doctors.Add(x.Id.ToString(), x.GetFullName())); return(Json(new { ok = false, data = doctors, message = "ok" })); }
public async Task <IActionResult> ConfirmDeleteSpeciality(int?id) { if (id != null) { Specialties specialties = await db.Specialties.FirstOrDefaultAsync(p => p.id_spec == id); if (specialties != null) { return(View(specialties)); } } return(NotFound()); }
public Student(string FirstName, string MiddleName, string LastName, int SSN, int Mobile, string Course, Universities University, Faculties Faculty, Specialties Specialty) { this.FirstName = FirstName; this.MiddleName = MiddleName; this.LastName = LastName; this.SSN = SSN; this.Mobile = Mobile; this.PermanentAddress = new Address(); this.Course = Course; this.University = University; this.Faculty = Faculty; this.Specialty = Specialty; }
//constuctors public Student(string firstName, string middleName, string lastName, long ssn, string permanentAddress, string mobilePhoneEmail, int course, Specialties specialty, Universities university, Faculties faculty) { this.firstName = firstName; this.middleName = middleName; this.lastName = lastName; this.ssn = ssn; this.permanentAddress = permanentAddress; this.mobilePhoneEmail = mobilePhoneEmail; this.course = course; this.specialty = specialty; this.university = university; this.faculty = faculty; }
public ActionResult Edit(Specialties Specialties) { if (ModelState.IsValid) { db.Entry(Specialties).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }
//constuctors public Student(string firstName, string middleName, string lastName, long ssn, string permanentAddress, string mobilePhoneEmail, int course, Specialties specialty, Universities university, Faculties faculty) { this.firstName = firstName; this.middleName = middleName; this.lastName = lastName; this.ssn = ssn; this.permanentAddress = permanentAddress; this.mobilePhoneEmail = mobilePhoneEmail; this.course = course; this.specialty = specialty; this.university = university; this.faculty = faculty; }
public IActionResult GetExtendedSpecialties(int id) { Specialties currentSpeciality = context.SpecialityDB.GetExtendedSpecialties().FirstOrDefault(x => x.Id == id); if (currentSpeciality == null) { return(NotFound()); } else { return(new ObjectResult(currentSpeciality)); } }
public bool ChangeSpeciality(Specialties _changedSpeciality) { //доделать проверку на факультет и квалификацию connection.Open(); MySqlCommand cmd = new MySqlCommand("UPDATE `tusurwebapi`.`Specialties` SET `Name` = '" + _changedSpeciality.Name + "', `Faculty` = '9', `FreePlaces` = '" + _changedSpeciality.FreePlaces + "'," + " `PayPlaces` = '" + _changedSpeciality.PayPlaces + "', `StartNumberOfPointsInPastYear` = '" + _changedSpeciality.StartNumberOfPointsInPastYear + "'," + " `Price` = '" + _changedSpeciality.Price + "', `Duration` = '" + _changedSpeciality.Duration + "', `Qualification` = '2', `Testing` = '" + _changedSpeciality.Testing + "'" + " WHERE `Specialties`.`Id` = " + _changedSpeciality.Id + ";", connection); var ans = cmd.ExecuteNonQuery(); connection.Close(); return(Convert.ToBoolean(ans)); }
public void GetTest_ReturnDataField() { // arrange int id = 1; string specialties = "perm"; Specialties testSpecialties = new Specialties(specialties, id); // act string result = testSpecialties.GetSpecialties(); // assert Assert.AreEqual(specialties, result); }
public JsonResult Specialties(string t) { if (!string.IsNullOrEmpty(t)) { var criteria = ExamineManager.Instance .SearchProviderCollection["ExternalSearcher"] .CreateSearchCriteria(); // Find pages that contain our search text in either their nodeName or bodyText fields... // but exclude any pages that have been hidden. // searchCriteria.Fields("nodeName",terms.Boost(8)).Or().Field("metaTitle","hello".Boost(5)).Compile(); Examine.SearchCriteria.IBooleanOperation crawl = null; string[] splitSearch = t.Split(' '); int i = 0; for (i = 0; i < splitSearch.Length; i++) { crawl = criteria.GroupedOr(new string[] { "nodeName", "specialty", "availableAtLocations" }, splitSearch[i].MultipleCharacterWildcard()) .And().NodeTypeAlias("providerType") .Not() .Field("umbracoNaviHide", "1"); } ISearchResults SearchResults = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"].Search(crawl.Compile()); IList <Specialties> results = new List <Specialties>(); foreach (SearchResult sr in SearchResults) { string niceUrl = Umbraco.NiceUrl(sr.Id); Specialties result = new Specialties() { Id = sr.Id, Score = (int)Math.Min(sr.Score * 100, 100), Url = sr.Fields["urlName"], Name = sr.Fields["nodeName"], NiceUrl = niceUrl, NodeAliasType = sr.Fields["nodeTypeAlias"] }; results.Add(result); } return(Json(results, JsonRequestBehavior.AllowGet)); } else { return(Json("Search term not found", JsonRequestBehavior.AllowGet)); } }
public bool AddSpeciality(Specialties _speciality) { //доделать проверку на факультет и квалификацию connection.Open(); MySqlCommand cmd = new MySqlCommand("INSERT INTO `tusurwebapi`.`Specialties` (`Id`, `Name`, `Faculty`, `FreePlaces`, `PayPlaces`," + " `StartNumberOfPointsInPastYear`, `Price`, `Duration`, `Qualification`, `Testing`) " + "VALUES (NULL, '" + _speciality.Name + "', '10', '" + _speciality.FreePlaces + "', '" + _speciality.PayPlaces + "'," + " '" + _speciality.StartNumberOfPointsInPastYear + "', '" + _speciality.Price + "', '" + _speciality.Duration + "'," + " '3', '" + _speciality.Qualification + "');", connection); var ans = cmd.ExecuteNonQuery(); connection.Close(); return(Convert.ToBoolean(ans)); }
// constructors public Student(string fName, string mName, string lName, string currentStSSN, string stAddress, string phoneNum, string stEmail, int inputCourse, Specialties specialtyName, Faculties facultyName, Universities universityName) { this.FirstName = fName; this.MiddleName = mName; this.LastName = lName; this.SSN = currentStSSN; this.PermanentAddress = stAddress; this.MobilePhone = phoneNum; this.Email = stEmail; this.Course = inputCourse; this.specialty = specialtyName; // do I need to validate the input data for fields this.faculty = facultyName; this.university = universityName; }
public ActionResult Create(Specialties Specialy) { if (ModelState.IsValid) { db.Specialties.Add(Specialy); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }
public async Task <IActionResult> DeleteSpeciality(int?id) { if (id != null) { Specialties specialties = new Specialties { id_spec = id.Value }; db.Entry(specialties).State = EntityState.Deleted; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(NotFound()); }
public Student(Name name, string ssn, Address address, string mobilePhone, string email, int course, Specialties specialty, Universities university, Faculties faculty) { this.Name = name; this.SSN = ssn; this.Address = address; this.MobilePhone = mobilePhone; this.EMail = email; this.Course = course; this.Specialty = specialty; this.University = university; this.Faculty = faculty; }
public Student(string fName, string mName, string lName, string ssn, string addr, string number, string mail, ushort course, Universities uni, Faculties facult, Specialties specialty) { this.FirstName = fName; this.MiddleName = mName; this.LastName = lName; this.SSN = ssn; this.Address = addr; this.PhoneNumber = number; this.Email = mail; this.Course = course; this.University = uni; this.Faculty = facult; this.Specialty = specialty; }
//Constructor public Student(string firstName, string middleName, string lastName, uint ssn, string permanentAddress, uint mobilePhone, string eMail, byte course, Universities university, Faculties faculty, Specialties specialty) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.SSN = ssn; this.PermanentAddress = permanentAddress; this.MobilePhone = mobilePhone; this.EMail = eMail; this.Course = course; this.University = university; this.Faculty = faculty; this.Specialty = specialty; }
public Student(string firstName, string middleName, string lastName, int ssn, string address, string phone, string email, int course, Specialties specialty, Universities university, Faculties faculty) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.Ssn = ssn; this.Address = address; this.Phone = phone; this.Email = email; this.Course = course; this.Specialty = specialty; this.University = university; this.Faculty = faculty; }
public void SaveAndGetAll_SavesToDatabaseAndReturnAll_Specialties() { //Arrange Specialties testSpecialty = new Specialties("testName"); //Act testSpecialty.Save(); List <Specialties> result = Specialties.GetAll(); List <Specialties> testList = new List <Specialties> { testSpecialty }; //Assert CollectionAssert.AreEqual(testList, result); }
public void Save_AssignsIdToObject_Id() { //Arrange Specialties testSpecialty = new Specialties("testName"); //Act testSpecialty.Save(); Specialties savedSpecialty = Specialties.GetAll()[0]; int result = savedSpecialty.GetId(); int testId = testSpecialty.GetId(); //Assert Assert.AreEqual(testId, result); }
public Student(string firstName, string middleName, string lastName, uint ssn, string address, string phoneNumber, string email, int course, Specialties specialities, University university, Faculty faculty) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.SSN = ssn; this.Address = address; this.PhoneNumber = phoneNumber; this.Email = email; this.Course = course; this.Specialties = specialities; this.University = university; this.Faculty = faculty; }
// Constructors public Student(string fName, string mName, string lName, string ssn, string address, string phone, string email, string course, Specialties speciality, Universities university, Faculties faculty) { this.FName = fName; this.MName = mName; this.LName = lName; this.SSN = ssn; this.Address = address; this.Phone = phone; this.EMail = email; this.Course = course; this.Speciality = speciality; this.University = university; this.Faculty = faculty; }
public Student(string firstName, string middleName, string lastName, string SSN, string permanentAddress, string mobilePhone, string email, int course, Specialties speciality, Universities university, Faculties faculty) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.SSN = SSN; this.PermanentAddress = permanentAddress; this.MobilePhone = mobilePhone; this.Email = email; this.Course = course; this.Speciality = speciality; this.University = university; this.Faculty = faculty; }
public async Task <IActionResult> Edit(int id, Specialties specialties) { if (id != specialties.Id) { return(NotFound()); } if (ModelState.IsValid) { _db.Update(specialties); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(specialties)); }
public Student(string firstName, string middleName, string lastName, string socialSecurityNumber, string address, string mobilePhone, string email, string course, Universities university, Faculties faculty, Specialties speciality) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.SocialSecurityNumber = socialSecurityNumber; this.Address = address; this.MobilePhone = mobilePhone; this.Email = email; this.Course = course; this.University = university; this.Faculty = faculty; this.Speciality = speciality; }
public Doctor( string FirstName, string LastName, string Address, string PhoneNumber, DateTime Birthdate, Specialties Specialty ) : base( FirstName, LastName, Address, PhoneNumber, Birthdate ) { this.Specialty = Specialty; }
public Student Clone() { Student original = this; string firstName = original.FirstName; string middleName = original.MiddleName; string lastName = original.LastName; long ssn = original.Ssn; string address = original.Address; string phone = original.Phone; string email = original.Email; string course = original.Course; Specialties specialty = original.Specialty; Universities university = original.University; Faculties faculty = original.Faculty; return(new Student(firstName, middleName, lastName, ssn, address, phone, email, course, specialty, university, faculty)); }
public Student(string firstName, string middleName, string lastName, string address = null, int? mobilePhone = null, string email = null, int? course = null, int? number = null, University? university = null, Faculty? faculty = null, Specialties? specialties = null) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.Address = address; this.MobilePhone = mobilePhone; this.Email = email; this.Course = course; this.Number = number; this.University = university; this.Faculty = faculty; this.Specialties = specialties; }
private void RefreshSpecialtyProperty() { Specialties.Clear(); try { DbContext.Specialties.OrderBy(x => x.Name).ToList().ForEach(x => Specialties.Add(x)); OnPropertyChanged(nameof(Specialties)); } catch (EntityException e) { OnEntityException(e); } catch (DbEntityValidationException e) { OnDbEntityValidationException(e); } }
} // Calls the second constructor public Student( string firstName = "", string middleName = "", string lastName = "", string ssn = "", string address = "", string mobileNumber = "", string email = "", byte course = 0, Specialties specialty = Specialties.Undefined, Universities university = Universities.Undefined, Faculties faculty = Faculties.Undefined) { this.FirstName = firstName; this.MiddleName = middleName; this.LastName = lastName; this.SSN = ssn; this.Address = address; this.MobileNumber = mobileNumber; this.Email = email; this.Course = course; this.Specialty = specialty; this.University = university; this.Faculty = faculty; }
public void Find_FindSpecialtyInDatabase_Specialties() { //Arrange Specialties testSpecialty = new Specialties("testName"); testSpecialty.Save(); List <Specialties> testList = new List <Specialties> { testSpecialty }; //Act Specialties resultById = Specialties.FindById(testSpecialty.GetId()); List <Specialties> resultByName = Specialties.FindByName(testSpecialty.GetSpecialties()); //Assert Assert.AreEqual(testSpecialty, resultById); CollectionAssert.AreEqual(testList, resultByName); }
public void ReadAllAndAddAndDelete_ThenOutIsActualNameOfSpecialtiesTable(string actualName, string infoOfSpecialty) { //Arrage Specialties actual = new Specialties() { Id = 5, NameOfSpecialty = actualName, InfoOfSpecialty = infoOfSpecialty }; //Act specialties = new ADOLinqToSQL <Specialties>(connectionString); specialties.CreateElement(actual); var lastAddedName = specialties.ReadAllElementFromDatabase().ToList().Last().NameOfSpecialty; var lastAddedId = specialties.ReadAllElementFromDatabase().ToList().Last().Id; specialties.DeleteElement(lastAddedId); //Assert Assert.AreEqual(lastAddedName, actualName); }
public void Delete_DeleteStylistFromDatabaseAndStylist_SpecialtyTable_Stylist() { // Arrange Stylist testStylist = new Stylist("testName", "testDescription", 1); testStylist.Save(); Specialties testSpecialty = new Specialties("testSpecialty"); testSpecialty.Save(); StylistSpecialties testStylistSpecialty = new StylistSpecialties(testStylist.GetId(), testSpecialty.GetId()); testStylistSpecialty.Save(); // Act testStylist.Delete(); // Assert Assert.AreEqual(0, Stylist.FindById(testStylist.GetId()).GetId()); Assert.AreEqual(0, testSpecialty.GetStylists().Count); }
private void RefreshSpecialtyForSearchProperty() { SpecialtiesForSearch.Clear(); try { Specialty item0 = new Specialty { Id = 0, Name = DafaultConstant.DefaultSpecialty }; SpecialtiesForSearch.Add(item0); Specialties.ToList().ForEach(x => SpecialtiesForSearch.Add(x)); OnPropertyChanged(nameof(SpecialtiesForSearch)); } catch (EntityException e) { OnEntityException(e); } catch (DbEntityValidationException e) { OnDbEntityValidationException(e); } }
//Constructor public University(Universities uni, Faculties facultet, Specialties specialty) { this.Univercities = uni; this.Faculty = facultet; this.Specialty = specialty; }