コード例 #1
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            GroupMachineVo   inVo = (GroupMachineVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("delete from m_group_machine 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.GroupMachineName))
            {
                sql.Append(" and group_machine_name = :group_machine_name ");
                sqlParameter.AddParameterString("group_machine_name", inVo.GroupMachineName);
            }



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


            //execute SQL

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

            return(outVo);
        }
コード例 #2
0
        /// <summary>
        /// selects user record for updation and show user form
        /// </summary>
        private void BindUpdateCavityData()
        {
            int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex;

            GroupMachineVo vo = (GroupMachineVo)Machine_dgv.Rows[selectedrowindex].DataBoundItem;

            AddGroupMachineForm addform = new AddGroupMachineForm();

            addform.vo = vo;

            if (addform.IntSuccess > 0)
            {
                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();
            }
        }
コード例 #3
0
ファイル: UpdateCustomerLineDao.cs プロジェクト: D-Khoa/MyGit
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            GroupMachineVo inVo = (GroupMachineVo)vo;
            StringBuilder  sql  = new StringBuilder();

            sql.Append("update m_group_machine set group_machine_cd=:group_machine_cd,group_machine_name=:group_machine_name,machine_id=:machine_id");
            sql.Append(" where group_machine_id =:group_machine_id");

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

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

            sqlParameter.AddParameterString("group_machine_cd", inVo.GroupMachineCode);
            sqlParameter.AddParameterString("group_machine_name", inVo.GroupMachineName);
            sqlParameter.AddParameterInteger("group_machine_id", inVo.GroupMachineId);
            sqlParameter.AddParameterInteger("machine_id", inVo.MachineId);

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

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

            return(outVo);
        }
コード例 #4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            GroupMachineVo inVo = (GroupMachineVo)vo;
            StringBuilder  sql  = new StringBuilder();
            ValueObjectList <GroupMachineVo> voList = new ValueObjectList <GroupMachineVo>();
            DbCommandAdaptor sqlCommandAdapter      = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter           = sqlCommandAdapter.CreateParameterList();

            sql.Append(@"select a.group_machine_cd, a.group_machine_name, b.machine_name,
a.registration_user_cd,a.registration_date_time,a.factory_cd from m_group_machine a
left join m_machine b on b.machine_id = a.machine_id");
            sql.Append(" Where 1=1");

            if (!String.IsNullOrEmpty(inVo.GroupMachineCode))
            {
                sql.Append(" and group_machine_cd = :group_machine_cd ");
                sqlParameter.AddParameterString("group_machine_cd", inVo.GroupMachineCode);
            }

            if (!String.IsNullOrEmpty(inVo.GroupMachineName))
            {
                sql.Append(" and group_machine_name = :group_machine_name ");
                sqlParameter.AddParameterString("group_machine_name", inVo.GroupMachineName);
            }

            if (!String.IsNullOrEmpty(inVo.MachineName))
            {
                sql.Append(" and machine_name = :machine_name ");
                sqlParameter.AddParameterString("machine_name", inVo.MachineName);
            }


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

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

            while (dataReader.Read())
            {
                GroupMachineVo outVo = new GroupMachineVo
                {
                    // GroupMachineCode = dataReader["group_machine_cd"].ToString(),
                    GroupMachineName = dataReader["group_machine_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 (Machine_dgv.SelectedRows.Count > 0)
            {
                int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex;

                GroupMachineVo vo = (GroupMachineVo)Machine_dgv.Rows[selectedrowindex].DataBoundItem;

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


                if (dialogResult == DialogResult.OK)
                {
                    try
                    {
                        GroupMachineVo outVo = (GroupMachineVo)DefaultCbmInvoker.Invoke(new DeleteGroupMachineCbm(), 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());
                    }
                }
            }
        }
コード例 #6
0
        private bool CheckDate()
        {
            if (GroupMachineCode_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, GroupMachineCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                GroupMachineCode_txt.Focus();
                return(false);
            }
            if (GroupMachineName_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, GroupMachineName_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                GroupMachineName_txt.Focus();
                return(false);
            }
            GroupMachineCode_txt.Text = GroupMachineCode_txt.Text.Trim();
            GroupMachineName_txt.Text = GroupMachineName_txt.Text.Trim();
            GroupMachineVo outVo = new GroupMachineVo(),
                           inVo  = new GroupMachineVo {
                GroupMachineId = vo.GroupMachineId, GroupMachineCode = GroupMachineCode_txt.Text
            };

            try
            {
                outVo = (GroupMachineVo)DefaultCbmInvoker.Invoke(new CheckGroupMachineCbm(), inVo);
                if (outVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, GroupMachineCode_lbl.Text);
                    popUpMessage.Warning(messageData, Text);
                    GroupMachineCode_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)
        {
            GroupMachineVo   inVo = (GroupMachineVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("Select Count(*) as GroupMachineCount ");
            sql.Append(" from m_group_machine");
            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.GroupMachineCode))
            {
                sql.Append(" and UPPER(group_machine_cd) = UPPER(:group_machine_cd) ");
                sqlParameter.AddParameterString("group_machine_cd", inVo.GroupMachineCode);
            }
            if (inVo.GroupMachineId > 0)
            {
                sql.Append(" and group_machine_id != :group_machine_id ");
                sqlParameter.AddParameterInteger("group_machine_id", inVo.GroupMachineId);
            }


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

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

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["GroupMachineCount"].ToString());
            }
            dataReader.Close();
            return(outVo);
        }
コード例 #8
0
 private void Ok_btn_Click(object sender, EventArgs e)
 {
     if (CheckDate())
     {
         GroupMachineVo outVo = new GroupMachineVo();
         GroupMachineVo inVo  = new GroupMachineVo
         {
             GroupMachineId       = vo.GroupMachineId,
             GroupMachineCode     = GroupMachineCode_txt.Text,
             GroupMachineName     = GroupMachineName_txt.Text,
             FactoryCode          = UserData.GetUserData().FactoryCode,
             RegistrationUserCode = UserData.GetUserData().UserCode
         };
         try
         {
             if (inVo.GroupMachineId > 0)
             {
                 outVo = (GroupMachineVo)DefaultCbmInvoker.Invoke(new UpdateGroupMachineCbm(), inVo);
             }
             else
             {
                 outVo = (GroupMachineVo)DefaultCbmInvoker.Invoke(new AddGroupMachineCbm(), inVo);
             }
         }
         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();
         }
     }
 }