Beispiel #1
0
        /// <summary>
        /// form load event,loads data table and binds combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InspectionItemForm_Load(object sender, EventArgs e)
        {
            LoadInspectionProcessCombo();

            LoadParentInspectionCombo();

            InspectionItemCode_txt.Select();

            Update_btn.Enabled = InspectionSpecification_btn.Enabled = InspectionTestInstruction_btn.Enabled = Delete_btn.Enabled = false;
        }
Beispiel #2
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)
        {
            InspectionItemName_txt.Text = string.Empty;

            InspectionItemCode_txt.Text = string.Empty;

            ParentItemCode_cmb.SelectedIndex = -1;

            InspectionProcess_cmb.SelectedIndex = -1;

            InspectionItem_dgv.DataSource = null;

            InspectionItemCode_txt.Select();
            Update_btn.Enabled = InspectionSpecification_btn.Enabled = InspectionTestInstruction_btn.Enabled = Delete_btn.Enabled = false;
        }
Beispiel #3
0
        /// <summary>
        /// load data from db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddInspectionItemForm_Load(object sender, EventArgs e)
        {
            LoadInspectionProcessCombo();

            LoadParentInspectionCombo();

            InspectionItemCode_txt.Select();

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

                InspectionItemCode_txt.Enabled = false;

                InspectionItemName_txt.Select();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (InspectionItemCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionItemCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                InspectionItemCode_txt.Focus();

                return(false);
            }

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

                InspectionItemName_txt.Focus();

                return(false);
            }

            return(true);
        }
Beispiel #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();

            InspectionItemVo inVo = new InspectionItemVo();

            if (CheckMandatory())
            {
                if (string.IsNullOrEmpty(InspectionItemCode_txt.Text))
                {
                    messageData = new MessageData("mmce00006", Properties.Resources.mmce00006, InspectionItemCode_lbl.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    InspectionItemCode_txt.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(InspectionItemName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    InspectionItemName_txt.Focus();
                    return;
                }
                inVo.InspectionItemCode = InspectionItemCode_txt.Text.Trim();

                inVo.InspectionItemName = InspectionItemName_txt.Text.Trim();

                if (ParentItemCode_cmb.SelectedIndex > -1)
                {
                    inVo.ParentInspectionItemId = Convert.ToInt32(ParentItemCode_cmb.SelectedValue.ToString());
                }
                if (InspectionProcess_cmb.SelectedIndex > -1)
                {
                    inVo.InspectionProcessId = Convert.ToInt32(InspectionProcess_cmb.SelectedValue);
                }
                inVo.InspectionItemMandatory = Convert.ToInt32(InspectionItemMandatory_chk.Checked);

                inVo.InspectionEmployeeMandatory = Convert.ToInt32(InspectionEmployeeMandatory_chk.Checked);

                inVo.InspectionMachineMandatory = Convert.ToInt32(InspectionMachineMandatory_chk.Checked);

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

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

                        return;
                    }
                }

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