private void butAdd_Click(object sender, System.EventArgs e) { if (comboClass.SelectedIndex == -1 || comboCourse.SelectedIndex == -1) { MsgBox.Show(this, "Please select a Class and Course first."); return; } FormReqNeededEdit FormR = new FormReqNeededEdit(); FormR.ReqCur = new ReqNeeded(); FormR.ReqCur.SchoolClassNum = SchoolClasses.List[comboClass.SelectedIndex].SchoolClassNum; FormR.ReqCur.SchoolCourseNum = SchoolCourses.List[comboCourse.SelectedIndex].SchoolCourseNum; FormR.IsNew = true; FormR.ShowDialog(); if (FormR.DialogResult != DialogResult.OK) { return; } FillGrid(); gridMain.ScrollToEnd(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["ReqNeededNum"].ToString() == FormR.ReqCur.ReqNeededNum.ToString()) { gridMain.SetSelected(i, true); break; } } }
private void butAdd_Click(object sender, System.EventArgs e) { if (comboClassFrom.SelectedIndex == -1 || comboCourseFrom.SelectedIndex == -1) { MsgBox.Show(this, "Please select a Class and Course first."); return; } FormReqNeededEdit FormR = new FormReqNeededEdit(); FormR.ReqCur = new ReqNeeded(); FormR.ReqCur.SchoolClassNum = _listSchoolClasses[comboClassFrom.SelectedIndex].SchoolClassNum; FormR.ReqCur.SchoolCourseNum = _listSchoolCourses[comboCourseFrom.SelectedIndex].SchoolCourseNum; FormR.IsNew = true; FormR.ShowDialog(); if (FormR.DialogResult != DialogResult.OK) { return; } if (_listReqsInGrid.Any(x => x.Descript == FormR.ReqCur.Descript && //Alternative to LINQ would be to create a method and loop through the whole list x.SchoolClassNum == FormR.ReqCur.SchoolClassNum && x.SchoolCourseNum == FormR.ReqCur.SchoolCourseNum)) { MsgBox.Show(this, "Requirement already exist."); return; } _listReqsAll.Add(FormR.ReqCur); FillGrid(); }
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(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { FormReqNeededEdit FormR = new FormReqNeededEdit(); FormR.ReqCur = _listReqsInGrid[e.Row]; //Previously got from the database but we want the copy from the list FormR.ShowDialog(); if (FormR.DialogResult == DialogResult.OK) { if (FormR.ReqCur == null) { RemoveReqFromAllList(_listReqsInGrid[gridMain.GetSelectedIndex()]); } else { ReqNeeded reqNeeded = _listReqsAll.FirstOrDefault(x => x.ReqNeededNum == FormR.ReqCur.ReqNeededNum); if (reqNeeded != null) //This should never be null. { reqNeeded = FormR.ReqCur; } } FillGrid(); } }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { FormReqNeededEdit FormR=new FormReqNeededEdit(); FormR.ReqCur=ReqNeededs.GetReq(PIn.Long(table.Rows[e.Row]["ReqNeededNum"].ToString())); FormR.ShowDialog(); if(FormR.DialogResult!=DialogResult.OK) { return; } FillGrid(); }
private void butAdd_Click(object sender, System.EventArgs e) { if(comboClass.SelectedIndex==-1 || comboCourse.SelectedIndex==-1){ MsgBox.Show(this,"Please select a Class and Course first."); return; } FormReqNeededEdit FormR=new FormReqNeededEdit(); FormR.ReqCur=new ReqNeeded(); FormR.ReqCur.SchoolClassNum=SchoolClasses.List[comboClass.SelectedIndex].SchoolClassNum; FormR.ReqCur.SchoolCourseNum=SchoolCourses.List[comboCourse.SelectedIndex].SchoolCourseNum; FormR.IsNew=true; FormR.ShowDialog(); if(FormR.DialogResult!=DialogResult.OK){ return; } FillGrid(); gridMain.ScrollToEnd(); for(int i=0;i<table.Rows.Count;i++){ if(table.Rows[i]["ReqNeededNum"].ToString()==FormR.ReqCur.ReqNeededNum.ToString()){ gridMain.SetSelected(i,true); break; } } }