コード例 #1
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory() == true)
            {
                inVo.InspectionTestInstructionCode = InspectionTestInstructionCode_txt.Text.Trim();

                inVo.InspectionTestInstructionText = InspectionTestInstructionText_txt.Text.Trim();

                inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());

                inVo.Mode = mode;

                if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionTestInstructionId = updateData.InspectionTestInstructionId;
                }

                InspectionTestInstructionVo checkVo = DuplicateCheck(inVo);

                if (checkVo != null && checkVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionTestInstructionCode_lbl.Text + " : " + InspectionTestInstructionCode_txt.Text +
                                                  Environment.NewLine + " OR " + Environment.NewLine + InspectionItem_lbl.Text + " : " + InspectionItem_cmb.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);

                    return;
                }

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

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        InspectionTestInstructionVo outVo = (InspectionTestInstructionVo)base.InvokeCbm(new UpdateInspectionTestInstructionMasterMntCbm(), 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();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

            FactoryProductionDaysVo inVo = new FactoryProductionDaysVo();

            if (CheckMandatory())
            {
                inVo.iYear  = Convert.ToInt32(Year_txt.Text);
                inVo.iMonth = Convert.ToInt32(Month_cmb.SelectedItem.ToString());
                inVo.iDays  = Convert.ToInt32(Date_txt.Text);
                inVo.FactoryProductionDaysId = factoryProductionDaysId;
                inVo.BuildingId           = Convert.ToInt32(Building_cmb.SelectedValue);
                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;
                inVo.FactoryCode          = UserData.GetUserData().FactoryCode;

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

                        if (checkVo != null && checkVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00009", Properties.Resources.mmce00009, " " + Year_lbl.Text + " or " + MonthDate_lbl.Text.Substring(0, 5));
                            logger.Info(messageData);
                            popUpMessage.Warning(messageData, Text);
                            return;
                        }

                        FactoryProductionDaysVo outVo = (FactoryProductionDaysVo)base.InvokeCbm(new AddFactoryProductionDaysMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        FactoryProductionDaysVo outVo = (FactoryProductionDaysVo)base.InvokeCbm(new UpdateFactoryProductionDaysMasterMntCbm(), 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();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            MoldCategoryVo inVo = new MoldCategoryVo();

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

                if (!sch.IsASCII(MoldCategoryCode_txt.Text) || !sch.IsASCII(MoldCategoryName_txt.Text)) //|| !sch.IsASCII(DisplayOrder_txt.Text)
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (!sch.IsASCII(MoldCategoryCode_txt.Text))
                    {
                        MoldCategoryCode_txt.Focus();
                    }
                    else if (!sch.IsASCII(MoldCategoryName_txt.Text))
                    {
                        MoldCategoryName_txt.Focus();
                    }
                    else
                    {
                        DisplayOrder_txt.Focus();
                    }

                    return;
                }
                inVo.MoldCategoryCode = MoldCategoryCode_txt.Text.Trim();

                inVo.MoldCategoryName = MoldCategoryName_txt.Text.Trim();
                // inVo.DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text.Trim());

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

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

                    //MoldCategoryVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    //if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    //{
                    //    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                    //    logger.Info(messageData);
                    //    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    //    DisplayOrder_txt.Focus();
                    //    return;
                    //}
                }

                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        MoldCategoryVo outVo = (MoldCategoryVo)base.InvokeCbm(new AddMoldCategoryMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.MoldCategoryId;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        //if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text))
                        //{
                        //    MoldCategoryVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        //    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        //    {
                        //        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                        //        logger.Info(messageData);
                        //        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        //        DisplayOrder_txt.Focus();
                        //        return;
                        //    }
                        //}
                        inVo.MoldCategoryId = updateData.MoldCategoryId;
                        MoldCategoryVo outVo = (MoldCategoryVo)base.InvokeCbm(new UpdateMoldCategoryMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
コード例 #4
0
ファイル: AddMoldDetailForm.cs プロジェクト: D-Khoa/MyGit
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void Ok_btn_Click(object sender, EventArgs e)
        {
            MoldDetailVo inVo = new MoldDetailVo();

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

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

                    if (!sch.IsASCII(MoldCode_txt.Text))
                    {
                        MoldCode_txt.Focus();
                    }
                    //else
                    //{
                    //    MoldName_txt.Focus();
                    //}

                    return;
                }

                inVo.MoldCode = MoldCode_txt.Text.Trim();

                inVo.MoldName = MoldCode_txt.Text.Trim();

                if (!string.IsNullOrEmpty(Width_txt.Text))
                {
                    inVo.Width = Convert.ToDecimal(Width_txt.Text);
                }
                if (!string.IsNullOrEmpty(Depth_txt.Text))
                {
                    inVo.Depth = Convert.ToDecimal(Depth_txt.Text);
                }
                if (!string.IsNullOrEmpty(Weight_txt.Text))
                {
                    inVo.Weight = Convert.ToDecimal(Weight_txt.Text);
                }
                if (!string.IsNullOrEmpty(Height_txt.Text))
                {
                    inVo.Height = Convert.ToDecimal(Height_txt.Text);
                }

                if (!string.IsNullOrEmpty(LifeAlarmShot_txt.Text))
                {
                    inVo.LifeAlarmShotCount = Convert.ToInt32(LifeAlarmShot_txt.Text);
                }
                if (!string.IsNullOrEmpty(PASC1_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount1 = Convert.ToInt32(PASC1_txt.Text);
                }

                if (!string.IsNullOrEmpty(PASC2_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount2 = Convert.ToInt32(PASC2_txt.Text);
                }

                if (!string.IsNullOrEmpty(PASC3_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount3 = Convert.ToInt32(PASC3_txt.Text);
                }
                if (!string.IsNullOrWhiteSpace(ProductionDate_dtp.Text))
                {
                    inVo.ProductionDate = Convert.ToDateTime(ProductionDate_dtp.Value);
                }
                if (!string.IsNullOrWhiteSpace(MoldDrawingNo_txt.Text))
                {
                    inVo.MoldDrawingNo = MoldDrawingNo_txt.Text;
                }
                inVo.Comment = Comment_txt.Text;

                if (!string.IsNullOrWhiteSpace(LifeShotCount_txt.Text))
                {
                    inVo.LifeShotCount = Convert.ToInt32(LifeShotCount_txt.Text);
                }


                if (MoldCategory_cmb.SelectedIndex > -1)
                {
                    inVo.MoldCategoryId = (int)MoldCategory_cmb.SelectedValue;
                }

                if (Model_cmb.SelectedIndex > -1)
                {
                    inVo.ModelId = (int)Model_cmb.SelectedValue;
                }

                if (!string.IsNullOrWhiteSpace(MoldItemCode_txt.Text))
                {
                    inVo.MoldItemCode = MoldItemCode_txt.Text;
                    inVo.MoldItemId   = updateData.MoldItemId;
                }

                //if (!string.IsNullOrWhiteSpace(GlobalItemCode_txt.Text))
                //{
                //    inVo.MoldItemCode = GlobalItemCode_txt.Text;
                //}

                MoldDetailVo checkVo = DuplicateCheck(inVo);

                //GlobalItemVo globalItemInVo = new GlobalItemVo();
                //globalItemInVo.GlobalItemCode = inVo.MoldItemCode;

                //GlobalItemVo checkGlobalItemVo = DuplicateCheckGlobalItem(globalItemInVo);

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    //if (checkGlobalItemVo != null && checkGlobalItemVo.AffectedCount > 0)
                    //{
                    //    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, GlobalItemCode_lbl.Text + " : " + globalItemInVo.GlobalItemCode);
                    //    logger.Info(messageData);
                    //    popUpMessage.ApplicationError(messageData, Text);
                    //    return;
                    //}

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCode_lbl.Text + " : " + MoldCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);
                        return;
                    }
                }
                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    if (checkVo != null && checkVo.AffectedCount > 1)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCode_lbl.Text + " : " + MoldCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);
                        return;
                    }
                }

                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        MoldDetailVo outVo = (MoldDetailVo)base.InvokeCbm(new AddMoldAndMoldDetailMasterMntCbm(), inVo, false);

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

                        MoldDetailVo outVo = (MoldDetailVo)base.InvokeCbm(new UpdateMoldDetailMasterMntCbm(), inVo, false);

                        if (outVo != null && outVo.AffectedCount > 0)
                        {
                            IntSuccess = outVo.AffectedCount;
                        }
                        else
                        {
                            IntSuccess = 0;
                        }
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                this.Close();

                //if ((IntSuccess > 0) || (IntSuccess == 0))
                //{
                //    this.Close();
                //}
            }
        }
