public frmSurveyDateTime(SurveyDateTime sdt) { // This call is required by the designer. InitializeComponent(); if (sdt == null) { SurveyDateTime = new SurveyDateTime(); } else { SurveyDateTime = sdt; } }
private void cmdSave_Click(object sender, System.EventArgs e) { if (!ValidateForm()) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (cboYear.SelectedIndex == 0 && cboMonth.SelectedIndex == 0 && cboDay.SelectedIndex == 0 && cboHour.SelectedIndex == 0 && cboMinute.SelectedIndex == 0) { SurveyDateTime = null; } else { SurveyDateTime = new GCDCore.Project.SurveyDateTime(); SurveyDateTime.Year = Convert.ToUInt16(((NamedObject)cboYear.SelectedItem).ID); SurveyDateTime.Month = Convert.ToByte(((NamedObject)cboMonth.SelectedItem).ID); SurveyDateTime.Day = Convert.ToByte(((NamedObject)cboDay.SelectedItem).ID); SurveyDateTime.Hour = Convert.ToInt16(((NamedObject)cboHour.SelectedItem).ID); SurveyDateTime.Minute = Convert.ToInt16(((NamedObject)cboMinute.SelectedItem).ID); } }