예제 #1
0
        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;
                }
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
            }
        }
예제 #5
0
파일: FormReqNeededs.cs 프로젝트: mnisl/OD
		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();
		}
예제 #6
0
파일: FormReqNeededs.cs 프로젝트: mnisl/OD
		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;
				}
			}
		}