コード例 #5
0
ファイル: AddCavityForm.cs プロジェクト: D-Khoa/MyGit
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            CavityVo inVo = new CavityVo();

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

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

                    if (string.IsNullOrEmpty(CavityCode_txt.Text))
                    {
                        CavityCode_txt.Focus();
                    }
                    else
                    {
                        CavityName_txt.Focus();
                    }

                    return;
                }

                if (CavityCode_txt.Text.Trim().Length < 4)
                {
                    MessageData messageData = new MessageData("mmci00008", Properties.Resources.mmci00008, CavityCode_lbl.Text);
                    popUpMessage.Warning(messageData, Text);
                    CavityCode_txt.Focus();
                    return;
                }

                inVo.CavityCode = CavityCode_txt.Text.Trim();

                inVo.CavityName = CavityName_txt.Text.Trim();

                inVo.MoldId = Convert.ToInt32(Mold_cmb.SelectedValue);

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

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

                        return;
                    }
                }

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

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

                        CavityVo outVo = (CavityVo)base.InvokeCbm(new UpdateCavityMasterMntCbm(), 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();
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            LineVo inVo = new LineVo();

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

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

                    if (string.IsNullOrEmpty(LineCode_txt.Text))
                    {
                        LineCode_txt.Focus();
                    }
                    else
                    {
                        LineName_txt.Focus();
                    }

                    return;
                }

                inVo.LineCode = LineCode_txt.Text.Trim();
                inVo.LineName = LineName_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))
                {
                    LineVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        LineVo outVo = (LineVo)base.InvokeCbm(new AddLineMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        inVo.LineId = updateData.LineId;
                        LineVo outVo = (LineVo)base.InvokeCbm(new UpdateLineMasterMntCbm(), 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();
                }
            }
        }
コード例 #7
0
ファイル: AddInspectionItemForm.cs プロジェクト: D-Khoa/MyGit
        /// <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();
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                string processwrkName = ProcessWorkName_txt.Text;
                processwrkName = Regex.Replace(processwrkName, @"\s", "");

                var sch = StringCheckHelper.GetInstance();
                if (!sch.IsASCII(ProcessWorkCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    ProcessWorkCode_txt.Focus();
                    return;
                }
                else if (!sch.IsASCII(processwrkName))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    ProcessWorkName_txt.Focus();
                    return;
                }
                ProcessWorkVo inVo = new ProcessWorkVo
                {
                    ProcessWorkCode = ProcessWorkCode_txt.Text.Trim(),
                    ProcessWorkName = ProcessWorkName_txt.Text.Trim(),
                    ProcessId       = Convert.ToInt32(Process_cmb.SelectedValue),
                    //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                    // IsPhantom = isPhantom_cmb.SelectedValue.ToString(),
                    IsPhantom            = "0",
                    LineMachineSelection = Convert.ToInt32(LineMachineSltn_cmb.SelectedValue.ToString()),
                    DisplayOrder         = Convert.ToInt32(DisplayOrder_txt.Text),
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                    FactoryCode          = UserData.GetUserData().FactoryCode
                };

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

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

                    ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        DisplayOrder_txt.Focus();
                        return;
                    }
                }

                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text))
                    {
                        ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                            logger.Info(messageData);
                            popUpMessage.ConfirmationOkCancel(messageData, Text);
                            DisplayOrder_txt.Focus();
                            return;
                        }
                    }
                }

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

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

                        ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new UpdateProcessWorkMasterMntCbm(), 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();
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// update data to db
        /// </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(LocalSupplierCavityCode_txt.Text) || string.IsNullOrEmpty(LocalSupplierCavityName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(LocalSupplierCavityCode_txt.Text))
                    {
                        LocalSupplierCavityCode_txt.Focus();
                    }
                    else
                    {
                        LocalSupplierCavityName_txt.Focus();
                    }

                    return;
                }

                LocalSupplierCavityVo inVo = new LocalSupplierCavityVo
                {
                    LocalSupplierCavityCode = LocalSupplierCavityCode_txt.Text.Trim(),
                    LocalSupplierCavityName = LocalSupplierCavityName_txt.Text.Trim(),
                    LocalSupplierId         = Convert.ToInt32(LocalSupplier_cmb.SelectedValue),
                    ItemId = Convert.ToInt32(Item_cmb.SelectedValue),
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                    FactoryCode          = UserData.GetUserData().FactoryCode
                };

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

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

                        return;
                    }
                }

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

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

                        LocalSupplierCavityVo outVo = (LocalSupplierCavityVo)base.InvokeCbm(new UpdateLocalSupplierCavityMasterMntCbm(), 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();
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionProcessVo inVo = new InspectionProcessVo();
            var sch = StringCheckHelper.GetInstance();

            if (!CheckMandatory())
            {
                return;
            }

            inVo.InspectionProcessName = InspectionProcessName_txt.Text.Trim();

            inVo.InspectionFormatId = updateData.InspectionFormatId; // Convert.ToInt32(InspectionFormat_cmb.SelectedValue.ToString());

            inVo.DisplayOrder = Convert.ToInt32(InspectionProcessDisplayOrder_txt.Text);

            if (string.Equals(mode, CommonConstants.MODE_ADD))
            {
                InspectionProcessVo checkVo = DuplicateCheck(inVo);
                if (checkVo != null && checkVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessName_lbl.Text + " : " + InspectionProcessName_txt.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    return;
                }

                InspectionProcessVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessDisplayOrder_lbl.Text + " : " + InspectionProcessDisplayOrder_txt.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    InspectionProcessDisplayOrder_txt.Focus();
                    return;
                }

                if (InspectionprocessId == 0)
                {
                    inVo.InspectionProcessCode = updateData.InspectionFormatCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + GlobalMasterDataTypeEnum.PROCESS_CODE.GetValue() + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + RunningNumber;
                    InspectionProcessVo outVo = null;
                    try
                    {
                        outVo = (InspectionProcessVo)base.InvokeCbm(new AddInspectionProcessMasterMntCbm(), inVo, false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                        return;
                    }
                    if (outVo == null)
                    {
                        return;
                    }
                    IntSuccess = outVo.InspectionProcessId;
                }
                else
                {
                    inVo.InspectionProcessIdCopy = InspectionprocessId;
                    //InspectionFormatVo getformatvo = inspectionFormatOutVo.GetList().Where(t => t.InspectionFormatId == inVo.InspectionFormatId).FirstOrDefault();
                    //if (getformatvo == null) return;

                    string message = string.Format(Properties.Resources.mmci00036, CopyProcess_txt.Text);
                    base.StartProgress(message);

                    inVo.InspectionFormatCode = updateData.InspectionFormatCode; // getformatvo.InspectionFormatCode;
                    inVo.SequenceNo           = RunningNumber;

                    ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();
                    inVoList.add(null);
                    inVoList.add(inVo);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    InspectionReturnVo OutVo = null;
                    try
                    {
                        OutVo = (InspectionReturnVo)base.InvokeCbm(new CopyInspectionFormatMasterMntCbm(), inVoList, false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                        return;
                    }
                    finally
                    {
                        CompleteProgress();
                    }
                    if (OutVo != null && OutVo.AffectedCount > 0)
                    {
                        IntSuccess     = OutVo.InspectionProcessId;
                        ReturnFormatId = OutVo.InspectionFormatId;
                    }
                }
            }
            else if (mode.Equals(CommonConstants.MODE_UPDATE))
            {
                if (InspectionProcessName_txt.Text == updateData.InspectionProcessName && InspectionProcessDisplayOrder_txt.Text == updateData.DisplayOrder.ToString())
                {
                    return;
                }
                if (InspectionProcessName_txt.Text != updateData.InspectionProcessName)
                {
                    InspectionProcessVo checkVo = DuplicateCheck(inVo);
                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessName_lbl.Text + " : " + InspectionProcessName_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        return;
                    }
                }
                if (InspectionProcessDisplayOrder_txt.Text != updateData.DisplayOrder.ToString())
                {
                    InspectionProcessVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessDisplayOrder_lbl.Text + " : " + InspectionProcessDisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        InspectionProcessDisplayOrder_txt.Focus();
                        return;
                    }
                }

                inVo.InspectionProcessId   = updateData.InspectionProcessId;
                inVo.InspectionProcessCode = updateData.InspectionProcessCode;

                string message = string.Format(Properties.Resources.mmci00037, "Inspection Process", InspectionProcessName_txt.Text);
                StartProgress(message);

                ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                InspectionFormatVo            passformatVo = FormFormatVo(updateData.InspectionProcessId);
                if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                {
                    return;
                }

                inVoList.add(passformatVo);
                inVoList.add(inVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);

                InspectionReturnVo outVo = null;

                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    CompleteProgress();
                }
                if (outVo != null && outVo.AffectedCount > 0)
                {
                    IntSuccess     = outVo.InspectionProcessId;
                    ReturnFormatId = outVo.InspectionFormatId;
                }
            }
            if (IntSuccess > 0)
            {
                this.Close();
            }
        }
コード例 #11
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();
                }
            }
        }
コード例 #12
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();
                }
            }
        }
コード例 #13
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionSpecificationVo inVo = new InspectionSpecificationVo();
            var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(InspectionSpecificationCode_txt.Text))
                    {
                        InspectionSpecificationCode_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(InspectionSpecificationText_txt.Text))
                    {
                        InspectionSpecificationText_txt.Focus();
                    }
                    return;
                }

                if (string.Equals(mode, CommonConstants.MODE_SELECT))
                {
                    if (InspectionSpecificationCode_txt.Text == updateData.InspectionSpecificationCode)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationCode_lbl.Text + " : " + InspectionSpecificationCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                    if (InspectionSpecificationText_txt.Text == updateData.InspectionSpecificationText)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationText_lbl.Text + " : " + InspectionSpecificationText_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

                inVo.InspectionSpecificationCode = InspectionSpecificationCode_txt.Text.Trim();

                inVo.InspectionSpecificationText = InspectionSpecificationText_txt.Text.Trim();

                // inVo.ValueFrom = Convert.ToDecimal(ValueFrom_txt.Text.Trim());

                if (!string.IsNullOrWhiteSpace(ValueTo_txt.Text.Trim()))
                {
                    //  inVo.ValueTo = Convert.ToDecimal(ValueTo_txt.Text.Trim());
                }

                if (!string.IsNullOrWhiteSpace(Unit_txt.Text.Trim()))
                {
                    inVo.Unit = Unit_txt.Text.Trim();
                }

                if (!string.IsNullOrWhiteSpace(OperatorFrom_txt.Text.Trim()))
                {
                    inVo.OperatorFrom = OperatorFrom_txt.Text.Trim();
                }

                if (!string.IsNullOrWhiteSpace(OperatorTo_txt.Text.Trim()))
                {
                    inVo.OperatorTo = OperatorTo_txt.Text.Trim();
                }

                inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());

                inVo.SpecificationResultJudgeType = Convert.ToInt32(SpecificationResultJudgeType_cmb.SelectedValue.ToString());

                if (mode.Equals(CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionSpecificationId = updateData.InspectionSpecificationId;
                }

                inVo.Mode = mode;

                InspectionSpecificationVo checkVo = DuplicateCheck(inVo);

                if (checkVo != null && checkVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationCode_lbl.Text + " : " + InspectionSpecificationCode_txt.Text +
                                                  Environment.NewLine + " OR " + Environment.NewLine + InspectionItem_lbl.Text + " : " + InspectionItem_cmb.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    return;
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD) || string.Equals(mode, CommonConstants.MODE_SELECT))
                    {
                        UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new AddInspectionSpecificationMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        InspectionSpecificationVo outVo = (InspectionSpecificationVo)base.InvokeCbm(new UpdateInspectionSpecificationMasterMntCbm(), 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();
                }
            }
        }
コード例 #14
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();

            if (CheckMandatory())
            {
                if (!sch.IsASCII(CustomerCode_txt.Text) || !sch.IsASCII(CustomerName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (!sch.IsASCII(CustomerCode_txt.Text))
                    {
                        CustomerCode_txt.Focus();
                    }
                    else
                    {
                        CustomerName_txt.Focus();
                    }
                    return;
                }

                CustomerVo inVo = new CustomerVo
                {
                    CustomerCode = CustomerCode_txt.Text.Trim(),
                    CustomerName = CustomerName_txt.Text.Trim(),
                    Address1     = Address1_txt.Text.Trim(),
                    Address2     = Address2_txt.Text.Trim(),
                    EmailId      = EmailId_txt.Text.Trim(),
                    Remarks      = Remarks_txt.Text.Trim(),
                    PhoneNo      = PhoneNo_txt.Text.Trim(),
                };

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

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

                        return;
                    }
                }


                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        CustomerVo outVo = (CustomerVo)base.InvokeCbm(new AddCustomerMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        inVo.CustomerId = updateData.CustomerId;
                        CustomerVo outVo = (CustomerVo)base.InvokeCbm(new UpdateCustomerMasterMntCbm(), 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();
                }
            }
        }
コード例 #15
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            BuildingVo inVo = new BuildingVo();

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

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

                    if (!sch.IsASCII(BuildingCode_txt.Text))
                    {
                        BuildingCode_txt.Focus();
                    }
                    else
                    {
                        BuildingName_txt.Focus();
                    }

                    return;
                }
                inVo.BuildingCode = BuildingCode_txt.Text.Trim();

                inVo.BuildingName = BuildingName_txt.Text.Trim();
                inVo.FactoryCode  = FactoryCode_cmb.SelectedValue.ToString();

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

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

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

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

                        BuildingVo outVo = (BuildingVo)base.InvokeCbm(new UpdateBuildingMasterMntCbm(), 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();
                }
            }
        }
コード例 #16
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();

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

                    return;
                }

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

                //    if (string.IsNullOrEmpty(UserCode_txt.Text))
                //    {
                //        UserCode_txt.Focus();
                //    }
                //    else
                //    {
                //        UserName_txt.Focus();
                //    }
                //    return;
                //}

                string multilogin = string.Empty;
                string language   = string.Empty;
                int    country    = 0;

                if (MultiLogin_chk.Checked)
                {
                    multilogin = "******";
                }

                //if (Language_cmb.SelectedIndex > -1)
                //{
                //    language = Language_cmb.SelectedValue.ToString();
                //}
                if (Country_cmb.SelectedIndex > -1)
                {
                    country = Convert.ToInt32(Country_cmb.SelectedValue.ToString());
                }



                UserVo inVo = new UserVo
                {
                    UserCode = UserCode_txt.Text.Trim(),
                    UserName = UserName_txt.Text.Trim(),
                    PassWord = encryptDecrypt.Encrypt(Password_txt.Text.Trim()),
                    //Language = language,
                    MultiLoginFlag          = multilogin,
                    IpAddress               = UserData.GetUserData().IpAddress,
                    RegistrationUserCode    = UserData.GetUserData().UserCode,
                    LocaleId                = country,
                    RegistrationFactoryCode = FactoryCode_cmb.SelectedValue.ToString()
                };
                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    UserVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        UserVo outVo = (UserVo)base.InvokeCbm(new AddLoginPasswordMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        UserVo outVo = (UserVo)base.InvokeCbm(new UpdateLocalUserMasterMntCbm(), 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();
                }
            }
        }
コード例 #17
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionItemSelectionDatatypeValueVo inVo = new InspectionItemSelectionDatatypeValueVo();
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory() == true)
            {
                inVo.InspectionItemSelectionDatatypeValueText = SelectionDatatypeValueText_txt.Text.Trim();

                inVo.DisplayOrder = Convert.ToInt32(InspectionItemDisplayOrder_txt.Text);

                if (InspectionItem_cmb.SelectedValue != null && InspectionItem_cmb.SelectedIndex >= 0)
                {
                    inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());
                }

                if (updateData != null)
                {
                    inVo.InspectionItemId = updateData.InspectionItemId;
                }

                if (mode.Equals(CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionItemSelectionDatatypeValueId = updateData.InspectionItemSelectionDatatypeValueId;
                }

                inVo.Mode = mode;

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD) || string.Equals(mode, CommonConstants.MODE_SELECT))
                    {
                        InspectionItemSelectionDatatypeValueVo checkVo = DuplicateCheck(inVo);
                        if (checkVo != null && checkVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, SelectionDatatypeValueText_lbl.Text + " : " + SelectionDatatypeValueText_txt.Text);
                            popUpMessage.Information(messageData, Text);

                            return;
                        }

                        InspectionItemSelectionDatatypeValueVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                            InspectionItemDisplayOrder_txt.Focus();
                            return;
                        }

                        inVo.InspectionItemSelectionDatatypeValueCode = InspectionItemCode
                                                                        + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue()
                                                                        + GlobalMasterDataTypeEnum.SELECTION_VALUE_CODE.GetValue() + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + RunningNumber;

                        UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new AddInspectionItemSelectionDatatypeValueCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        if (SelectionDatatypeValueText_txt.Text == updateData.InspectionItemSelectionDatatypeValueText && updateData.DisplayOrder == Convert.ToInt32(InspectionItemDisplayOrder_txt.Text))
                        {
                            return;
                        }
                        if (updateData.InspectionItemSelectionDatatypeValueText != SelectionDatatypeValueText_txt.Text)
                        {
                            InspectionItemSelectionDatatypeValueVo checkVo = DuplicateCheck(inVo);
                            if (checkVo != null && checkVo.AffectedCount > 0)
                            {
                                messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, SelectionDatatypeValueText_lbl.Text + " : " + SelectionDatatypeValueText_txt.Text);
                                popUpMessage.Information(messageData, Text);

                                return;
                            }
                        }

                        if (updateData.DisplayOrder != Convert.ToInt32(InspectionItemDisplayOrder_txt.Text))
                        {
                            InspectionItemSelectionDatatypeValueVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                            if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                            {
                                messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                                logger.Info(messageData);
                                popUpMessage.Information(messageData, Text);
                                InspectionItemDisplayOrder_txt.Focus();
                                return;
                            }
                        }

                        if (updateData == null)
                        {
                            UpdateResultVo outResultVo = (UpdateResultVo)base.InvokeCbm(new UpdateInspectionItemSelectionDatatypeValueCbm(), inVo, false);
                            if (outResultVo == null)
                            {
                                return;
                            }
                            IntSuccess = outResultVo.AffectedCount;
                        }
                        else
                        {
                            string message = string.Format(Properties.Resources.mmci00037, "Inspection Item Selection Datatype Value", SelectionDatatypeValueText_txt.Text);
                            StartProgress(message);

                            ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                            InspectionFormatVo            passformatVo = FormFormatVo(updateData.InspectionItemId);
                            if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                            {
                                return;
                            }

                            inVoList.add(passformatVo);
                            inVoList.add(null);
                            inVoList.add(null);
                            inVoList.add(inVo);
                            inVoList.add(null);
                            inVoList.add(null);
                            inVoList.add(null);

                            InspectionReturnVo outVo = null;

                            try
                            {
                                outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                            }
                            catch (Framework.ApplicationException exception)
                            {
                                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                                logger.Error(exception.GetMessageData());
                                return;
                            }
                            finally
                            {
                                CompleteProgress();
                            }
                            if (outVo != null && outVo.AffectedCount > 0)
                            {
                                IntSuccess       = outVo.AffectedCount;
                                InspectionItemId = outVo.InspectionItemId;

                                InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic();
                                InspectionReturnVo invo = new InspectionReturnVo();
                                invo.InspectionItemId = outVo.InspectionItemId;
                                InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo);
                                if (getInspectionVo != null && getInspectionVo.InspectionProcessId > 0)
                                {
                                    InspectionProcessId = getInspectionVo.InspectionProcessId;
                                }
                            }
                        }
                        //UpdateInspectionItemSelectionDatatypeValueVo = new InspectionItemSelectionDatatypeValueVo();

                        //UpdateInspectionItemSelectionDatatypeValueVo = inVo;
                        //this.Close();
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0))
                {
                    //messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                    //logger.Info(messageData);
                    //popUpMessage.Information(messageData, Text);
                    this.Close();
                }
            }
        }
