private void butDelete_Click(object sender, System.EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; } else { string inuseby = ReqStudents.InUseBy(ReqCur.ReqNeededNum); if (inuseby != "") { if (MessageBox.Show(Lan.g(this, "Requirement is already in use by student(s) with grade point(s) attached:") + "\r\n" + inuseby + Lan.g(this, "Delete anyway? Student grades will not be affected."), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } } if (!MsgBox.Show(this, true, "Delete this Requirement?")) { return; } try{ ReqNeededs.Delete(ReqCur.ReqNeededNum); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }
private void butSynch_Click(object sender, EventArgs e) { if (comboClass.SelectedIndex == -1 || comboCourse.SelectedIndex == -1) { MsgBox.Show(this, "Please select a Class and Course first."); return; } ReqNeededs.Synch(SchoolClasses.List[comboClass.SelectedIndex].SchoolClassNum, SchoolCourses.List[comboCourse.SelectedIndex].SchoolCourseNum); MsgBox.Show(this, "Done."); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { FormReqNeededEdit FormR = new FormReqNeededEdit(); FormR.ReqCur = ReqNeededs.GetReq(PIn.PInt(table.Rows[e.Row]["ReqNeededNum"].ToString())); FormR.ShowDialog(); if (FormR.DialogResult != DialogResult.OK) { return; } FillGrid(); }
///<summary>Surround with try/catch.</summary> public static void Delete(int reqStudentNum) { ReqStudent req = GetOne(reqStudentNum); //if a reqneeded exists, then disallow deletion. if (ReqNeededs.GetReq(req.ReqNeededNum) == null) { throw new Exception(Lan.g("ReqStudents", "Cannot delete requirement. Delete the requirement needed instead.")); } string command = "DELETE FROM reqstudent WHERE ReqStudentNum = " + POut.PInt(reqStudentNum); General.NonQ(command); }
private void FillGrid() { if (comboClass.SelectedIndex == -1 || comboCourse.SelectedIndex == -1) { return; } int selected = 0; if (gridMain.GetSelectedIndex() != -1) { selected = PIn.PInt(table.Rows[gridMain.GetSelectedIndex()]["ReqNeededNum"].ToString()); } int scroll = gridMain.ScrollValue; int schoolClass = SchoolClasses.List[comboClass.SelectedIndex].SchoolClassNum; int schoolCourse = SchoolCourses.List[comboCourse.SelectedIndex].SchoolCourseNum; table = ReqNeededs.Refresh(schoolClass, schoolCourse); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; //col=new ODGridColumn(Lan.g("TableRequirementsNeeded","Class"),100); //gridMain.Columns.Add(col); //col=new ODGridColumn(Lan.g("TableRequirementsNeeded","Course"),100); //gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRequirementsNeeded", "Description"), 200); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new ODGridRow(); //row.Cells.Add(SchoolClasses.GetDescript(PIn.PInt(table.Rows[i]["SchoolClassNum"].ToString()))); //row.Cells.Add(SchoolCourses.GetCourseID(PIn.PInt(table.Rows[i]["SchoolCourseNum"].ToString()))); row.Cells.Add(table.Rows[i]["Descript"].ToString()); //row.Tag gridMain.Rows.Add(row); } gridMain.EndUpdate(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["ReqNeededNum"].ToString() == selected.ToString()) { gridMain.SetSelected(i, true); break; } } gridMain.ScrollValue = scroll; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description first."); return; } ReqCur.Descript = textDescript.Text; //ReqCur.SchoolClassNum=SchoolClasses.List[comboClass.SelectedIndex].SchoolClassNum; //ReqCur.SchoolCourseNum=SchoolCourses.List[comboCourse.SelectedIndex].SchoolCourseNum; if (IsNew) { ReqNeededs.Insert(ReqCur); } else { ReqNeededs.Update(ReqCur); } DialogResult = DialogResult.OK; }
private void butOk_Click(object sender, EventArgs e) { ReqNeededs.Sync(_listReqsAll, _listReqsAllOld); DialogResult = DialogResult.OK; }
private void ReloadReqList() { _listReqsAll = ReqNeededs.GetListFromDb(); _listReqsAllOld = _listReqsAll.Select(x => x.Copy()).ToList(); }