Ejemplo n.º 1
0
        /// <summary>
        /// load the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddProcessForm_Load(object sender, EventArgs e)
        {
            ProcessCode_txt.Select();

            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                LoadUserData(updateData);

                ProcessCode_txt.Enabled = false;

                ProcessName_txt.Select();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (ProcessCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ProcessCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                ProcessCode_txt.Focus();

                return(false);
            }
            if (ProcessName_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ProcessName_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                ProcessName_txt.Focus();

                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// inserts/updates process on ok click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                string nextPocessCode = string.Empty;

                var sch = StringCheckHelper.GetInstance();
                if (!sch.IsASCII(ProcessCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    ProcessCode_txt.Focus();
                    return;
                }

                else if (!sch.IsASCII(ProcessName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    ProcessName_txt.Focus();
                    return;
                }
                //if (NextProcessCode_txt.Text != null)
                //{
                //    nextPocessCode = NextProcessCode_txt.Text;
                //}

                ProcessVo inVo = new ProcessVo
                {
                    ProcessCode = ProcessCode_txt.Text.Trim(),
                    ProcessName = ProcessName_txt.Text.Trim(),
                    //NextPocessCode = nextPocessCode,
                    //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))
                {
                    ProcessVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ProcessCode_lbl.Text + " : " + ProcessCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        ProcessVo outVo = (ProcessVo)base.InvokeCbm(new AddProcessMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.ProcessId = updateData.ProcessId;

                        ProcessVo outVo = (ProcessVo)base.InvokeCbm(new UpdateProcessMasterMntCbm(), 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();
                }
            }
        }