コード例 #18
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();
            var sch = StringCheckHelper.GetInstance();

            if (!CheckMandatory())
            {
                return;
            }

            inVo.InspectionTestInstructionText = InspectionTestInstructionText_txt.Text.Trim();

            //inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());

            inVo.InspectionItemId = updateData.InspectionItemId;

            inVo.Mode = mode;

            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                inVo.InspectionTestInstructionId = InspectionTestInstructionId;
            }

            //InspectionTestInstructionVo checkVo = DuplicateCheck(inVo);
            //if (checkVo != null && checkVo.AffectedCount > 0)
            //{
            //    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionTestInstructionCode_lbl.Text + " : " + InspectionTestInstructionCode_txt.Text +
            //                                                                Environment.NewLine + " OR " + Environment.NewLine + InspectionItem_lbl.Text + " : " + InspectionItem_cmb.Text);
            //    logger.Info(messageData);
            //    popUpMessage.ConfirmationOkCancel(messageData, Text);

            //    return;
            //}
            if (string.Equals(mode, CommonConstants.MODE_ADD))
            {
                InspectionTestInstructionCode      = updateData.InspectionItemCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + GlobalMasterDataTypeEnum.TEST_INST_CODE.GetValue();
                inVo.InspectionTestInstructionCode = InspectionTestInstructionCode;

                InspectionTestInstructionVo outVo = null;

                try
                {
                    outVo = (InspectionTestInstructionVo)base.InvokeCbm(new AddInspectionTestInstructionMasterMntCbm(), inVo, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                if (outVo == null)
                {
                    return;
                }
                IntSuccess = outVo.InspectionTestInstructionId;
                InspectionTestInstructionId = outVo.InspectionTestInstructionId;
                mode = CommonConstants.MODE_UPDATE;
            }
            else if (mode.Equals(CommonConstants.MODE_UPDATE))
            {
                inVo.InspectionTestInstructionCode = InspectionTestInstructionCode;

                // InspectionTestInstructionVo outVo = (InspectionTestInstructionVo)base.InvokeCbm(new UpdateInspectionTestInstructionMasterMntCbm(), inVo, false);

                string message = string.Format(Properties.Resources.mmci00037, "Inspection Test Instruction", InspectionTestInstructionText_txt.Text);
                StartProgress(message);

                ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                InspectionFormatVo            passformatVo = FormFormatVo(inVo.InspectionItemId);
                if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                {
                    return;
                }

                inVoList.add(passformatVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(inVo);
                inVoList.add(null);

                InspectionReturnVo outVo = null;
                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    CompleteProgress();
                }
                if (outVo != null && outVo.AffectedCount > 0)
                {
                    IntSuccess                  = outVo.AffectedCount;
                    InspectionItemId            = outVo.InspectionItemId;
                    updateData.InspectionItemId = InspectionItemId;
                    InspectionTestInstructionId = outVo.InspectionTestInstructionId;
                    //FormDatatableFromVo();
                    //ComboBind(InspectionItem_cmb, inspectionitemDatatable, "Name", "Id");
                    //InspectionItem_cmb.SelectedValue = InspectionItemId;
                }
            }
            if ((IntSuccess > 0))
            {
                messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                popUpMessage.Information(messageData, Text);
                Detail_btn.Enabled = delete_btn.Enabled = true;
            }
        }
コード例 #19
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            SapUserVo inVo = new SapUserVo();

            var sch = StringCheckHelper.GetInstance();

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

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

                if (UserName_cmb.SelectedIndex > -1)
                {
                    inVo.MesUserCode = UserName_cmb.SelectedValue.ToString();
                }

                inVo.SapPassWord = UserPassword_txt.Text.Trim();
                inVo.SapUser     = SapUserName_txt.Text.Trim();

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        SapUserVo outVo = (SapUserVo)base.InvokeCbm(new AddSapUserMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        inVo.SapUserId = updateData.SapUserId;
                        SapUserVo outVo = (SapUserVo)base.InvokeCbm(new UpdateSapUserMasterMntCbm(), 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();
                }
            }
        }
