/// <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> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (DefectiveReasonCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, DefectiveReasonCode_lbl.Text); popUpMessage.Warning(messageData, Text); DefectiveReasonCode_txt.Focus(); return(false); } if (DefectiveReasonName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, DefectiveReasonName_lbl.Text); popUpMessage.Warning(messageData, Text); DefectiveReasonName_txt.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> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (StockLocationCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, StockLocationCode_lbl.Text); popUpMessage.Warning(messageData, Text); StockLocationCode_txt.Focus(); return(false); } if (StockLocationName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, StockLocationName_lbl.Text); popUpMessage.Warning(messageData, Text); StockLocationName_txt.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); } if (LocationType_cmb.Text == string.Empty || LocationType_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LocationType_lbl.Text); popUpMessage.Warning(messageData, Text); LocationType_cmb.Focus(); return(false); } return(true); }
private bool CheckDate() { if (ProdutionWorkContentCode_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, ProdutionWorkContentCode_lbl.Text); popUpMessage.Warning(messageData, Text); ProdutionWorkContentCode_txt.Focus(); return(false); } if (ProdutionWorkContentName_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, ProdutionWorkContentName_lbl.Text); popUpMessage.Warning(messageData, Text); ProdutionWorkContentName_txt.Focus(); return(false); } if (ProdutionWorkContentType_cmb.SelectedValue == null) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, ProdutionWorkContentType_lbl.Text); popUpMessage.Warning(messageData, Text); ProdutionWorkContentType_cmb.Focus(); return(false); } int orderid = 0; if (DisplayOrder_txt.Enabled && !int.TryParse(DisplayOrder_txt.Text, out orderid)) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, DisplayOrder_lbl.Text); popUpMessage.Warning(messageData, Text); DisplayOrder_txt.Focus(); return(false); } ProdutionWorkContentCode_txt.Text = ProdutionWorkContentCode_txt.Text.Trim(); ProdutionWorkContentName_txt.Text = ProdutionWorkContentName_txt.Text.Trim(); DisplayOrder_txt.Text = DisplayOrder_txt.Text.Trim(); ProdutionWorkContentVo outVo = new ProdutionWorkContentVo(), inVo = new ProdutionWorkContentVo { ProdutionWorkContentId = vo.ProdutionWorkContentId, ProdutionWorkContentCode = ProdutionWorkContentCode_txt.Text, ProdutionWorkContentName = ProdutionWorkContentName_txt.Text, DisplayOrder = orderid, ProdutionWorkContentTypeId = int.Parse(ProdutionWorkContentType_cmb.SelectedValue.ToString()) }; try { outVo = (ProdutionWorkContentVo)base.InvokeCbm(new CheckProdutionWorkContentCbm(), inVo, false); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, ProdutionWorkContentCode_lbl.Text + " & " + DisplayOrder_lbl.Text); popUpMessage.Warning(messageData, Text); ProdutionWorkContentCode_txt.Focus(); return(false); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return(false); } return(true); }
/// <summary> /// inserts/updates def reason /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { DefectiveReasonVo inVo = new DefectiveReasonVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(DefectiveReasonCode_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DefectiveReasonCode_txt.Focus(); return; } ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); inVo.DefectiveReasonCode = DefectiveReasonCode_txt.Text.Trim(); inVo.DefectiveReasonName = DefectiveReasonName_txt.Text.Trim(); inVo.DefectiveCategoryId = Convert.ToInt32(DefectiveCategory_cmb.SelectedValue); inVo.DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text); inVo.RegistrationUserCode = UserData.GetUserData().UserCode; inVo.FactoryCode = UserData.GetUserData().FactoryCode; if (string.Equals(mode, CommonConstants.MODE_ADD)) { DefectiveReasonVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DefectiveReasonCode_lbl.Text + " : " + DefectiveReasonCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DefectiveReasonCode_txt.Focus(); return; } DefectiveReasonVo 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 { this.StartProgress(Properties.Resources.mmci00009); if (string.Equals(mode, CommonConstants.MODE_ADD)) { inVoList.add(inVo); inVoList.add(GetSelectedProcessWork()); DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new AddDefectiveReasonMasterMntNewCbm(), inVoList, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.DefectiveReasonId = updateData.DefectiveReasonId; inVoList.add(inVo); inVoList.add(GetSelectedProcessWork()); DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new UpdateDefectiveReasonMasterMntNewCbm(), inVoList, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } finally { this.CompleteProgress(); } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }
/// <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(); } } }
/// <summary> /// update the record to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { MoldCategoryVo inVo = new MoldCategoryVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(MoldCategoryCode_txt.Text) || !sch.IsASCII(MoldCategoryName_txt.Text)) //|| !sch.IsASCII(DisplayOrder_txt.Text) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (!sch.IsASCII(MoldCategoryCode_txt.Text)) { MoldCategoryCode_txt.Focus(); } else if (!sch.IsASCII(MoldCategoryName_txt.Text)) { MoldCategoryName_txt.Focus(); } else { DisplayOrder_txt.Focus(); } return; } inVo.MoldCategoryCode = MoldCategoryCode_txt.Text.Trim(); inVo.MoldCategoryName = MoldCategoryName_txt.Text.Trim(); // inVo.DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text.Trim()); if (string.Equals(mode, CommonConstants.MODE_ADD)) { MoldCategoryVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCategoryCode_lbl.Text + " : " + MoldCategoryCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); MoldCategoryCode_txt.Focus(); return; } //MoldCategoryVo 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 { this.Cursor = Cursors.WaitCursor; if (string.Equals(mode, CommonConstants.MODE_ADD)) { MoldCategoryVo outVo = (MoldCategoryVo)base.InvokeCbm(new AddMoldCategoryMasterMntCbm(), inVo, false); IntSuccess = outVo.MoldCategoryId; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { //if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text)) //{ // MoldCategoryVo 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; // } //} inVo.MoldCategoryId = updateData.MoldCategoryId; MoldCategoryVo outVo = (MoldCategoryVo)base.InvokeCbm(new UpdateMoldCategoryMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } finally { this.Cursor = Cursors.Default; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }
/// <summary> /// inserts/updates item details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { if (CheckMandatory()) { StockLocationVo inVo = new StockLocationVo { StockLocationCode = StockLocationCode_txt.Text, StockLocationName = StockLocationName_txt.Text, //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), LocationType = Convert.ToInt32(LocationType_cmb.SelectedValue.ToString()), DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text), RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { StockLocationVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, StockLocationCode_lbl.Text + " : " + StockLocationCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } StockLocationVo 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)) { StockLocationVo 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)) { StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new AddStockLocationMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.StockLocationId = updateData.StockLocationId; StockLocationVo outVo = (StockLocationVo)base.InvokeCbm(new UpdateStockLocationMasterMntCbm(), 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> /// inserts/updates def reason /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { DefectiveReasonVo inVo = new DefectiveReasonVo(); if (CheckMandatory()) { //var sch = StringCheckHelper.GetInstance(); //if (string.IsNullOrEmpty(DefectiveReasonCode_txt.Text) || string.IsNullOrEmpty(DefectiveReasonName_txt.Text)) //{ // messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); // logger.Info(messageData); // popUpMessage.ConfirmationOkCancel(messageData, Text); // if (string.IsNullOrEmpty(DefectiveReasonCode_txt.Text)) // { // DefectiveReasonCode_txt.Focus(); // } // else // { // DefectiveReasonName_txt.Focus(); // } // return; //} inVo.DefectiveReasonCode = DefectiveReasonCode_txt.Text.Trim(); inVo.DefectiveReasonName = DefectiveReasonName_txt.Text.Trim(); inVo.DefectiveCategoryId = Convert.ToInt32(DefectiveCategory_cmb.SelectedValue); inVo.DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text); inVo.RegistrationUserCode = UserData.GetUserData().UserCode; inVo.FactoryCode = UserData.GetUserData().FactoryCode; if (string.Equals(mode, CommonConstants.MODE_ADD)) { DefectiveReasonVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DefectiveReasonCode_lbl.Text + " : " + DefectiveReasonCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DefectiveReasonCode_txt.Focus(); return; } DefectiveReasonVo 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; } } if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { //if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text)) // { // DefectiveReasonVo 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)) { DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new AddDefectiveReasonMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.DefectiveReasonId = updateData.DefectiveReasonId; DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new UpdateDefectiveReasonMasterMntCbm(), 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(); } } }