//database - check duplicates moved to super // public static void CheckDuplicatesInGrid(DataGridView dataGridView, int rowIndex, string revertName) // { // if (rowIndex < 0) return; // string courseNameAfterUpdate = dataGridView[0, rowIndex].CellValue(); // for (int i = 0; i < dataGridView.RowCount; i++) // { // if (dataGridView[0, i].CellValue() == courseNameAfterUpdate && i != rowIndex) // { // EditorUtilities.ShowWarning( // "Warning: Duplicate course names not allowed, reverting back to previous name"); // dataGridView[0, rowIndex].Value = revertName; // } // } // } //***************************************** // PARSER //***************************************** public override void ParseCtt(string line) { var words = GetStringData(line); var i = 0; CourseCode = words[i++]; HoursPerDay = CourseCode.EndsWith("_WK") ? 3 : 2; TeacherGroup = new TeacherGroup(words[i++]); if (EntityDataBase.TeacherGroups.IndexOf(TeacherGroup) == -1) { EntityDataBase.TeacherGroups.Add(TeacherGroup); } LectureSize = int.Parse(words[i++]); MinimumWorkingDays = int.Parse(words[i++]); StudentSize = int.Parse(words[i++]); MinimumDate = ParseDate(words[i++], DateType.Minium); DeadlineDate = ParseDate(words[i++], DateType.Maximum); MaximumWorkingDays = ParseMaximumValue(words[i++]); if (words.Length >= 9) { IsPcNeeded = bool.Parse(words[i++]); } if (words.Length >= 10) { HoursPerDay = int.Parse(words[i++]); } }
public override bool FillDataFromGridline(DataGridView dataGridView, int rowIndex) { var i = 0; CourseCode = dataGridView[i++, rowIndex].CellValue(); HoursPerDay = CourseCode.EndsWith("_WK") ? 3 : 2; TeacherGroup = new TeacherGroup(dataGridView[i++, rowIndex].CellValue()); if (EntityDataBase.TeacherGroups.IndexOf(TeacherGroup) == -1) { EntityDataBase.TeacherGroups.Add(TeacherGroup); } LectureSize = int.Parse(dataGridView[i++, rowIndex].CellValue()); MinimumWorkingDays = int.Parse(dataGridView[i++, rowIndex].CellValue()); StudentSize = int.Parse(dataGridView[i++, rowIndex].CellValue()); MinimumDate = ParseDate(dataGridView[i++, rowIndex].CellValue(), DateType.Minium); DeadlineDate = ParseDate(dataGridView[i++, rowIndex].CellValue(), DateType.Maximum); MaximumWorkingDays = ParseMaximumValue(dataGridView[i++, rowIndex].CellValue()); if (dataGridView[i, rowIndex].CellValue() == null) { IsPcNeeded = false; i++; } else { IsPcNeeded = bool.Parse(dataGridView[i++, rowIndex].CellValue()); } if (dataGridView[i, rowIndex].CellValue() != null) { HoursPerDay = int.Parse(dataGridView[i++, rowIndex].CellValue()); } return(true); }