コード例 #20
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())
            {
                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.InspectionProcessId = updateData.InspectionProcessId;

                inVo.InspectionItemMandatory = Convert.ToInt32(InspectionItemMandatory_chk.Checked);

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

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

                inVo.InspectionItemDataType = Convert.ToInt32(InspectionItemDataType_cmb.SelectedValue);

                inVo.DisplayOrder = Convert.ToInt32(InspectionItemDisplayOrder_txt.Text);

                if (!string.IsNullOrEmpty(ResultItemDecimalDigits_txt.Text))
                {
                    inVo.InspectionResultItemDecimalDigits = Convert.ToInt32(ResultItemDecimalDigits_txt.Text);
                }

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    InspectionItemVo checkVo = DuplicateCheck(inVo);
                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemName_lbl.Text + " : " + InspectionItemName_txt.Text);
                        popUpMessage.Information(messageData, Text);

                        return;
                    }

                    InspectionItemVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        InspectionItemDisplayOrder_txt.Focus();
                        return;
                    }
                }
                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    if (updateData.InspectionItemName != InspectionItemName_txt.Text)
                    {
                        InspectionItemVo checkVo = DuplicateCheck(inVo);
                        if (checkVo != null && checkVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemName_lbl.Text + " : " + InspectionItemName_txt.Text);
                            popUpMessage.Information(messageData, Text);

                            return;
                        }
                    }

                    if (updateData.DisplayOrder != Convert.ToInt32(InspectionItemDisplayOrder_txt.Text))
                    {
                        InspectionItemVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                            InspectionItemDisplayOrder_txt.Focus();
                            return;
                        }
                    }
                }
                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    inVo.InspectionItemCode = InspectionItemCode;

                    if (InspectionItemCopyId == 0)
                    {
                        InspectionItemVo outVo = null;
                        try
                        {
                            outVo = (InspectionItemVo)base.InvokeCbm(new AddInspectionItemMasterMntCbm(), inVo, false);
                        }
                        catch (Framework.ApplicationException exception)
                        {
                            popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                            logger.Error(exception.GetMessageData());
                            return;
                        }
                        if (outVo == null && outVo.InspectionItemId == 0)
                        {
                            return;
                        }

                        IntSuccess = outVo.InspectionItemId;

                        //
                        if (InspectionItemDataType_cmb.SelectedIndex > -1 &&
                            InspectionItemDataType_cmb.SelectedValue.ToString() == GlobalMasterDataTypeEnum.DATATYPE_SELECTION.GetValue().ToString())
                        {
                            InspectionItemSelectionDatatypeValueVo inspectionItemSelectionDatatypeValueVo = new InspectionItemSelectionDatatypeValueVo();
                            inspectionItemSelectionDatatypeValueVo.InspectionItemCode = InspectionItemCode;
                            inspectionItemSelectionDatatypeValueVo.InspectionItemId   = outVo.InspectionItemId;
                            try
                            {
                                UpdateResultVo updateResultVo = (UpdateResultVo)base.InvokeCbm(new UpdateInspectionItemIdForSelectionValueCbm(), inspectionItemSelectionDatatypeValueVo, false);
                            }
                            catch (Framework.ApplicationException exception)
                            {
                                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                                logger.Error(exception.GetMessageData());
                                return;
                            }
                        }
                    }
                    else
                    {
                        inVo.InspectionItemIdCopy = InspectionItemCopyId;
                        //InspectionFormatVo getformatvo = inspectionFormatOutVo.GetList().Where(t => t.InspectionFormatId == inVo.InspectionFormatId).FirstOrDefault();
                        //if (getformatvo == null) return;

                        if (!CheckDataExist(InspectionItemCopyId))
                        {
                            messageData = new MessageData("mmci00048", Properties.Resources.mmci00048.ToString(), CopyItem_txt.Text);
                            logger.Info(messageData);
                            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);
                            if (dialogResult != DialogResult.OK)
                            {
                                return;
                            }
                        }

                        string message = string.Format(Properties.Resources.mmci00045, CopyItem_txt.Text);
                        base.StartProgress(message);

                        inVo.InspectionProcessCode = updateData.InspectionProcessCode; // getformatvo.InspectionFormatCode;
                        //inVo.SequenceNo = RunningNumber;

                        ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();
                        inVoList.add(null);
                        inVoList.add(null);
                        inVoList.add(inVo);
                        inVoList.add(null);
                        inVoList.add(null);
                        inVoList.add(null);
                        inVoList.add(null);
                        InspectionReturnVo OutVo = null;
                        try
                        {
                            OutVo = (InspectionReturnVo)base.InvokeCbm(new CopyInspectionItemFromItemAllCbm(), inVoList, false);
                        }
                        catch (Framework.ApplicationException exception)
                        {
                            popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                            logger.Error(exception.GetMessageData());
                            return;
                        }
                        finally
                        {
                            CompleteProgress();
                        }
                        if (OutVo != null && OutVo.AffectedCount > 0)
                        {
                            IntSuccess      = OutVo.InspectionItemId;
                            ReturnProcessId = OutVo.InspectionProcessId;
                            is_Copied       = true;
                        }
                    }
                }
                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionItemId = updateData.InspectionItemId;

                    string message = string.Format(Properties.Resources.mmci00037, "Inspection Item", InspectionItemName_txt.Text);
                    StartProgress(message);

                    ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                    InspectionFormatVo            passformatVo = FormFormatVo(updateData.InspectionItemId);
                    if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                    {
                        return;
                    }

                    inVoList.add(passformatVo);
                    inVoList.add(null);
                    inVoList.add(inVo);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);

                    InspectionReturnVo outVo = null;

                    try
                    {
                        outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                        return;
                    }
                    finally
                    {
                        CompleteProgress();
                    }
                    if (outVo != null && outVo.AffectedCount > 0)
                    {
                        IntSuccess      = outVo.InspectionItemId;
                        ReturnProcessId = outVo.InspectionProcessId;
                    }

                    //InspectionItemVo outVo = (InspectionItemVo)base.InvokeCbm(new UpdateInspectionItemMasterMntCbm(), inVo, false);
                }

                if (IntSuccess > 0)
                {
                    this.Close();
                }
            }
        }
