private void AddSubject_Click(object sender, EventArgs e) { string name = FindViewById <EditText>(Resource.Id.dean_newSubject_name).Text; if (DataBaseHelper.IsServerAlive()) { DataBaseHelper.AddNewSubgect(name); Toast.MakeText(this, "New subject is added!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Server isn't alive", ToastLength.Long).Show(); } Finish(); }
private void AddProfessor_Click(object sender, EventArgs e) { string name = FindViewById <EditText>(Resource.Id.dean_newProfessor_Name).Text; int phone = int.Parse(FindViewById <EditText>(Resource.Id.dean_newProfessor_phone).Text); int room = int.Parse(FindViewById <EditText>(Resource.Id.dean_newProfessor_room).Text); if (DataBaseHelper.IsServerAlive()) { DataBaseHelper.AddNewProfessor(name, phone, room); Toast.MakeText(this, "New professor is added!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Server isn't alive", ToastLength.Long).Show(); } Finish(); }
private void AddStd_Click(object sender, EventArgs e) { string name = FindViewById <EditText>(Resource.Id.dean_newStd_Name).Text; int phone = int.Parse(FindViewById <EditText>(Resource.Id.dean_newStd_Phone).Text); int group = int.Parse(FindViewById <EditText>(Resource.Id.dean_newStd_GroupNumber).Text); int year = int.Parse(FindViewById <EditText>(Resource.Id.dean_newStd_StartYear).Text); int groupId = DataBaseHelper.GetGroupIDByNumberAndYear(group, year); Toast.MakeText(Application.Context, name + " " + phone + " " + group + " " + year, ToastLength.Long).Show(); if (DataBaseHelper.IsServerAlive()) { DataBaseHelper.AddNewStudent(name, groupId, phone); Toast.MakeText(this, "New student is added!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Server isn't alive", ToastLength.Long).Show(); } Finish(); }
private void ButtonAddGroup(object sender, EventArgs e) { int course = int.Parse(FindViewById <EditText>(Resource.Id.dean_addGroup_Course).Text); int groupNumber = int.Parse(FindViewById <EditText>(Resource.Id.dean_addGroup_GroupNumber).Text); int year = int.Parse(FindViewById <EditText>(Resource.Id.dean_addGroup_EntryYear).Text); if (DataBaseHelper.IsServerAlive()) { if (DataBaseHelper.GetGroupIDByNumberAndYear(groupNumber, year) == -1) { DataBaseHelper.AddNewGroup(course, groupNumber, year); Toast.MakeText(this, "New group is added!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "That group is exist already", ToastLength.Long).Show(); } } else { Toast.MakeText(this, "Server isn't alive", ToastLength.Long).Show(); } Finish(); }