/// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (InventoryReasonCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InventoryReasonCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                InventoryReasonCode_txt.Focus();

                return(false);
            }

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

                InventoryReasonName_txt.Focus();

                return(false);
            }

            return(true);
        }
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InventoryReasonVo inVo = new InventoryReasonVo();

            if (CheckMandatory())
            {
                var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(InventoryReasonCode_txt.Text))
                    {
                        InventoryReasonCode_txt.Focus();
                    }
                    else
                    {
                        InventoryReasonName_txt.Focus();
                    }

                    return;
                }

                inVo.InventoryReasonCode = InventoryReasonCode_txt.Text.Trim();
                inVo.InventoryReasonName = InventoryReasonName_txt.Text.Trim();
                //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;
                inVo.FactoryCode          = UserData.GetUserData().FactoryCode;

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    InventoryReasonVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        InventoryReasonVo outVo = (InventoryReasonVo)base.InvokeCbm(new AddInventoryReasonMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        inVo.InventoryReasonId = updateData.InventoryReasonId;
                        InventoryReasonVo outVo = (InventoryReasonVo)base.InvokeCbm(new UpdateInventoryReasonMasterMntCbm(), 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();
                }
            }
        }