Пример #1
0
        /// <summary>
        /// load the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMachineForm_Load(object sender, EventArgs e)
        {
            MachineCode_txt.Select();

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

                MachineCode_txt.Enabled = false;

                MachineName_txt.Select();
            }
        }
Пример #2
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (MachineCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MachineCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MachineCode_txt.Focus();

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

                MachineName_txt.Focus();

                return(false);
            }

            return(true);
        }
Пример #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())
            {
                var sch = StringCheckHelper.GetInstance();

                if (string.IsNullOrEmpty(MachineCode_txt.Text) || string.IsNullOrEmpty(MachineName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(MachineCode_txt.Text))
                    {
                        MachineCode_txt.Focus();
                    }
                    else
                    {
                        MachineName_txt.Focus();
                    }

                    return;
                }

                MachineVo inVo = new MachineVo
                {
                    MachineCode = MachineCode_txt.Text.Trim(),
                    MachineName = MachineName_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))
                {
                    MachineVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

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

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

                        MachineVo outVo = (MachineVo)base.InvokeCbm(new UpdateMachineMasterMntCbm(), 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();
                }
            }
        }
Пример #4
0
 /// <summary>
 /// form loading
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ProcessForm_Load(object sender, EventArgs e)
 {
     Update_btn.Enabled = Delete_btn.Enabled = false;
     MachineCode_txt.Select();
 }
Пример #5
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())
            {
                var sch = StringCheckHelper.GetInstance();

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

                MachineVo inVo = new MachineVo
                {
                    MachineCode = MachineCode_txt.Text.Trim(),
                    MachineName = MachineName_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))
                {
                    MachineVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

                ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();


                try
                {
                    this.StartProgress(Properties.Resources.mmci00009);

                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        inVoList.add(inVo);
                        inVoList.add(GetSelectedProcessWork());

                        MachineVo outVo = (MachineVo)base.InvokeCbm(new AddMachineMasterAndProcessworkCbm(), inVoList, false);

                        IntSuccess = (outVo.MachineId > 0) ? 1 : 0;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.MachineId = updateData.MachineId;

                        inVoList.add(inVo);
                        inVoList.add(GetSelectedProcessWork());

                        MachineVo outVo = (MachineVo)base.InvokeCbm(new UpdateMachineMasterAndProcessworkCbm(), inVoList, false);

                        IntSuccess = (outVo.AffectedCount > 0) ? 1 : 0;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    this.CompleteProgress();
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }