Ejemplo n.º 1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (AuthorityControlCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, AuthorityControlCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                AuthorityControlCode_txt.Focus();

                return(false);
            }

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

                AuthorityControlName_txt.Focus();

                return(false);
            }

            //if (AssemblyName_txt.Text == string.Empty)
            //{
            //    MessageData messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, "Assembly Name");
            //    _popUpMessage.ConfirmationOkCancel(messageData, Text);

            //    AssemblyName_txt.Focus();

            //    return false;
            //}

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// load data from db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddAuthorityControlForm_Load(object sender, EventArgs e)
        {
            try
            {
                FormDatatableFromVo();
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
                return;
            }


            ComboBind(ParentControl_cmb, parentControlDatatable, "Name", "Code");

            AuthorityControlCode_txt.Select();

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

                AuthorityControlCode_txt.Enabled = false;

                AuthorityControlName_txt.Select();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// form load event,loads data table and binds combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AuthorityControlForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(ParentControl_cmb, parentDatatable, "Code", "Name");

            AuthorityControlCode_txt.Select();

            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// clear the search condition control values
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Clear_btn_Click(object sender, EventArgs e)
        {
            AuthorityControlName_txt.Text = string.Empty;

            AuthorityControlCode_txt.Text = string.Empty;

            ParentControl_cmb.SelectedIndex = -1;

            AuthorityControldetails_dgv.DataSource = null;

            AuthorityControlCode_txt.Select();
            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

            AuthorityControlVo inVo = new AuthorityControlVo();

            if (CheckMandatory())
            {
                if (!sch.IsSmallAlphabetOrNumeric(AuthorityControlCode_txt.Text))
                {
                    messageData = new MessageData("mmce00006", Properties.Resources.mmce00006, AuthorityControlCode_lbl.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlCode_txt.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(AuthorityControlName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlName_txt.Focus();
                    return;
                }
                inVo.AuthorityControlCode = AuthorityControlCode_txt.Text.Trim();

                inVo.AuthorityControlName = AuthorityControlName_txt.Text.Trim();

                if (ParentControl_cmb.SelectedIndex > -1)
                {
                    inVo.ParentControlCode = ParentControl_cmb.SelectedValue.ToString();
                }
                //inVo.AssemblyName = AssemblyName_txt.Text;

                //inVo.FormName = FormName_txt.Text;

                //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))
                {
                    AuthorityControlVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, AuthorityControlCode_lbl.Text + " : " + AuthorityControlCode_txt.Text);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

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