コード例 #21
0
        /// <summary>
        /// inserts/updates def reason
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            DefectiveReasonVo inVo = new DefectiveReasonVo();

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

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



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

                inVo.DefectiveReasonCode = DefectiveReasonCode_txt.Text.Trim();

                inVo.DefectiveReasonName = DefectiveReasonName_txt.Text.Trim();

                inVo.DefectiveCategoryId = Convert.ToInt32(DefectiveCategory_cmb.SelectedValue);

                inVo.DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text);

                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;

                inVo.FactoryCode = UserData.GetUserData().FactoryCode;

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

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DefectiveReasonCode_lbl.Text + " : " + DefectiveReasonCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        DefectiveReasonCode_txt.Focus();
                        return;
                    }
                    DefectiveReasonVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        DisplayOrder_txt.Focus();
                        return;
                    }
                }

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

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

                        inVoList.add(GetSelectedProcessWork());

                        DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new AddDefectiveReasonMasterMntNewCbm(), inVoList, false);

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

                        inVoList.add(inVo);

                        inVoList.add(GetSelectedProcessWork());

                        DefectiveReasonVo outVo = (DefectiveReasonVo)base.InvokeCbm(new UpdateDefectiveReasonMasterMntNewCbm(), inVoList, false);

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

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
コード例 #22
0
ファイル: LineRestTimeForm.cs プロジェクト: D-Khoa/MyGit
        private void Upload_btn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDialog_dlg = new OpenFileDialog();

            openDialog_dlg.Filter = "Excel Files(*.xls) |*.xls";

            if (openDialog_dlg.ShowDialog() == DialogResult.OK)
            {
                this.StartProgress(Properties.Resources.mmci00009);

                try
                {
                    excelUploadDt = new ExcelUpload().ReadExcel(openDialog_dlg.FileName, Properties.Settings.Default.EXCEL_SHEET_LINE_MASTER);
                }
                catch (Framework.ApplicationException exception)
                {
                    this.CompleteProgress();
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                LineVo lineVo = new LineVo();

                ProcessWorkLineVo processWorkLineVo = new ProcessWorkLineVo();

                LineDetails_dgv.DataSource = null;
                excelUploadDt.Columns.Add("Remarks");
                var  sch         = StringCheckHelper.GetInstance();
                bool inputDataNG = false;

                foreach (DataRow row in excelUploadDt.Rows)
                {
                    if (row["LineCode"] == null || string.IsNullOrWhiteSpace(row["LineCode"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00011, LineCode_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    if (!sch.IsASCII(row["LineCode"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmci00017, LineCode_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    if (row["LineName"] == null || string.IsNullOrWhiteSpace(row["LineName"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00011, LineName_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    lineVo            = new LineVo();
                    processWorkLineVo = new ProcessWorkLineVo();

                    lineVo.LineCode = row["LineCode"].ToString();
                    lineVo.LineName = row["LineName"].ToString();

                    if (!ValidateProcessWorkCodeInExcel(excelUploadDt, lineVo.LineCode))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmci00019);
                        inputDataNG    = true;
                        continue;
                    }

                    LineVo checkVo = DuplicateCheck(lineVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00012, LineCode_lbl.Text + " : " + lineVo.LineCode);
                        inputDataNG    = true;
                        continue;
                    }

                    var duplicates = excelUploadDt.AsEnumerable().GroupBy(r => r["LineCode"]).Where(gr => gr.Count() > 1).ToList();

                    if (duplicates.Any() && duplicates.Select(dupl => dupl.Key).ToList().FirstOrDefault().ToString() == row["LineCode"].ToString())
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00009, LineCode_lbl.Text + " : " + row["LineCode"].ToString());
                        inputDataNG    = true;
                        continue;
                    }
                }

                LineDetails_dgv.AutoGenerateColumns = false;
                isExcelUpload = true;
                LineDetails_dgv.Columns["colRemarks"].Visible = true;
                LineDetails_dgv.DataSource = excelUploadDt;

                if (inputDataNG)
                {
                    Save_btn.Enabled = false;
                }
                else
                {
                    Save_btn.Enabled = true;
                }

                this.CompleteProgress();
            }
        }
コード例 #23
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())
            {
                string nextPocessCode = string.Empty;

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

                else if (!sch.IsASCII(ProcessName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    ProcessName_txt.Focus();
                    return;
                }
                //if (NextProcessCode_txt.Text != null)
                //{
                //    nextPocessCode = NextProcessCode_txt.Text;
                //}

                ProcessVo inVo = new ProcessVo
                {
                    ProcessCode = ProcessCode_txt.Text.Trim(),
                    ProcessName = ProcessName_txt.Text.Trim(),
                    //NextPocessCode = nextPocessCode,
                    //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))
                {
                    ProcessVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

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

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

                        ProcessVo outVo = (ProcessVo)base.InvokeCbm(new UpdateProcessMasterMntCbm(), 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();
                }
            }
        }
コード例 #24
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionSpecificationVo inVo = new InspectionSpecificationVo();
            var sch = StringCheckHelper.GetInstance();

            if (!CheckMandatory())
            {
                return;
            }

            inVo.InspectionSpecificationText = InspectionSpecificationText_txt.Text.Trim();

            if (InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_DATETIME.GetValue()) && DateTime_pnl.Visible)
            {
                inVo.ValueFrom = DateFrom_dtp.Value.ToString();
                if (!string.IsNullOrEmpty(DateTo_dtp.Text.Trim()))
                {
                    inVo.ValueTo = DateTo_dtp.Value.ToString();
                }
            }
            else
            {
                inVo.ValueFrom = ValueFrom_txt.Text;
                if (!string.IsNullOrWhiteSpace(ValueTo_txt.Text.Trim()))
                {
                    inVo.ValueTo = ValueTo_txt.Text;
                }
            }

            inVo.Unit = Unit_txt.Text.Trim();

            if (Operator_cmb.SelectedIndex > -1)
            {
                inVo.OperatorFrom = Operator_cmb.SelectedValue.ToString();
            }
            if (!string.IsNullOrWhiteSpace(OperatorTo_txt.Text.Trim()))
            {
                inVo.OperatorTo = GlobalMasterDataTypeEnum.OPERATOR_LESSTHAN.GetValue();
            }

            //inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());

            inVo.InspectionItemId = InspectionItemId;

            inVo.SpecificationResultJudgeType = Convert.ToInt32(SpecificationResultJudgeType_cmb.SelectedValue.ToString());

            if (mode.Equals(CommonConstants.MODE_UPDATE))
            {
                inVo.InspectionSpecificationId = inspectionspecificationid;
            }

            inVo.Mode = mode;

            //InspectionSpecificationVo checkVo = DuplicateCheck(inVo);
            //if (checkVo != null && checkVo.AffectedCount > 0)
            //{
            //    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationCode_lbl.Text + " : " + InspectionSpecificationCode_txt.Text +
            //                                                        Environment.NewLine + " OR " + Environment.NewLine + InspectionItem_lbl.Text + " : " + InspectionItem_cmb.Text);
            //    logger.Info(messageData);
            //    popUpMessage.ConfirmationOkCancel(messageData, Text);

            //    return;
            //}


            if (string.Equals(mode, CommonConstants.MODE_ADD) || string.Equals(mode, CommonConstants.MODE_SELECT))
            {
                inVo.InspectionSpecificationCode = InspectionItemCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + GlobalMasterDataTypeEnum.SPECIFICATION_CODE.GetValue();

                UpdateResultVo outVo = null;
                try
                {
                    outVo = (UpdateResultVo)base.InvokeCbm(new AddInspectionSpecificationMasterMntCbm(), inVo, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                if (outVo == null)
                {
                    return;
                }
                IntSuccess = outVo.AffectedCount;
            }
            else if (mode.Equals(CommonConstants.MODE_UPDATE))
            {
                inVo.InspectionSpecificationCode = InspectionSpecificationCode;

                //InspectionSpecificationVo outVo = (InspectionSpecificationVo)base.InvokeCbm(new UpdateInspectionSpecificationMasterMntCbm(), inVo, false);


                string message = string.Format(Properties.Resources.mmci00037, "Inspection Specification", InspectionSpecificationText_txt.Text);
                StartProgress(message);

                ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                InspectionFormatVo            passformatVo = FormFormatVo(inVo.InspectionItemId);
                if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                {
                    return;
                }

                inVoList.add(passformatVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(inVo);
                inVoList.add(null);
                inVoList.add(null);

                InspectionReturnVo outVo = null;
                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    CompleteProgress();
                }
                if (outVo != null && outVo.AffectedCount > 0)
                {
                    IntSuccess       = outVo.AffectedCount;
                    InspectionItemId = outVo.InspectionItemId;
                }
            }
            if ((IntSuccess > 0))
            {
                messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                this.Close();
            }
        }
コード例 #25
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            LocationVo inVo = new LocationVo();

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

                if (!sch.IsASCII(LocationCode_txt.Text) || !sch.IsASCII(LocationName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (!sch.IsASCII(LocationCode_txt.Text))
                    {
                        LocationCode_txt.Focus();
                    }
                    else
                    {
                        LocationName_txt.Focus();
                    }

                    return;
                }

                //if(LocationCode_txt.Text.Trim().Length < 4)
                //{
                //    MessageData messageData = new MessageData("mmci00008", Properties.Resources.mmci00008, LocationCode_lbl.Text);
                //    popUpMessage.Warning(messageData, Text);
                //    LocationCode_txt.Focus();
                //    return;
                //}

                inVo.LocationCode = LocationCode_txt.Text.Trim();

                inVo.LocationName = LocationName_txt.Text.Trim();

                inVo.BuildingId = Convert.ToInt32(Building_cmb.SelectedValue);

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

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

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

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

                        LocationVo outVo = (LocationVo)base.InvokeCbm(new UpdateLocationMasterMntCbm(), 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();
                }
            }
        }
コード例 #26
0
ファイル: AddMoldNewForm.cs プロジェクト: D-Khoa/MyGit
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();

                var sch = StringCheckHelper.GetInstance();

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

                    return;
                }

                MoldVo inVo = new MoldVo();

                inVo.MoldCode   = MoldCode_txt.Text.Trim();
                inVo.MoldName   = MoldName_txt.Text.Trim();
                inVo.MoldTypeId = Convert.ToInt32(MoldType_cmb.SelectedValue);

                if (!string.IsNullOrEmpty(Weight_txt.Text))
                {
                    inVo.Weight = Convert.ToDecimal(Weight_txt.Text);
                }

                if (!string.IsNullOrEmpty(Height_txt.Text))
                {
                    inVo.Height = Convert.ToDecimal(Height_txt.Text);
                }

                if (!string.IsNullOrEmpty(Width_txt.Text))
                {
                    inVo.Width = Convert.ToDecimal(Width_txt.Text);
                }

                if (!string.IsNullOrEmpty(Depth_txt.Text))
                {
                    inVo.Depth = Convert.ToDecimal(Depth_txt.Text);
                }

                if (!string.IsNullOrWhiteSpace(ProductionDate_dtp.Text))
                {
                    inVo.ProductionDate = Convert.ToDateTime(ProductionDate_dtp.Value);
                }

                inVo.Comment = Comment_txt.Text;

                if (!string.IsNullOrEmpty(LifeShotCount_txt.Text))
                {
                    inVo.LifeShotCount = Convert.ToInt32(LifeShotCount_txt.Text);
                }

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

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

                        return;
                    }
                }

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

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

                        inVoList.add(GetSelectedProcessWork());

                        MoldVo outVo = (MoldVo)base.InvokeCbm(new AddMoldMasterMntNewCbm(), inVoList, false);

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

                        inVoList.add(inVo);

                        inVoList.add(GetSelectedProcessWork());

                        MoldVo outVo = (MoldVo)base.InvokeCbm(new UpdateMoldMasterMntNewCbm(), inVoList, false);

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


                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// upload excel and insert to DB
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExcelUpload_btn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDialog_dlg = new OpenFileDialog();

            openDialog_dlg.Filter = "Excel Files(*.xls) |*.xls";

            if (openDialog_dlg.ShowDialog() == DialogResult.OK)
            {
                this.StartProgress(Properties.Resources.mmci00009);

                try
                {
                    excelUploadDt = new ExcelUpload().ReadExcel(openDialog_dlg.FileName, Properties.Settings.Default.EXCEL_SHEET_DEFECTIVE_REASON);
                }
                catch (Framework.ApplicationException exception)
                {
                    this.CompleteProgress();
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                DefectiveReasonVo defectiveReasonInVo = new DefectiveReasonVo();

                ProcessDefectiveReasonVo processDefectiveReasonInVo = new ProcessDefectiveReasonVo();

                int displayOrder = 0;
                DefectiveReason_dgv.DataSource = null;
                excelUploadDt.Columns.Add("Remarks");
                var  sch         = StringCheckHelper.GetInstance();
                bool inputDataNG = false;


                foreach (DataRow row in excelUploadDt.Rows)
                {
                    if (row["DefectiveReasonCode"] == null || string.IsNullOrWhiteSpace(row["DefectiveReasonCode"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00011, DefectiveReasonCode_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    if (!sch.IsASCII(row["DefectiveReasonCode"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmci00017, DefectiveReasonCode_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    var duplicates = excelUploadDt.AsEnumerable().GroupBy(r => r["DefectiveReasonCode"]).Where(gr => gr.Count() > 1).ToList();

                    if (duplicates.Any() && duplicates.Select(dupl => dupl.Key).ToList().FirstOrDefault().ToString() == row["DefectiveReasonCode"].ToString())
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00009, DefectiveReasonCode_lbl.Text + " : " + row["DefectiveReasonCode"].ToString());
                        inputDataNG    = true;
                        continue;
                    }

                    if (row["DefectiveReasonName"] == null || string.IsNullOrWhiteSpace(row["DefectiveReasonName"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00011, DefectiveReasonName_lbl.Text);
                        inputDataNG    = true;
                        continue;
                    }

                    if (row["DisplayOrder"] == null || string.IsNullOrWhiteSpace(row["DisplayOrder"].ToString()))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00011, colDisplayOrder.HeaderText);
                        inputDataNG    = true;
                        continue;
                    }

                    if (!int.TryParse(row["DisplayOrder"].ToString(), out displayOrder) || displayOrder <= 0)
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmci00018, colDisplayOrder.HeaderText);
                        inputDataNG    = true;
                        continue;
                    }

                    var duplicateDisplayOrder = excelUploadDt.AsEnumerable().GroupBy(r => r["DisplayOrder"]).Where(gr => gr.Count() > 1).ToList();

                    if (duplicateDisplayOrder.Any() && duplicateDisplayOrder.Select(dupl => dupl.Key).ToList().FirstOrDefault().ToString() == row["DisplayOrder"].ToString())
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00009, colDisplayOrder.HeaderText + " : " + row["DisplayOrder"].ToString());
                        inputDataNG    = true;
                        continue;
                    }

                    defectiveReasonInVo        = new DefectiveReasonVo();
                    processDefectiveReasonInVo = new ProcessDefectiveReasonVo();

                    defectiveReasonInVo.DefectiveReasonCode = row["DefectiveReasonCode"].ToString();
                    defectiveReasonInVo.DefectiveReasonName = row["DefectiveReasonName"].ToString();
                    defectiveReasonInVo.DefectiveCategoryId = 0;
                    defectiveReasonInVo.DisplayOrder        = Convert.ToInt32(row["DisplayOrder"].ToString());
                    if (!ValidateProcessWorkCodeInExcel(excelUploadDt, defectiveReasonInVo.DefectiveReasonCode))
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmci00019);
                        inputDataNG    = true;
                        continue;
                    }


                    DefectiveReasonVo checkVo = DuplicateCheck(defectiveReasonInVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00012, DefectiveReasonCode_lbl.Text + " : " + defectiveReasonInVo.DefectiveReasonCode);
                        inputDataNG    = true;
                        continue;
                    }

                    DefectiveReasonVo checkDisplayVo = DuplicateDisplayCheck(defectiveReasonInVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        row["Remarks"] = string.Format(Properties.Resources.mmce00012, colDisplayOrder.HeaderText + " : " + defectiveReasonInVo.DisplayOrder.ToString());
                        inputDataNG    = true;
                        continue;
                    }
                }

                DefectiveReason_dgv.AutoGenerateColumns = false;
                isExcelUpload = true;
                DefectiveReason_dgv.Columns["colRemarks"].Visible = true;
                DefectiveReason_dgv.DataSource = excelUploadDt;

                if (inputDataNG)
                {
                    AddExcel_btn.Enabled = false;
                }
                else
                {
                    AddExcel_btn.Enabled = true;
                }

                this.CompleteProgress();
            }
        }
