/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (Building_cmb.SelectedIndex == -1) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Building_lbl.Text); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Building_cmb.Select(); return(false); } if (string.IsNullOrEmpty(Year_txt.Text) || Year_txt.TextLength < 4) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Year_lbl.Text); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Year_txt.Select(); return(false); } if (Month_cmb.SelectedIndex == -1) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, "Month"); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Month_cmb.Select(); return(false); } if (string.IsNullOrEmpty(Date_txt.Text)) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, "Date"); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Date_txt.Select(); return(false); } if (Convert.ToInt32(Date_txt.Text) > 31) { messageData = new MessageData("mmce00023", Properties.Resources.mmce00023); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Date_txt.Text = string.Empty; Date_txt.Select(); return(false); } DateTime dDate; if (!DateTime.TryParse(Year_txt.Text + "-" + Month_cmb.Text + "-" + Date_txt.Text, out dDate)) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, "Validate Date"); logger.Info(messageData); popUpMessage.Warning(messageData, Text); Date_txt.Text = string.Empty; Date_txt.Select(); return(false); } return(true); }
private void Building_cmb_SelectionChangeCommitted(object sender, EventArgs e) { Year_txt.Select(); }