/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (InspectionProcessCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionProcessCode_lbl.Text); popUpMessage.Warning(messageData, Text); InspectionProcessCode_txt.Focus(); return(false); } if (InspectionProcessName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionProcessName_lbl.Text); popUpMessage.Warning(messageData, Text); InspectionProcessName_txt.Focus(); return(false); } if (InspectionFormat_cmb.Text == string.Empty || InspectionFormat_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionFormat_lbl.Text); popUpMessage.Warning(messageData, Text); InspectionFormat_cmb.Focus(); return(false); } return(true); }
/// <summary> /// load the form with combobox bind /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InspectionProcessForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); ComboBind(InspectionFormatId_cmb, inspectionformatDatatable, "Name", "Id"); Update_btn.Enabled = Delete_btn.Enabled = false; InspectionProcessCode_txt.Select(); }
/// <summary> /// clear the condition control values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Clear_btn_Click(object sender, EventArgs e) { InspectionProcessCode_txt.Text = string.Empty; InspectionProcessName_txt.Text = string.Empty; InspectionFormatId_cmb.SelectedIndex = -1; InspectionProcessDetails_dgv.DataSource = null; Update_btn.Enabled = Delete_btn.Enabled = false; InspectionProcessCode_txt.Select(); }
/// <summary> /// form load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddInspectionProcessForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); ComboBind(InspectionFormat_cmb, inspectionformatDatatable, "Name", "Id"); InspectionProcessCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadInspectionProcessData(updateData); InspectionProcessCode_txt.Enabled = false; InspectionProcessName_txt.Select(); } }
/// <summary> /// inserts new record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { InspectionProcessVo inVo = new InspectionProcessVo(); var sch = StringCheckHelper.GetInstance(); if (CheckMandatory() == true) { if (string.IsNullOrEmpty(InspectionProcessCode_txt.Text) || string.IsNullOrEmpty(InspectionProcessName_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (string.IsNullOrEmpty(InspectionProcessCode_txt.Text)) { InspectionProcessCode_txt.Focus(); } else if (string.IsNullOrEmpty(InspectionProcessName_txt.Text)) { InspectionProcessName_txt.Focus(); } return; } inVo.InspectionProcessCode = InspectionProcessCode_txt.Text.Trim(); inVo.InspectionProcessName = InspectionProcessName_txt.Text.Trim(); inVo.InspectionFormatId = Convert.ToInt32(InspectionFormat_cmb.SelectedValue.ToString()); if (string.Equals(mode, CommonConstants.MODE_ADD)) { InspectionProcessVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessCode_lbl.Text + " : " + InspectionProcessCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { InspectionProcessVo outVo = (InspectionProcessVo)base.InvokeCbm(new AddInspectionProcessMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.InspectionProcessId = updateData.InspectionProcessId; InspectionProcessVo outVo = (InspectionProcessVo)base.InvokeCbm(new UpdateInspectionProcessMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }