public void SetUp() { _transactionScope = new TransactionScope(); _specialtyRepository = new SpecialtyRepository(); _specialtyDetailRepository = new SpecialtyDetailRepository(); _cathedraRepository = new CathedraRepository(); _facultyRepository = new FacultyRepository(); _faculty = new FacultyItem() { FullName = "Информационный", ShortName = "И", }; _cathedra = new CathedraItem() { FullName = "Информациионных систем и технологий", ShortName = "ИСиТ", FacultyId = _facultyRepository.Create(_faculty) }; _specialty = new SpecialtyItem() { FullName = "Программное обеспечение вычислительной техники и автоматизированных систем", ShortName = "Ифн", Code = "230105", CathedraId = _cathedraRepository.Create(_cathedra) }; _specialtyNew = new SpecialtyItem() { FullName = "Экономика и технология производства", ShortName = "ЭТП", Code = "230221", CathedraId = _cathedraRepository.Create(_cathedra) }; _specialtyDetail = new SpecialtyDetailItem() { ActualDate = new DateTime(2015, 01, 01), SpecialtyId = _specialtyRepository.Create(_specialty), SemestrCount = 1, TrainingPeriod = 1, Qualification = Qualification.Bachelor, FormStudy = FormStudy.Distance, PaySpace = 15, LowcostSpace = 4, }; _specialtyDetailNew = new SpecialtyDetailItem() { ActualDate = new DateTime(2015, 01, 02), SpecialtyId = _specialtyRepository.Create(_specialtyNew), SemestrCount = 2, TrainingPeriod = 2, Qualification = Qualification.Master, FormStudy = FormStudy.Fulltime, PaySpace = 30, LowcostSpace = 6, }; }
/// <summary> /// Проверяет эквивалентны ли две специальности. /// </summary> /// <param name="first_specialty">Первая специальность для сравнения.</param> /// <param name="second_specialty">Вторая специальность для сравнения.</param> private void AreEqualSpecialties(SpecialtyItem first_specialty, SpecialtyItem second_specialty) { Assert.AreEqual(first_specialty.Id, second_specialty.Id); Assert.AreEqual(first_specialty.FullName, second_specialty.FullName); Assert.AreEqual(first_specialty.ShortName, second_specialty.ShortName); Assert.AreEqual(first_specialty.Code, second_specialty.Code); }
/// <summary> /// Обновляет данные по специальности. /// </summary> /// <param name="specialty">Специальность.</param> public void Update(SpecialtyItem specialty) { using (var sqlh = new SqlHelper()) { sqlh.ExecNoQuery(@" update Specialty.specialty set full_name = @FullName, short_name = @ShortName, code = @Code, cathedra = @CathedraId where specialty = @Id", specialty); } }
public void SetUp() { _transactionScope = new TransactionScope(); _cathedraRepository = new CathedraRepository(); _specialtyRepository = new SpecialtyRepository(); _facultyIdRepository = new FacultyRepository(); _faculty = new FacultyItem() { FullName = "Информационный", ShortName = "И", }; _cathedra = new CathedraItem() { FullName = "Информациионных систем и технологий", ShortName = "ИСиТ", FacultyId = _facultyIdRepository.Create(_faculty) }; _cathedraNew = new CathedraItem() { FullName = "Экономика и организация производлства", ShortName = "ЭиОП", FacultyId = _facultyIdRepository.Create(_faculty) }; _specialty = new SpecialtyItem() { FullName = "Программное обеспечение вычислительной техники и автоматизированных систем", ShortName = "Ифн", Code = "230105", CathedraId = _cathedraRepository.Create(_cathedra) }; _specialtyNew = new SpecialtyItem() { FullName = "Сисадмин", ShortName = "Сис", Code = "123456", CathedraId = _cathedraRepository.Create(_cathedraNew) }; }
/// <summary> /// Создает новую специальность. /// </summary> /// <param name="specialty">Специальность.</param> /// <returns>Идентификатор созданной специальности.</returns> public int Create(SpecialtyItem specialty) { using (var sqlh = new SqlHelper()) { return(sqlh.ExecScalar <int>(@" insert into Specialty.specialty ( full_name, short_name, code, cathedra ) values ( @FullName, @ShortName, @Code, @CathedraId ) select scope_identity()", specialty)); } }