コード例 #28
0
ファイル: AddEquipmentForm.cs プロジェクト: D-Khoa/MyGit
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            string manufacturer = string.Empty;
            string modelCode    = string.Empty;
            string modelName    = string.Empty;
            var    sch          = StringCheckHelper.GetInstance();

            if (Manufacturer_txt.Text != null)
            {
                manufacturer = Manufacturer_txt.Text.Trim();
            }
            if (ModelCode_txt.Text != null)
            {
                modelCode = ModelCode_txt.Text.Trim();
            }
            if (ModelName_txt.Text != null)
            {
                modelName = ModelName_txt.Text.Trim();
            }

            EquipmentVo inVo = new EquipmentVo();

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

                    if (string.IsNullOrEmpty(EquipmentCode_txt.Text))
                    {
                        EquipmentCode_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(EquipmentName_txt.Text))
                    {
                        EquipmentName_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(AssetNo_txt.Text))
                    {
                        AssetNo_txt.Focus();
                    }
                    return;
                }
                inVo.EquipmentCode = EquipmentCode_txt.Text.Trim();

                inVo.EquipmentName = EquipmentName_txt.Text.Trim();

                inVo.InstrationDate = InstrationDate_dtp.Value;

                inVo.AssetNo = AssetNo_txt.Text.Trim();

                inVo.Manufacturer = manufacturer;

                inVo.ModelCode = modelCode;

                inVo.ModelName = modelName;

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

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

                        return;
                    }
                }

                if (mode.Equals(CommonConstants.MODE_UPDATE))
                {
                    inVo.EquipmentId = updateData.EquipmentId;
                }

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

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

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