/// <summary> /// Bind the controls to the current survey's properties. /// </summary> private void BindProperties() { // top portion txtSurvey.DataBindings.Add(new Binding("Text", CurrentSurvey, "SurveyCode")); txtVarName.DataBindings.Add(new Binding("Text", bs, "VarName")); txtQnum.DataBindings.Add(new Binding("Text", bs, "Qnum")); // go to box cboGoToVar.ValueMember = "refVarName"; cboGoToVar.DataSource = DBAction.GetAllRefVars(CurrentSurvey.SurveyCode); cboGoToVar.DisplayMember = "refVarName"; cboGoToVar.SelectedValue = ""; // labels // fill cboDomainLabel.DataSource = DBAction.ListDomainLabels(); cboDomainLabel.ValueMember = "ID"; cboDomainLabel.DisplayMember = "LabelText"; cboTopicLabel.DataSource = DBAction.GetTopicLabels(); cboTopicLabel.ValueMember = "ID"; cboTopicLabel.DisplayMember = "LabelText"; cboContentLabel.DataSource = DBAction.GetContentLabels(); cboContentLabel.ValueMember = "ID"; cboContentLabel.DisplayMember = "LabelText"; cboProductLabel.DataSource = DBAction.GetProductLabels(); cboProductLabel.ValueMember = "ID"; cboProductLabel.DisplayMember = "LabelText"; // bind txtVarLabel.DataBindings.Add("Text", bs, "VarLabel"); cboDomainLabel.DataBindings.Add("SelectedValue", bs, "Domain.ID"); cboTopicLabel.DataBindings.Add("SelectedValue", bs, "Topic.ID"); cboContentLabel.DataBindings.Add("SelectedValue", bs, "Content.ID"); cboProductLabel.DataBindings.Add("SelectedValue", bs, "Product.ID"); // field info chkTableFormat.DataBindings.Add("Checked", bs, "TableFormat"); chkScriptOnly.DataBindings.Add("Checked", bs, "ScriptOnly"); txtVarType.DataBindings.Add("Text", bs, "VarType"); numDec.DataBindings.Add("Value", bs, "NumDec"); numCols.DataBindings.Add("Value", bs, "NumCol"); }
private void GetLabels() { switch (currentType) { case "domain": domains = DBAction.ListDomainLabels(); break; case "topic": topics = DBAction.GetTopicLabels(); break; case "content": contents = DBAction.GetContentLabels(); break; case "product": products = DBAction.GetProductLabels(); break; } }
/// <summary> /// Bind the controls to the current survey's properties. /// </summary> private void BindProperties() { // top portion txtSurvey.DataBindings.Add(new Binding("Text", CurrentSurvey, "SurveyCode")); txtVarName.DataBindings.Add(new Binding("Text", bs, "VarName.FullVarName")); txtQnum.DataBindings.Add(new Binding("Text", bs, "Qnum")); // go to box cboGoToVar.ValueMember = "refVarName"; cboGoToVar.DataSource = DBAction.GetAllRefVars(CurrentSurvey.SurveyCode); cboGoToVar.DisplayMember = "refVarName"; cboGoToVar.SelectedValue = ""; cmdUnlockSurvey.DataBindings.Add("Visible", CurrentSurvey, "Locked"); // wordings txtPrePNum.DataBindings.Add(new Binding("Text", bs, "PrePNum")); txtPreINum.DataBindings.Add(new Binding("Text", bs, "PreINum")); txtPreANum.DataBindings.Add(new Binding("Text", bs, "PreANum")); txtLitQNum.DataBindings.Add(new Binding("Text", bs, "LitQNum")); txtPstINum.DataBindings.Add(new Binding("Text", bs, "PstINum")); txtPstPNum.DataBindings.Add(new Binding("Text", bs, "PstPNum")); txtRespName.DataBindings.Add(new Binding("Text", bs, "RespName")); txtNRName.DataBindings.Add(new Binding("Text", bs, "NRName")); chkCorrected.DataBindings.Add(new Binding("Visible", bs, "CorrectedFlag")); // labels // fill cboDomainLabel.DataSource = DBAction.ListDomainLabels(); cboDomainLabel.ValueMember = "ID"; cboDomainLabel.DisplayMember = "LabelText"; cboTopicLabel.DataSource = DBAction.GetTopicLabels(); cboTopicLabel.ValueMember = "ID"; cboTopicLabel.DisplayMember = "LabelText"; cboContentLabel.DataSource = DBAction.GetContentLabels(); cboContentLabel.ValueMember = "ID"; cboContentLabel.DisplayMember = "LabelText"; cboProductLabel.DataSource = DBAction.GetProductLabels(); cboProductLabel.ValueMember = "ID"; cboProductLabel.DisplayMember = "LabelText"; // bind txtVarLabel.DataBindings.Add("Text", bs, "VarName.VarLabel"); cboDomainLabel.DataBindings.Add("SelectedValue", bs, "VarName.Domain.ID"); cboTopicLabel.DataBindings.Add("SelectedValue", bs, "VarName.Topic.ID"); cboContentLabel.DataBindings.Add("SelectedValue", bs, "VarName.Content.ID"); cboProductLabel.DataBindings.Add("SelectedValue", bs, "VarName.Product.ID"); // field info chkTableFormat.DataBindings.Add("Checked", bs, "TableFormat"); chkScriptOnly.DataBindings.Add("Checked", bs, "ScriptOnly"); txtFmt.DataBindings.Add("Text", bs, "NumFmt"); txtQuesType.DataBindings.Add("Text", bs, "VarType"); numDec.DataBindings.Add("Value", bs, "NumDec"); numCols.DataBindings.Add("Value", bs, "NumCol"); // comments txtNoteType.DataBindings.Add("Text", bsComments, "NoteType"); txtDate.DataBindings.Add("Text", bsComments, "NoteDate"); txtInit.DataBindings.Add("Text", bsComments, "Name"); txtNote.DataBindings.Add("Text", bsComments, "Notes"); txtSource.DataBindings.Add("Text", bsComments, "Source"); txtSourceName.DataBindings.Add("Text", bsComments, "SourceName"); }