Пример #1
0
        private void BindUpdateCavityData()
        {
            int selectedrowindex = AccountLocationDetails_dgv.SelectedCells[0].RowIndex;

            AccountLocationVo vo = (AccountLocationVo)AccountLocationDetails_dgv.Rows[selectedrowindex].DataBoundItem;

            Form.Account_WhForm.AccountLocationForm.AddAccountLocationForm addform = new Form.Account_WhForm.AccountLocationForm.AddAccountLocationForm();
            addform.vo = vo;
            addform.ShowDialog();
            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();
            }
        }
Пример #2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AccountLocationVo inVo = (AccountLocationVo)vo;
            StringBuilder     sql  = new StringBuilder();

            sql.Append("insert into m_account_location(account_location_cd, account_location_name, account_location_type, registration_user_cd, registration_date_time, factory_cd) ");
            sql.Append("values(:account_location_cd,:account_location_name,:account_location_type,  :registration_user_cd,now(),:factory_cd)");

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

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

            sqlParameter.AddParameterString("account_location_cd", inVo.AccountLocationCode);
            sqlParameter.AddParameterString("account_location_name", inVo.AccountLocationName);
            sqlParameter.AddParameterString("account_location_type", inVo.AccountLocationType);
            // sqlParameter.AddParameterDateTime("registration_user_cd", inVo.RegistrationDateTime);
            sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode);
            //execute SQL

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

            return(outVo);
        }
Пример #3
0
        private void GridBind()
        {
            AccountLocationDetails_dgv.DataSource = null;
            try
            {
                AccountLocationVo vo = new AccountLocationVo
                {
                    AccountLocationCode = AccountLocationCode_txt.Text,
                    AccountLocationName = AccountLocationName_txt.Text
                };

                ValueObjectList <AccountLocationVo> volist = (ValueObjectList <AccountLocationVo>)DefaultCbmInvoker.Invoke(new GetAccountLocationCbm(), vo);
                if (volist.GetList() != null && volist.GetList().Count > 0)
                {
                    AccountLocationDetails_dgv.AutoGenerateColumns = false;
                    BindingSource bindingsource = new BindingSource(volist.GetList(), null);
                    AccountLocationDetails_dgv.DataSource = bindingsource;
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
                AccountLocationDetails_dgv.ClearSelection();
                Update_btn.Enabled = false;
                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
Пример #4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AccountLocationVo inVo = (AccountLocationVo)vo;
            StringBuilder     sql  = new StringBuilder();
            ValueObjectList <AccountLocationVo> voList = new ValueObjectList <AccountLocationVo>();
            DbCommandAdaptor sqlCommandAdapter         = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter = sqlCommandAdapter.CreateParameterList();

            sql.Append("select account_location_id, account_location_cd, account_location_name, account_location_type, registration_user_cd,registration_date_time,factory_cd from  m_account_location");
            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.AccountLocationId > 0)
            {
                sql.Append(" and account_location_id = :account_location_id ");
                sqlParameter.AddParameterInteger("account_location_id", inVo.AccountLocationId);
            }
            if (!string.IsNullOrEmpty(inVo.AccountLocationCode))
            {
                sql.Append(" and account_location_cd = :account_location_cd ");
                sqlParameter.AddParameterString("account_location_cd", inVo.AccountLocationCode);
            }
            if (!string.IsNullOrEmpty(inVo.AccountLocationName))
            {
                sql.Append(" and account_location_name = :account_location_name ");
                sqlParameter.AddParameterString("account_location_name", inVo.AccountLocationName);
            }


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

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

            while (dataReader.Read())
            {
                AccountLocationVo outVo = new AccountLocationVo
                {
                    AccountLocationId    = int.Parse(dataReader["account_location_id"].ToString()),
                    AccountLocationCode  = dataReader["account_location_cd"].ToString(),
                    AccountLocationName  = dataReader["account_location_name"].ToString(),
                    AccountLocationType  = dataReader["account_location_type"].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
 public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
 {
     try
     {
         //VARIABLE
         StringBuilder     query = new StringBuilder();
         AccountLocationVo inVo  = (AccountLocationVo)vo;
         ValueObjectList <AccountLocationVo> listVo = new ValueObjectList <AccountLocationVo>();
         //CREATE SQL ADAPTER AND PARAMETER LIST
         DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, query.ToString());
         DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();
         //QUERY STRING
         query.Append("Select * from m_account_location where 1=1 ");
         if (inVo.account_location_id > 0)
         {
             query.Append("and account_location_id='").Append(inVo.account_location_id).Append("' ");
         }
         if (string.IsNullOrEmpty(inVo.account_location_cd))
         {
             query.Append("and account_location_cd='").Append(inVo.account_location_cd).Append("' ");
         }
         if (string.IsNullOrEmpty(inVo.account_location_type))
         {
             query.Append("and account_location_type='").Append(inVo.account_location_type).Append("' ");
         }
         query.Append("order by account_location_id");
         //GET SQL ADAPTER
         sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, query.ToString());
         //EXECUTE READER FROM COMMAND
         IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);
         while (datareader.Read())
         {
             AccountLocationVo outVo = new AccountLocationVo
             {
                 account_location_id    = (int)datareader["account_location_id"],
                 account_location_cd    = datareader["account_location_cd"].ToString(),
                 account_location_name  = datareader["account_location_name"].ToString(),
                 account_location_type  = datareader["account_location_type"].ToString(),
                 registration_user_cd   = datareader["registration_user_cd"].ToString(),
                 registration_date_time = (DateTime)datareader["registration_date_time"],
                 factory_cd             = datareader["factory_cd"].ToString()
             };
             listVo.add(outVo);
         }
         //CLEAR AND CLOSE CONNECTION
         query.Clear();
         datareader.Close();
         base.CloseConnection(trxContext);
         return(listVo);
     }
     catch
     {
         throw new NotImplementedException();
     }
 }
Пример #6
0
        private bool checkdate()
        {
            if (AccountLocationCode_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, AccountLocationCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                AccountLocationCode_txt.Focus();
                return(false);
            }
            if (AccountLocationName_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, AccountLocationName_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                AccountLocationName_txt.Focus();
                return(false);
            }
            if (AccountLocationType_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, AccountLocationType_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                AccountLocationType_txt.Focus();
                return(false);
            }
            AccountLocationCode_txt.Text = AccountLocationCode_txt.Text.Trim();
            AccountLocationName_txt.Text = AccountLocationName_txt.Text.Trim();
            AccountLocationVo outVo = new AccountLocationVo(),
                              inVo  = new AccountLocationVo {
                AccountLocationId = vo.AccountLocationId, AccountLocationCode = AccountLocationCode_txt.Text
            };

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

            sql.Append("delete from  m_account_location Where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (inVo.AccountLocationId > 0)
            {
                sql.Append(" and account_location_id = :account_location_id ");
                sqlParameter.AddParameterInteger("account_location_id", inVo.AccountLocationId);
            }
            if (!string.IsNullOrEmpty(inVo.AccountLocationCode))
            {
                sql.Append(" and account_location_cd = :account_location_cd ");
                sqlParameter.AddParameterString("account_location_cd", inVo.AccountLocationCode);
            }
            if (!string.IsNullOrEmpty(inVo.AccountLocationName))
            {
                sql.Append(" and account_location_name = :account_location_name ");
                sqlParameter.AddParameterString("account_location_name", inVo.AccountLocationName);
            }



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


            //execute SQL

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

            return(outVo);
        }
Пример #8
0
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            if (AccountLocationDetails_dgv.SelectedRows.Count > 0)
            {
                int selectedrowindex = AccountLocationDetails_dgv.SelectedCells[0].RowIndex;

                AccountLocationVo vo = (AccountLocationVo)AccountLocationDetails_dgv.Rows[selectedrowindex].DataBoundItem;

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

                if (dialogResult == DialogResult.OK)
                {
                    try
                    {
                        AccountLocationVo outVo = (AccountLocationVo)DefaultCbmInvoker.Invoke(new DeleteAccountLocationCbm(), 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());
                    }
                }
            }
        }
Пример #9
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AccountLocationVo inVo = (AccountLocationVo)vo;
            StringBuilder     sql  = new StringBuilder();
            DbCommandAdaptor  sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList   sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("Select Count(*) as AccountLocationCount ");
            sql.Append(" from  m_account_location");
            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.AccountLocationCode))
            {
                sql.Append(" and UPPER(account_location_cd) = UPPER(:account_location_cd) ");
                sqlParameter.AddParameterString("account_location_cd", inVo.AccountLocationCode);
            }
            if (inVo.AccountLocationId > 0)
            {
                sql.Append(" and account_location_id != :account_location_id "); ///?????
                sqlParameter.AddParameterInteger("account_location_id", inVo.AccountLocationId);
            }


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

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

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["AccountLocationCount"].ToString());
            }
            dataReader.Close();
            return(outVo);
        }
