コード例 #1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (MoldTypeCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldTypeCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldTypeCode_txt.Focus();

                return(false);
            }

            if (MoldTypeName_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldTypeName_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldTypeName_txt.Focus();

                return(false);
            }
            if (Item_cmb.Text == string.Empty || Item_cmb.SelectedIndex < 0)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Item_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                Item_cmb.Focus();

                return(false);
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Handles Load event for moldtype data Insert/Update operations
        /// Loading moldtype data for update moldtype data and binding controls with selected moldtype record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMoldTypeForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(Item_cmb, itemDatatable, "code", "id");

            MoldTypeCode_txt.Select();

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

                MoldTypeCode_txt.Enabled = false;

                MoldTypeName_txt.Select();
            }
        }
コード例 #3
0
        /// <summary>
        /// inserts/updates mold type on button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(MoldTypeCode_txt.Text))
                    {
                        MoldTypeCode_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(MoldTypeName_txt.Text))
                    {
                        MoldTypeName_txt.Focus();
                    }
                    return;
                }
                MoldTypeVo inVo = new MoldTypeVo
                {
                    MoldTypeCode = MoldTypeCode_txt.Text.Trim(),
                    MoldTypeName = MoldTypeName_txt.Text.Trim(),
                    ItemId       = Convert.ToInt32(Item_cmb.SelectedValue),
                    //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))
                {
                    MoldTypeVo checkVo = DuplicateCheck(inVo);

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


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

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

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