///<summary>Used by MoveUp and MoveDown.</summary> private static void SetOrder(int mySelNum, int myItemOrder, QuestionDef[] List) { QuestionDef temp = List[mySelNum]; temp.ItemOrder = myItemOrder; QuestionDefs.Update(temp); }
private void buttonDelete_Click(object sender, EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } QuestionDefs.Delete(QuestionDefCur); DialogResult = DialogResult.OK; }
private void FormFormPatEdit_Load(object sender, EventArgs e) { QuestionDefList = QuestionDefs.Refresh(); if (IsNew) { gridMain.Visible = false; butDelete.Visible = false; //only gets filled once on startup, and not saved until OK. for (int i = 0; i < QuestionDefList.Length; i++) { if (QuestionDefList[i].QuestType == QuestionType.FreeformText) { multInput.AddInputItem(QuestionDefList[i].Description, FieldValueType.String, ""); } else if (QuestionDefList[i].QuestType == QuestionType.YesNoUnknown) { multInput.AddInputItem(QuestionDefList[i].Description, FieldValueType.YesNoUnknown, YN.Unknown); } } } else { butOK.Visible = false; butCancel.Text = Lan.g(this, "Close"); multInput.Visible = false; //Gets filled repeatedly. Saved each time user double clicks on a row. Only the answer can be edited. FillGrid(); } /*QuestionDefList=QuestionDefs.Refresh(); * QuestionList=Questions.Refresh(PatNum); * if(QuestionList.Length==0){ * IsNew=true; * gridMain.Visible=false; * butDelete.Visible=false; * //only gets filled once on startup, and not saved until OK. * for(int i=0;i<QuestionDefList.Length;i++){ * if(QuestionDefList[i].QuestType==QuestionType.FreeformText){ * multInput.AddInputItem(QuestionDefList[i].Description,FieldValueType.String,""); * } * else if(QuestionDefList[i].QuestType==QuestionType.YesNoUnknown) { * multInput.AddInputItem(QuestionDefList[i].Description,FieldValueType.YesNoUnknown,YN.Unknown); * } * } * } * else{ * IsNew=false; * butOK.Visible=false; * butCancel.Text=Lan.g(this,"Close"); * multInput.Visible=false; * //Gets filled repeatedly. Saved each time user double clicks on a row. Only the answer can be edited. * FillGrid(); * }*/ }
private void butOK_Click(object sender, System.EventArgs e) { QuestionDefCur.QuestType = (QuestionType)listType.SelectedIndex; QuestionDefCur.Description = textQuestion.Text; if (IsNew) { QuestionDefs.Insert(QuestionDefCur); } else { QuestionDefs.Update(QuestionDefCur); } DialogResult = DialogResult.OK; }
private void butDown_Click(object sender, EventArgs e) { int selected = gridMain.GetSelectedIndex(); try { QuestionDefs.MoveDown(selected, QuestionList); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } FillGrid(); if (selected == QuestionList.Length - 1) { gridMain.SetSelected(selected, true); } else { gridMain.SetSelected(selected + 1, true); } }
private void FillGrid() { QuestionList = QuestionDefs.Refresh(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableQuestionDefs", "Type"), 110); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableQuestionDefs", "Question"), 570); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < QuestionList.Length; i++) { row = new ODGridRow(); row.Cells.Add(Lan.g("enumQuestionType", QuestionList[i].QuestType.ToString())); row.Cells.Add(QuestionList[i].Description); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }