Пример #1
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigResponseVo inVo = (JigResponseVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append("insert into public.m_jig_response(jig_response_cd, jig_response_name, registration_user_cd, registration_date_time, factory_cd) ");
            sql.Append("values(:jig_response_cd,:jig_response_name, :registration_user_cd,now(),:factory_cd)");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("jig_response_cd", inVo.JigResponseCode);
            sqlParameter.AddParameterString("jig_response_name", inVo.JigResponseName);

            sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode);
            //execute SQL

            JigResponseVo outVo = new JigResponseVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Пример #2
0
        /// <summary>
        /// selects user record for updation and show user form
        /// </summary>
        private void BindUpdateCavityData()
        {
            int selectedrowindex = JigResponse_dgv.SelectedCells[0].RowIndex;

            JigResponseVo vo = (JigResponseVo)JigResponse_dgv.Rows[selectedrowindex].DataBoundItem;

            AddJigResponseMasterForm addform = new AddJigResponseMasterForm();

            addform.vo = vo;

            if (addform.ShowDialog() == DialogResult.OK)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);

                GridBind();
            }
            else if (addform.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind();
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigResponseVo inVo = (JigResponseVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append("update public.m_jig_response set jig_response_cd=:jig_response_cd,jig_response_name=:jig_response_name");
            sql.Append(" where jig_response_id =:jig_response_id");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("jig_response_cd", inVo.JigResponseCode);
            sqlParameter.AddParameterString("jig_response_name", inVo.JigResponseName);
            sqlParameter.AddParameterInteger("jig_response_id", inVo.JigResponseId);


            sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode);
            //execute SQL

            JigResponseVo outVo = new JigResponseVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Пример #4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigResponseVo inVo = (JigResponseVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <JigResponseVo> voList = new ValueObjectList <JigResponseVo>();
            DbCommandAdaptor sqlCommandAdapter     = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter          = sqlCommandAdapter.CreateParameterList();

            sql.Append("select jig_response_id,jig_response_cd,jig_response_name, registration_user_cd,registration_date_time,factory_cd from m_jig_response");
            sql.Append(" Where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (inVo.JigResponseId > 0)
            {
                sql.Append(" and jig_response_id = :jig_response_id ");
                sqlParameter.AddParameterInteger("jig_response_id", inVo.JigResponseId);
            }
            if (!string.IsNullOrEmpty(inVo.JigResponseCode))
            {
                sql.Append(" and jig_response_cd = :jig_response_cd ");
                sqlParameter.AddParameterString("jig_response_cd", inVo.JigResponseCode);
            }
            if (!string.IsNullOrEmpty(inVo.JigResponseName))
            {
                sql.Append(" and jig_response_name = :jig_response_name ");
                sqlParameter.AddParameterString("jig_response_name", inVo.JigResponseName);
            }


            //create command
            //DbCommandAdaptor
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                JigResponseVo outVo = new JigResponseVo
                {
                    JigResponseCode = dataReader["jig_response_cd"].ToString(),
                    JigResponseId   = int.Parse(dataReader["jig_response_id"].ToString()),
                    JigResponseName = dataReader["jig_response_name"].ToString(),

                    RegistrationUserCode = dataReader["registration_user_cd"].ToString(),
                    RegistrationDateTime = DateTime.Parse(dataReader["registration_date_time"].ToString()),
                    FactoryCode          = dataReader["factory_cd"].ToString()
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
Пример #5
0
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            if (JigResponse_dgv.SelectedRows.Count > 0)
            {
                int selectedrowindex = JigResponse_dgv.SelectedCells[0].RowIndex;

                JigResponseVo vo = (JigResponseVo)JigResponse_dgv.Rows[selectedrowindex].DataBoundItem;

                messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, vo.JigResponseCode);
                logger.Info(messageData);
                DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);


                if (dialogResult == DialogResult.OK)
                {
                    try
                    {
                        JigResponseVo outVo = (JigResponseVo)DefaultCbmInvoker.Invoke(new DeleteJigResponseCbm(), vo);

                        if (outVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);

                            GridBind();
                        }
                        else if (outVo.AffectedCount == 0)
                        {
                            messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                            GridBind();
                        }
                    }
                    catch (Com.Nidec.Mes.Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                    }
                }
            }
        }
        private bool CheckDate()
        {
            if (JigResponseCode_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, JigResponseCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                JigResponseCode_txt.Focus();
                return(false);
            }
            if (JigResponseName_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, JigResponseName_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                JigResponseName_txt.Focus();
                return(false);
            }
            JigResponseCode_txt.Text = JigResponseCode_txt.Text.Trim();
            JigResponseName_txt.Text = JigResponseName_txt.Text.Trim();
            JigResponseVo outVo = new JigResponseVo(),
                          inVo  = new JigResponseVo {
                JigResponseId = vo.JigResponseId, JigResponseCode = JigResponseCode_txt.Text
            };

            try
            {
                outVo = (JigResponseVo)DefaultCbmInvoker.Invoke(new CheckJigResponseCbm(), inVo);
                if (outVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, JigResponseCode_lbl.Text);
                    popUpMessage.Warning(messageData, Text);
                    JigResponseCode_txt.Focus();
                    return(false);
                }
            }
            catch (Com.Nidec.Mes.Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
                return(false);
            }
            return(true);
        }
Пример #7
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigResponseVo    inVo = (JigResponseVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("delete from public.m_ncvp_jig_response Where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (inVo.JigResponseId > 0)
            {
                sql.Append(" and jig_response_id = :jig_response_id ");
                sqlParameter.AddParameterInteger("jig_response_id", inVo.JigResponseId);
            }
            if (!string.IsNullOrEmpty(inVo.JigResponseCode))
            {
                sql.Append(" and jig_response_cd = :jig_response_cd ");
                sqlParameter.AddParameterString("jig_response_cd", inVo.JigResponseCode);
            }
            if (!string.IsNullOrEmpty(inVo.JigResponseName))
            {
                sql.Append(" and jig_response_name = :jig_response_name ");
                sqlParameter.AddParameterString("jig_response_name", inVo.JigResponseName);
            }

            //create command
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL

            JigResponseVo outVo = new JigResponseVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Пример #8
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            JigResponseVo    inVo = (JigResponseVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("Select Count(*) as JigResponseCount ");
            sql.Append(" from  public.m_jig_response");
            sql.Append(" Where 1=1 ");

            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (!string.IsNullOrEmpty(inVo.JigResponseCode))
            {
                sql.Append(" and UPPER(jig_response_cd) = UPPER(:jig_response_cd) ");
                sqlParameter.AddParameterString("jig_response_cd", inVo.JigResponseCode);
            }
            if (inVo.JigResponseId > 0)
            {
                sql.Append(" and jig_response_id != :jig_response_id "); ///?????
                sqlParameter.AddParameterInteger("jig_response_id", inVo.JigResponseId);
            }


            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader   dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);
            JigResponseVo outVo      = new JigResponseVo();

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["JigResponseCount"].ToString());
            }
            dataReader.Close();
            return(outVo);
        }
 private void Ok_btn_Click(object sender, EventArgs e)
 {
     if (CheckDate())
     {
         JigResponseVo outVo = new JigResponseVo();
         JigResponseVo inVo  = new JigResponseVo
         {
             JigResponseId        = vo.JigResponseId,
             JigResponseCode      = JigResponseCode_txt.Text,
             JigResponseName      = JigResponseName_txt.Text,
             FactoryCode          = UserData.GetUserData().FactoryCode,
             RegistrationUserCode = UserData.GetUserData().UserCode
         };
         try
         {
             if (inVo.JigResponseId > 0)
             {
                 outVo = (JigResponseVo)DefaultCbmInvoker.Invoke(new UpdateJigResponseCbm(), inVo);
             }
             else
             {
                 outVo = (JigResponseVo)DefaultCbmInvoker.Invoke(new AddJigResponseCbm(), inVo);
             }
             IntSuccess = outVo.AffectedCount;
         }
         catch (Com.Nidec.Mes.Framework.ApplicationException exception)
         {
             popUpMessage.ApplicationError(exception.GetMessageData(), Text);
             logger.Error(exception.GetMessageData());
             return;
         }
         if ((IntSuccess > 0) || (IntSuccess == 0))
         {
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
 }