private void dataGridViewFactPochFond_DoubleClick(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)(bindingSourceFactPochFond.Current); FormCourseInWorkInfo fciwi = new FormCourseInWorkInfo(ciw, myDatabase); fciwi.ShowDialog(); }
public FormJoinCourse(CourseInWork ACourseInWork, BindingSource ADestinationBindingSource) { InitializeComponent(); courseInWork = ACourseInWork; destinationBindingSource = ADestinationBindingSource; }
private void dataGridViewFormalAndFact_MouseDoubleClick(object sender, MouseEventArgs e) { CourseInWork ciw = (CourseInWork)(bindingSourceFormalAndFact.Current); FormCourseInWorkInfo fciwi = new FormCourseInWorkInfo(ciw, myDatabase); fciwi.ShowDialog(); }
private void buttonSplit_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFormalAndFact.Current; FormSelectWorkloadHourType fswht = new FormSelectWorkloadHourType(ciw); fswht.ShowDialog(); if (fswht.DialogResult == System.Windows.Forms.DialogResult.OK && fswht.SelectedWorkloadHourType != WorkloadHourType.None) { CourseInWork newCiw1 = ciw.Split((WorkloadType)ciw.Fact, (WorkloadType)ciw.Fact, ciw.Employee, ciw.Employee, fswht.SelectedWorkloadHourType, WorkloadMoveType.Переносится); if (((fswht.SelectedWorkloadHourType & WorkloadHourType.Лабораторные) != 0) && fswht.NewLabHours > 0) { ciw.LabHours = fswht.OldLabHours - fswht.NewLabHours; newCiw1.LabHours = fswht.NewLabHours; } if (((fswht.SelectedWorkloadHourType & WorkloadHourType.Прочее) != 0) && fswht.NewProchHours > 0) { ciw.ProchHours = fswht.OldProchHours - fswht.NewProchHours; newCiw1.ProchHours = fswht.NewProchHours; } myDatabase.CourseInWork.InsertOnSubmit(newCiw1); myDatabase.SubmitChanges(); updateParameters(); updateDataGridViews(); } else { MessageBox.Show("Не задана нагрузка для переноса!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonMoveFormalPart_Click(object sender, EventArgs e) { FormSelectEmployee fse = new FormSelectEmployee(myDatabase); fse.ShowDialog(); if (fse.DialogResult == System.Windows.Forms.DialogResult.OK && fse.SelectedEmployee != null) { CourseInWork ciw = (CourseInWork)bindingSourceFormalAndFact.Current; if (fse.SelectedEmployee.Id != iCathedra_Settings.PochFondKod) { FormSelectWorkloadHourType fswht = new FormSelectWorkloadHourType(ciw); fswht.ShowDialog(); if (fswht.DialogResult == System.Windows.Forms.DialogResult.OK && fswht.SelectedWorkloadHourType != WorkloadHourType.None) { CourseInWork newCiw1 = ciw.Split((WorkloadType)ciw.Fact, (WorkloadType)ciw.Fact, ciw.Employee, ciw.Employee, fswht.SelectedWorkloadHourType, WorkloadMoveType.Переносится); myDatabase.CourseInWork.InsertOnSubmit(newCiw1); myDatabase.SubmitChanges(); CourseInWork newCiw2 = newCiw1.Split(WorkloadType.Фактическая, WorkloadType.Формальная, newCiw1.Employee, fse.SelectedEmployee, fswht.SelectedWorkloadHourType, WorkloadMoveType.Копируется); CourseInWork.MakeTwins(ref newCiw1, ref newCiw2); myDatabase.CourseInWork.InsertOnSubmit(newCiw2); myDatabase.SubmitChanges(); if (ciw.AllHours == 0) { myDatabase.CourseInWork.DeleteOnSubmit(ciw); myDatabase.SubmitChanges(); } updateParameters(); updateDataGridViews(); } else { MessageBox.Show("Не задана нагрузка для переноса!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Для переноски в почасовой фонд есть отдельная кнопка!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Преподаватель не выбран!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //myDatabase.CourseInWork.InsertOnSubmit }
private void btnOK_Click(object sender, EventArgs e) { var CourseID = ((Course)cbCourseName.SelectedValue).ID; var SchoolYearID = (int)comboBoxYear.SelectedValue; var Semestr = (short?)cbSemestr.SelectedValue; int?EmployeeID = null; if (!(cbEmployee.SelectedIndex == -1 || cbEmployee.SelectedValue == null)) { EmployeeID = (int)cbEmployee.SelectedValue; } var FormStudy = (bool?)cbFormStudy.SelectedValue; var DocumentId = (int)comboBoxDocument.SelectedValue; var work = new CourseInWork() { CourseID = CourseID, SchoolYearID = SchoolYearID, Semestr = Semestr, EmployeeID = EmployeeID, FormStudy = FormStudy, DocumentId = DocumentId }; _db.CourseInWork.InsertOnSubmit(work); for (int i = 0; i < ctlSortLoads.RowCount - 1; i++) { decimal countHours; if (Decimal.TryParse(ctlSortLoads.Rows[i].Cells[2].Value.ToString(), out countHours) == true && countHours != 0) { _db.LoadInCoursePlan.InsertOnSubmit(new LoadInCoursePlan() { CountHours = countHours, CourseInWork = work, SortLoadID = (int)ctlSortLoads.Rows[i].Cells[0].Value }); } } for (int i = 0; i < panelGroups.Controls.Count; i++) { ComboBox comboBox = (ComboBox)panelGroups.Controls[i]; if (comboBox.SelectedValue != null && comboBox.SelectedIndex != -1) { _db.GroupInCourse.InsertOnSubmit(new GroupInCourse() { GroupInSemestrID = (int)comboBox.SelectedValue, CourseInWork = work }); //comboBox.SelectedIndex = -1; } } _db.SubmitChanges(); UpdataGrid(); UpdateSotrList(); }
private void buttonGoToFormalEmployee_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFact.Current; EmployeeInSchoolYear eisy = new EmployeeInSchoolYear(ciw.Twin.Employee, ciw.SchoolYear); FormEmployeeInSchoolYearEdit feisye = new FormEmployeeInSchoolYearEdit(eisy, myDatabase); feisye.ShowDialog(); updateParameters(); updateDataGridViews(); }
private void toolStripButton3_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSource2.Current; ciw.Group = null; ciw.Group2 = null; ciw.Group3 = null; ciw.Group4 = null; dataGridView2.Refresh(); }
private void buttonPochFondMakeFormal_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFactPochFond.Current; ciw.Fact = (short)WorkloadType.Фактическая_и_формальная; myDatabase.CourseInWork.DeleteOnSubmit(ciw.Twin); ciw.Twin = null; myDatabase.SubmitChanges(); updateParameters(); updateDataGridViews(); }
private void toolStripButton1_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSource2.Current; bindingSource2.AddNew(); CourseInWork emptyciw = (CourseInWork)bindingSource2.Current; ciw.Clone(ref emptyciw, WorkloadHourType.Все_виды); bindingSource2.EndEdit(); dataGridView2.Refresh(); }
private void buttonMoveToFormalEmployee_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFact.Current; CourseInWork ciwTwin = ciw.Twin; ciwTwin.Fact = (short)WorkloadType.Фактическая_и_формальная; ciwTwin.Twin = null; myDatabase.CourseInWork.DeleteOnSubmit(ciw); myDatabase.SubmitChanges(); updateParameters(); updateDataGridViews(); }
public FormSelectCourseInWork(Database AmyDatabase, Employee filterEmployee, Group filterGroup, Semestr filterSemestr, SchoolYear filterSchoolYear, WorkloadType filterWorkloadType, CourseInWork exceptCourseInWork) { InitializeComponent(); myDatabase = AmyDatabase; _filterEmployee = filterEmployee; _filterGroup = filterGroup; _filterSemestr = filterSemestr; _filterSchoolYear = filterSchoolYear; _filterWorkloadType = filterWorkloadType; _exceptCourseInWork = exceptCourseInWork; }
private void updateTableLayoutPanelCheckBoxes() { foreach (DiplomSettings ds in _myDatabase.DiplomSettings) { int courseId = ds.DiplomCourseId; int consCourseId = ds.ConsCourseId; var q = from ciw in _myDatabase.CourseInWork where ciw.CourseID == courseId && ciw.SchoolYearID == iCathedra_Settings.SchoolYearId select ciw; foreach (CourseInWork ciw in q) { #region Ищем "смежную нагрузку" в консультациях CourseInWork ciw2 = (from c in _myDatabase.CourseInWork where c.CourseID == consCourseId && c.SchoolYearID == iCathedra_Settings.SchoolYearId && c.Group1ID == ciw.Group1ID select c).First(); string error = null; if (ciw2 == null) { error = " (НЕ НАЙДЕНЫ КОНСУЛЬТАЦИИ)"; } #endregion int studentCount = (int)(ciw.ProchHours / ds.DiplomHoursPerStudent); int studentCountPerCons = 0; if (ciw2 != null) { studentCountPerCons = (int)(ciw2.ProchHours / ds.ConsHoursPerStudent); } if (studentCount != studentCountPerCons) { error = " (НЕ СОВПАДАЕТ КОЛИЧЕСТВО СТУДЕНТОВ ПО РУКОВОДСТВУ И КОНСУЛЬТАЦИЯМ)"; } CheckBox cb = new CheckBox(); cb.Text = String.Format(@"{0}, {1}, {2} студ.{3}", ciw.Groups, ds.CourseName, studentCount, error); tableLayoutPanelCheckBoxes.Controls.Add(cb); } } }
private void buttonMoveToPochFond_Click(object sender, EventArgs e) { Employee pochFond = myDatabase.Employee.First <Employee>(em => em.Id == iCathedra_Settings.PochFondKod); CourseInWork ciw = (CourseInWork)bindingSourceFormalAndFact.Current; FormSelectWorkloadHourType fswht = new FormSelectWorkloadHourType(ciw); fswht.ShowDialog(); if (fswht.DialogResult == System.Windows.Forms.DialogResult.OK && fswht.SelectedWorkloadHourType != WorkloadHourType.None) { CourseInWork newCiw1 = ciw.Split((WorkloadType)ciw.Fact, (WorkloadType)ciw.Fact, ciw.Employee, ciw.Employee, fswht.SelectedWorkloadHourType, WorkloadMoveType.Переносится); myDatabase.CourseInWork.InsertOnSubmit(newCiw1); myDatabase.SubmitChanges(); CourseInWork newCiw2 = newCiw1.Split(WorkloadType.Фактическая, WorkloadType.Формальная, newCiw1.Employee, pochFond, fswht.SelectedWorkloadHourType, WorkloadMoveType.Копируется); CourseInWork.MakeTwins(ref newCiw1, ref newCiw2); myDatabase.CourseInWork.InsertOnSubmit(newCiw2); myDatabase.SubmitChanges(); if (ciw.AllHours == 0) { myDatabase.CourseInWork.DeleteOnSubmit(ciw); myDatabase.SubmitChanges(); } updateParameters(); updateDataGridViews(); } else { MessageBox.Show("Не задана нагрузка для переноса!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void changeEmployee(CourseInWork ciw) { FormSelectEmployee fse = new FormSelectEmployee(myDatabase); fse.ShowDialog(); if (fse.DialogResult == System.Windows.Forms.DialogResult.OK && fse.SelectedEmployee != null) { if (fse.SelectedEmployee.Id != iCathedra_Settings.PochFondKod) { ciw.Employee = fse.SelectedEmployee; myDatabase.SubmitChanges(); updateParameters(); updateDataGridViews(); } else { MessageBox.Show("Нельзя перенести фактическую нагрузку на почасовой фонд!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Преподаватель не выбран!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void buttonShowLinkedWorkload_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFormalAndFact.Current; FormSelectCourseInWork fsciw = new FormSelectCourseInWork(myDatabase, ciw.Employee, ciw.Group, (Semestr)ciw.Semestr, ciw.SchoolYear, (WorkloadType)ciw.Fact, ciw); fsciw.ShowDialog(); if (fsciw.DialogResult == System.Windows.Forms.DialogResult.OK) { CourseInWork destCourseInWork = fsciw.SelectedCourseInWork; destCourseInWork.Join(ciw, WorkloadHourType.Все_виды); myDatabase.CourseInWork.DeleteOnSubmit(ciw); myDatabase.SubmitChanges(); if (ciw.AllHours == 0) { myDatabase.CourseInWork.DeleteOnSubmit(ciw); myDatabase.SubmitChanges(); } updateParameters(); updateDataGridViews(); } }
public FormBreakCourse(Database Database, CourseInWork ACourseInWork) { InitializeComponent(); this.myDatabase = Database; this.courseInWork = ACourseInWork; }
private void dataGridViewCourseInWork_DoubleClick(object sender, EventArgs e) { SelectedCourseInWork = (CourseInWork)bindingSourceCourseInWork.Current; DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
private void buttonOk_Click(object sender, EventArgs e) { SelectedCourseInWork = (CourseInWork)bindingSourceCourseInWork.Current; this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
public FormCourseInWorkInfo(CourseInWork ACourseInWork, Database AMyDatabase) { InitializeComponent(); localCourseInWork = ACourseInWork; myDatabase = AMyDatabase; }
public FormSelectWorkloadHourType(CourseInWork Aciw) { InitializeComponent(); _ciw = Aciw; }
private void buttonFactChangeEmployee_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFact.Current; changeEmployee(ciw); }
private void buttonMoveToAnotherEmployee_Click(object sender, EventArgs e) { CourseInWork ciw = (CourseInWork)bindingSourceFormalAndFact.Current; changeEmployee(ciw); }
private void данныеДляЗаявленийToolStripMenuItem_Click(object sender, EventArgs e) { Database myDatabase = new Database("Database.sdf"); FormSemestrTriada fst = new FormSemestrTriada(); fst.ShowDialog(); if (fst.DialogResult == System.Windows.Forms.DialogResult.OK) { List <CourseInWork> lciw = new List <CourseInWork>(); var q1 = from ciw in myDatabase.CourseInWork where ciw.SchoolYearID == fst.SelectedSchoolYear.ID orderby ciw.EmployeeID, ciw.CourseID select ciw; List <CourseInWork> q = q1.ToList <CourseInWork>(); List <string> ls = new List <string>(); ls.Add("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"); ls.Add("<html>"); ls.Add(" <head>"); ls.Add(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">"); ls.Add(" <title>Данные для заявлений на оплату из почасового фонда</title>"); ls.Add(" </head>"); ls.Add(" <body>"); ls.Add("<h1 align=\"center\">Для заявлений на оплату из почасового фонда</h1>"); string season = ""; if (fst.Triada1) { season += "осень"; } if (fst.Triada2) { season += (!String.IsNullOrEmpty(season) ? ", " : "") + "зиму"; } if (fst.Triada3) { season += (!String.IsNullOrEmpty(season) ? ", " : "") + "весну"; } string s = String.Format("учебной нагрузки для заочников на {0} {1} учебного года", season, fst.SelectedSchoolYear.Years); ls.Add("<p align=\"center\">" + s + "</p>"); ls.Add("<table border=\"1\">"); ls.Add("<tbody>"); List <CourseInWork> twinCourses = new List <CourseInWork>(); foreach (CourseInWork ciw in q) { if (ciw.Fact == (short)WorkloadType.Фактическая && ciw.Employee.PostID != 5) { // CourseInWork ciwTwin = ciw.GetTwin(q); CourseInWork ciwTwin = ciw.GetTwin(); if (ciwTwin == null) { throw new Exception("У курса " + ciw.FullName + " не может отсутствовать двойник."); } if (ciwTwin.Employee.PostID == 5) { twinCourses.Add(ciw); } } } var q2 = from twins in twinCourses orderby twins.EmployeeID, twins.CourseID, twins.Semestr, twins.Group1ID, twins.Group2ID, twins.Group3ID, twins.Group4ID select twins; string oldCourseInWorkName = "-1"; foreach (CourseInWork ciwTwin in q2) { Dictionary <string, decimal> d = ciwTwin.GetHours(fst.Triada1, fst.Triada2, fst.Triada3); if (oldCourseInWorkName != ciwTwin.FullName) { if (d.Count > 0) { ls.Add("<tr><td colspan=\"3\">" + ciwTwin.FullName + "</td></tr>"); } oldCourseInWorkName = ciwTwin.FullName; } foreach (KeyValuePair <string, decimal> kvp in d) { ls.Add("<tr>"); ls.Add(String.Format("<td>{0}</td><td>{1}</td><td>-</td>", kvp.Key, kvp.Value)); ls.Add("</tr>"); } } ls.Add("</tbody>"); ls.Add("</table>"); ls.Add("</body>"); File.WriteAllLines("PochFond.html", ls.ToArray(), Encoding.GetEncoding(1251)); Process.Start("PochFond.html"); } }