Пример #10
0
 private void Ok_btn_Click(object sender, EventArgs e)
 {
     if (checkdate())
     {
         AccountLocationVo outvo = new AccountLocationVo();
         AccountLocationVo invo  = new AccountLocationVo
         {
             AccountLocationId    = vo.AccountLocationId,
             AccountLocationCode  = AccountLocationCode_txt.Text,
             AccountLocationName  = AccountLocationName_txt.Text,
             AccountLocationType  = AccountLocationType_txt.Text,
             FactoryCode          = UserData.GetUserData().FactoryCode,
             RegistrationUserCode = UserData.GetUserData().UserCode
         };
         try
         {
             if (invo.AccountLocationId > 0)
             {
                 outvo = (AccountLocationVo)DefaultCbmInvoker.Invoke(new UpdateAccountLocationCbm(), invo);
             }
             else
             {
                 outvo = (AccountLocationVo)DefaultCbmInvoker.Invoke(new AddAccountLocationCbm(), invo);
             }
         }
         catch (Framework.ApplicationException exception)
         {
             popUpMessage.ApplicationError(exception.GetMessageData(), Text);
             logger.Error(exception.GetMessageData());
             return;
         }
         if ((IntSuccess > 0) || (IntSuccess == 0))
         {
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
 }
Пример #11
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AccountLocationVo inVo = (AccountLocationVo)vo;
            ValueObjectList <AccountLocationVo> voList = new ValueObjectList <AccountLocationVo>();
            StringBuilder sql = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("select account_location_id,account_location_cd,account_location_name from m_account_location where 1=1 ");
            if (!string.IsNullOrEmpty(inVo.account_location_cd))
            {
                sql.Append("and account_location_cd='").Append(inVo.account_location_cd).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.account_location_name))
            {
                sql.Append("and account_location_name='").Append(inVo.account_location_name).Append("' ");
            }
            sql.Append("order by account_location_id");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (datareader.Read())
            {
                AccountLocationVo outVo = new AccountLocationVo
                {
                    account_location_id   = (int)datareader["account_location_id"],
                    account_location_cd   = datareader["account_location_cd"].ToString(),
                    account_location_name = datareader["account_location_name"].ToString()
                };
                voList.add(outVo);
            }
            datareader.Close();
            return(voList);
        }