public string update(TeacherCardItem TeacherCardItem, int id) { var response = ApiHelper.Post(ApiEndpoint + "/teacherCardItem/" + id.ToString(), new Dictionary <string, string> { { "semester", TeacherCardItem.semester.ToString() }, { "code", TeacherCardItem.code }, { "discipline_name", TeacherCardItem.discipline_name }, { "group_name", TeacherCardItem.group_name }, { "group_count", TeacherCardItem.group_count.ToString() }, { "group_students_count", TeacherCardItem.group_students_count.ToString() }, { "lecture_hours", TeacherCardItem.lecture_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "lab_hours", TeacherCardItem.lab_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "practice_hours", TeacherCardItem.practice_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "exam_hours", TeacherCardItem.exam_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "zach_hours", TeacherCardItem.zach_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "zach_with_mark_hours", TeacherCardItem.zach_with_mark_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "course_project_hours", TeacherCardItem.course_project_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "course_task_hours", TeacherCardItem.course_task_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "control_task_hours", TeacherCardItem.control_task_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "referat_hours", TeacherCardItem.referat_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "essay_hours", TeacherCardItem.essay_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "head_of_practice_hours", TeacherCardItem.head_of_practice_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "head_of_vkr_hours", TeacherCardItem.head_of_vkr_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "iga_hours", TeacherCardItem.iga_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "nra_hours", TeacherCardItem.nra_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "nrm_hours", TeacherCardItem.nrm_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "individual_hours", TeacherCardItem.individual_hours.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) }, { "teacher_card_id", TeacherCardItem.teacher_card_id.ToString() }, { "real_teacher_id", TeacherCardItem.real_teacher_id.ToString() } }); return(response); }
private void tciAdd_Click(object sender, EventArgs e) { var newTeacherCardItem = new TeacherCardItem { semester = Utilities.ParseIntOrZero(tciSemester.Text), code = tciCode.Text, discipline_name = tciDiscipline_name.Text, group_name = tciGroup_name.Text, group_count = Utilities.ParseIntOrZero(tciGroup_count.Text), group_students_count = Utilities.ParseIntOrZero(tciGroup_students_count.Text), lecture_hours = Utilities.ParseDecOrZero(tciLecture_hours.Text), lab_hours = Utilities.ParseDecOrZero(tciLab_hours.Text), practice_hours = Utilities.ParseDecOrZero(tciPractice_hours.Text), exam_hours = Utilities.ParseDecOrZero(tciExam_hours.Text), zach_hours = Utilities.ParseDecOrZero(tciZach_hours.Text), zach_with_mark_hours = Utilities.ParseDecOrZero(tciZach_with_mark_hours.Text), course_project_hours = Utilities.ParseDecOrZero(tciCourse_project_hours.Text), course_task_hours = Utilities.ParseDecOrZero(tciCourse_task_hours.Text), control_task_hours = Utilities.ParseDecOrZero(tciControl_task_hours.Text), referat_hours = Utilities.ParseDecOrZero(tciReferat_hours.Text), essay_hours = Utilities.ParseDecOrZero(tciEssay_hours.Text), head_of_practice_hours = Utilities.ParseDecOrZero(tciHead_of_practice_hours.Text), head_of_vkr_hours = Utilities.ParseDecOrZero(tciHead_of_vkr_hours.Text), iga_hours = Utilities.ParseDecOrZero(tciIga_hours.Text), nra_hours = Utilities.ParseDecOrZero(tciNra_hours.Text), nrm_hours = Utilities.ParseDecOrZero(tciNrm_hours.Text), individual_hours = Utilities.ParseDecOrZero(tciIndividual_hours.Text), real_teacher_id = (int)tciRealTeacher.SelectedValue, teacher_card_id = currectCardJoined.id }; tciRepo.add(newTeacherCardItem); UpdateTeacherCardItemsList(); }
public TeacherCardItemView(TeacherCardItem item, List <Teacher> teachers) { id = item.id; semester = item.semester; code = item.code; discipline_name = item.discipline_name; group_name = item.group_name; group_count = item.group_count; group_students_count = item.group_students_count; lecture_hours = item.lecture_hours; lab_hours = item.lab_hours; practice_hours = item.practice_hours; exam_hours = item.exam_hours; zach_hours = item.zach_hours; zach_with_mark_hours = item.zach_with_mark_hours; course_project_hours = item.course_project_hours; course_task_hours = item.course_task_hours; control_task_hours = item.control_task_hours; referat_hours = item.referat_hours; essay_hours = item.essay_hours; head_of_practice_hours = item.head_of_practice_hours; head_of_vkr_hours = item.head_of_vkr_hours; iga_hours = item.iga_hours; nra_hours = item.nra_hours; nrm_hours = item.nrm_hours; individual_hours = item.individual_hours; teacher_card_id = item.teacher_card_id; real_teacher_id = item.real_teacher_id; if (teachers.Select(t => t.id).ToList().Contains(item.real_teacher_id)) { var teacher = teachers.FirstOrDefault(t => t.id == item.real_teacher_id); real_teacher_fio = teacher.f + " " + teacher.i + " " + teacher.o; } else { real_teacher_fio = ""; } total_hours = item.lecture_hours + item.lab_hours + item.practice_hours + item.exam_hours + item.zach_hours + item.zach_with_mark_hours + item.course_project_hours + item.course_task_hours + item.control_task_hours + item.referat_hours + item.essay_hours + item.head_of_practice_hours + item.head_of_vkr_hours + item.iga_hours + item.nra_hours + item.nrm_hours + item.individual_hours; }
private void tciUpdate_Click(object sender, EventArgs e) { if (cardItemsGridView.SelectedCells.Count > 0) { var cardItemView = ((List <TeacherCardItemView>)cardItemsGridView.DataSource)[cardItemsGridView.SelectedCells[0].RowIndex]; var cardItem = new TeacherCardItem { id = cardItemView.id, teacher_card_id = cardItemView.teacher_card_id }; cardItem.semester = Utilities.ParseIntOrZero(tciSemester.Text); cardItem.code = tciCode.Text; cardItem.discipline_name = tciDiscipline_name.Text; cardItem.group_name = tciGroup_name.Text; cardItem.group_count = Utilities.ParseIntOrZero(tciGroup_count.Text); cardItem.group_students_count = Utilities.ParseIntOrZero(tciGroup_students_count.Text); cardItem.lecture_hours = Utilities.ParseDecOrZero(tciLecture_hours.Text); cardItem.lab_hours = Utilities.ParseDecOrZero(tciLab_hours.Text); cardItem.practice_hours = Utilities.ParseDecOrZero(tciPractice_hours.Text); cardItem.exam_hours = Utilities.ParseDecOrZero(tciExam_hours.Text); cardItem.zach_hours = Utilities.ParseDecOrZero(tciZach_hours.Text); cardItem.zach_with_mark_hours = Utilities.ParseDecOrZero(tciZach_with_mark_hours.Text); cardItem.course_project_hours = Utilities.ParseDecOrZero(tciCourse_project_hours.Text); cardItem.course_task_hours = Utilities.ParseDecOrZero(tciCourse_task_hours.Text); cardItem.control_task_hours = Utilities.ParseDecOrZero(tciControl_task_hours.Text); cardItem.referat_hours = Utilities.ParseDecOrZero(tciReferat_hours.Text); cardItem.essay_hours = Utilities.ParseDecOrZero(tciEssay_hours.Text); cardItem.head_of_practice_hours = Utilities.ParseDecOrZero(tciHead_of_practice_hours.Text); cardItem.head_of_vkr_hours = Utilities.ParseDecOrZero(tciHead_of_vkr_hours.Text); cardItem.iga_hours = Utilities.ParseDecOrZero(tciIga_hours.Text); cardItem.nra_hours = Utilities.ParseDecOrZero(tciNra_hours.Text); cardItem.nrm_hours = Utilities.ParseDecOrZero(tciNrm_hours.Text); cardItem.individual_hours = Utilities.ParseDecOrZero(tciIndividual_hours.Text); cardItem.real_teacher_id = (int)tciRealTeacher.SelectedValue; tciRepo.update(cardItem, cardItem.id); UpdateTeacherCardItemsList(); } }