/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (ProcessWorkCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ProcessWorkCode_lbl.Text); popUpMessage.Warning(messageData, Text); ProcessWorkCode_txt.Focus(); return(false); } if (ProcessWorkName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ProcessWorkName_lbl.Text); popUpMessage.Warning(messageData, Text); ProcessWorkName_txt.Focus(); return(false); } if (Process_cmb.Text == string.Empty || Process_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Process_lbl.Text); popUpMessage.Warning(messageData, Text); Process_cmb.Focus(); return(false); } //if (isPhantom_cmb.Text == string.Empty || isPhantom_cmb.SelectedIndex < 0) //{ // messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, IsPhantom_lbl.Text); // popUpMessage.Warning(messageData, Text); // Process_cmb.Focus(); // return false; //} if (LineMachineSltn_cmb.Text == string.Empty || LineMachineSltn_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LineMachineSltn_lbl.Text); popUpMessage.Warning(messageData, Text); LineMachineSltn_cmb.Focus(); return(false); } if (DisplayOrder_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, DisplayOrder_lbl.Text); popUpMessage.Warning(messageData, Text); DisplayOrder_txt.Focus(); return(false); } return(true); }
/// <summary> /// Handles Load event for mold data Insert/Update operations /// Loading mold data for update mold data and binding controls with selected mold record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void AddProcessWorkForm_Load(object sender, EventArgs e) { if (!this.DesignMode) { FormDatatableFromVo(); ComboBind(Process_cmb, processDatatable, "code", "id"); LoadPhantom(); //LoadLneMchneSltn(); ComboBind(LineMachineSltn_cmb, LneMchneSltn, "name", "id"); LoadLneMchneSltn(); ProcessWorkCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadUserData(updateData); ProcessWorkCode_txt.Enabled = false; ProcessWorkName_txt.Select(); } else { ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new GetDisplayOrderNextValCbm(), null, false); if (outVo != null) { DisplayOrder_txt.Text = outVo.DisplayOrder.ToString(); } else { DisplayOrder_txt.Text = "1"; } } } }
/// <summary> /// update data to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { if (CheckMandatory()) { string processwrkName = ProcessWorkName_txt.Text; processwrkName = Regex.Replace(processwrkName, @"\s", ""); var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(ProcessWorkCode_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); ProcessWorkCode_txt.Focus(); return; } else if (!sch.IsASCII(processwrkName)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); ProcessWorkName_txt.Focus(); return; } ProcessWorkVo inVo = new ProcessWorkVo { ProcessWorkCode = ProcessWorkCode_txt.Text.Trim(), ProcessWorkName = ProcessWorkName_txt.Text.Trim(), ProcessId = Convert.ToInt32(Process_cmb.SelectedValue), //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), // IsPhantom = isPhantom_cmb.SelectedValue.ToString(), IsPhantom = "0", LineMachineSelection = Convert.ToInt32(LineMachineSltn_cmb.SelectedValue.ToString()), DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text), RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessWorkVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ProcessWorkCode_lbl.Text + " : " + ProcessWorkCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo); if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DisplayOrder_txt.Focus(); return; } } else if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text)) { ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo); if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DisplayOrder_txt.Focus(); return; } } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new AddProcessWorkMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.ProcessWorkId = updateData.ProcessWorkId; ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new UpdateProcessWorkMasterMntCbm(), 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(); } } }