/// <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); }
/// <summary> /// load screen /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddFactoryProductionDaysMasterForm_Load(object sender, EventArgs e) { GetBuildingInfomation(); Building_cmb.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadFactoryProductionDaysData(updateData); Building_cmb.Enabled = false; Year_txt.Enabled = false; Month_cmb.Enabled = false; Date_txt.Select(); } }
private void Month_cmb_SelectionChangeCommitted(object sender, EventArgs e) { Date_txt.Select(); }