private void button1_Click(object sender, EventArgs e) { LessonSchool lesson = new LessonSchool(); // bool check= ValidateForm(); // if (check == true) // { string nameNew = LessonsName.Text; string nameEx = LessonsList.GetItemText(LessonsList.SelectedItem); string date = DateTbx.Text; string time = TimeTbx.Text; // var date = DateTime.ParseExact(dateS, "yyyyMMdd", null); //DateTime date = DateTime.Parse(DateTbx.Text); //DateTime time = DateTime.Parse(TimeTbx.Text); string groupName = GroupList.GetItemText(GroupList.SelectedItem); string courseName = CourseList.GetItemText(CourseList.SelectedItem); string roomName = RoomList.GetItemText(RoomList.SelectedItem); if (choose == 2) { ValidateForm(); string text = lesson.addNewLesson(nameNew, date, time, courseName, groupName, roomName); MessageBox.Show(text); } if (choose == 1) { ValidateForm(); string text = lesson.changeLesson(nameEx, date, time, courseName, groupName, roomName); MessageBox.Show(text); } //} }
public ViewAllShedule() { InitializeComponent(); LessonSchool lessonSchool = new LessonSchool(); List <LessonSchool> list = new List <LessonSchool>(); list = lessonSchool.getSchedule(); ScheduleList.DataSource = list; }
public UserForm() { InitializeComponent(); LessonSchool lessonSchool = new LessonSchool(); List <LessonSchool> list = new List <LessonSchool>(); list = lessonSchool.getSchedule(); listBox1.DataSource = list; }
public void GeLessonIdTest() { string connStr = @"Data Source=DESKTOP-SDGK59R\SQLEXPRESS; Initial Catalog=dance_school; Integrated Security=True"; using (TransactionScope ts = new TransactionScope()) { using (SqlConnection connection = new SqlConnection(connStr)) { connection.Open(); LessonSchool lesson = new LessonSchool(); int id = lesson.getLessonId("L1 "); Assert.AreEqual(1, id); } } }
public void ViewScheduleTest() { string connStr = @"Data Source=DESKTOP-SDGK59R\SQLEXPRESS; Initial Catalog=dance_school; Integrated Security=True"; using (TransactionScope ts = new TransactionScope()) { using (SqlConnection connection = new SqlConnection(connStr)) { connection.Open(); LessonSchool lesson = new LessonSchool(); List <LessonSchool> list = lesson.getSchedule(); Assert.AreEqual(1, list.Count); } } }