/// <summary> /// load the screen /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddProcessFlowRuleForm_Load(object sender, EventArgs e) { ProcessFlowRuleCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadUserData(updateData); ProcessFlowRuleCode_txt.Enabled = false; Comment_txt.Select(); } }
/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (ProcessFlowRuleCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ProcessFlowRuleCode_lbl.Text); popUpMessage.Warning(messageData, Text); ProcessFlowRuleCode_txt.Focus(); return(false); } if (Comment_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Comment_lbl.Text); popUpMessage.Warning(messageData, Text); Comment_txt.Focus(); return(false); } return(true); }
/// <summary> /// inserts/updates ProcessFlowRule on ok click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (string.IsNullOrEmpty(ProcessFlowRuleCode_txt.Text) || string.IsNullOrEmpty(Comment_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (string.IsNullOrEmpty(ProcessFlowRuleCode_txt.Text)) { ProcessFlowRuleCode_txt.Focus(); } else { Comment_txt.Focus(); } return; } ProcessFlowRuleVo inVo = new ProcessFlowRuleVo { ProcessFlowRuleCode = ProcessFlowRuleCode_txt.Text.Trim(), Comment = Comment_txt.Text.Trim(), //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessFlowRuleVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ProcessFlowRuleCode_lbl.Text + " : " + ProcessFlowRuleCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessFlowRuleVo outVo = (ProcessFlowRuleVo)base.InvokeCbm(new AddProcessFlowRuleMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.ProcessFlowRuleId = updateData.ProcessFlowRuleId; ProcessFlowRuleVo outVo = (ProcessFlowRuleVo)base.InvokeCbm(new UpdateProcessFlowRuleMasterMntCbm(), 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(); } } }
/// <summary> /// form loading /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessFlowRuleForm_Load(object sender, EventArgs e) { Update_btn.Enabled = Delete_btn.Enabled = false; ProcessFlowRuleCode_txt.Select(); }