public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            ValueObjectList <AssetMasterFAWHVo> voList = new ValueObjectList <AssetMasterFAWHVo>();
            StringBuilder sql = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("select distinct asset_type from m_asset order by asset_type");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (datareader.Read())
            {
                AssetMasterFAWHVo outVo = new AssetMasterFAWHVo
                {
                    asset_type = datareader["asset_type"].ToString(),
                };
                voList.add(outVo);
            }
            datareader.Close();
            return(voList);
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetMasterFAWHVo inVo = (AssetMasterFAWHVo)vo;
            StringBuilder     sql  = new StringBuilder();
            DataTable         dt   = new DataTable();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("SELECT asset_id, asset_cd, asset_no, asset_name, asset_serial, asset_model, asset_life, acquistion_cost, acquistion_date, asset_invoice, asset_po, asset_type, factory_cd, asset_supplier, label_status from m_asset where 1=1 ");
            if (!string.IsNullOrEmpty(inVo.asset_cd))
            {
                sql.Append("and asset_cd like '").Append(inVo.asset_cd).Append("%' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_no.ToString()))
            {
                sql.Append("and asset_no = '").Append(inVo.asset_cd.ToString()).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_name))
            {
                sql.Append("and asset_name like '").Append(inVo.asset_name).Append("%' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_type))
            {
                sql.Append("and asset_type like '").Append(inVo.asset_type).Append("%' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_life))
            {
                sql.Append("and asset_life like '").Append(inVo.asset_life).Append("%' ");
            }
            if (inVo.checkDateFrom)
            {
                sql.Append("and acquistion_date > '").Append(inVo.dateFrom.ToString("yyyy-MM-dd")).Append("' ");
            }
            if (inVo.checkDateTo)
            {
                sql.Append("and acquistion_date < '").Append(inVo.dateTo.ToString("yyyy-MM-dd")).Append("' ");
            }
            if (inVo.label_status.Length > 3)
            {
                sql.Append("and label_status in (").Append(inVo.label_status).Append(") ");
            }
            sql.Append("order by asset_cd");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            dt.Load(datareader);
            datareader.Close();
            AssetMasterFAWHVo outVo = new AssetMasterFAWHVo
            {
                asset_data = dt
            };

            return(outVo);
        }
Beispiel #3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoFAWHVo inVo = (AssetInfoFAWHVo)vo;
            StringBuilder   sql  = new StringBuilder();

            sql.Append(@"INSERT INTO m_asset(
            asset_no, asset_cd, asset_name, asset_model, asset_serial, asset_supplier, asset_invoice, asset_life, acquistion_date,
            acquistion_cost, asset_type, registration_user_cd, registration_date_time, factory_cd, label_status, asset_po)
            VALUES(:asset_no, :asset_cd, :asset_name, :asset_model, :asset_serial, :asset_supplier, 
            :asset_invoice, :asset_life, :acquistion_date, :acquistion_cost, :asset_type, :registration_user_cd, 
            :registration_date_time, :factory_cd, :label_status, :asset_po)");

            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("asset_no", inVo.asset_no);
            sqlParameter.AddParameterString("asset_cd", inVo.asset_cd);
            sqlParameter.AddParameterString("asset_name", inVo.asset_name);
            sqlParameter.AddParameterString("asset_model", inVo.asset_model);
            sqlParameter.AddParameterString("asset_serial", inVo.asset_serial);
            sqlParameter.AddParameterString("asset_supplier", inVo.asset_supplier);
            sqlParameter.AddParameterString("asset_invoice", inVo.asset_invoice);
            sqlParameter.AddParameter("asset_life", inVo.asset_life);
            sqlParameter.AddParameterDateTime("acquistion_date", inVo.acquistion_date);
            sqlParameter.AddParameter("acquistion_cost", inVo.acquistion_cost);
            sqlParameter.AddParameterString("asset_type", inVo.asset_type);
            sqlParameter.AddParameterString("registration_user_cd", UserData.GetUserData().UserCode);
            sqlParameter.AddParameterDateTime("registration_date_time", DateTime.Now);
            sqlParameter.AddParameterString("factory_cd", UserData.GetUserData().FactoryCode);
            sqlParameter.AddParameterString("label_status", inVo.label_status);
            sqlParameter.AddParameterString("asset_po", inVo.asset_po);
            sql.Clear();

            //EXECUTE READER FROM COMMAND
            AssetMasterFAWHVo outVo = new AssetMasterFAWHVo
            {
                executeInt = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Beispiel #4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoFAWHVo inVo = (AssetInfoFAWHVo)vo;
            StringBuilder   sql  = new StringBuilder();

            sql.Append("update m_asset set asset_cd=:asset_cd,asset_no=:asset_no,asset_name=:asset_name, asset_model=:asset_model, asset_invoice =:asset_invoice,  asset_serial =:asset_serial, asset_supplier=:asset_supplier,asset_life =:asset_life, acquistion_date=:acquistion_date, acquistion_cost=:acquistion_cost, asset_type=:asset_type, label_status=:label_status, asset_po = :asset_po");
            sql.Append(" where asset_cd =:asset_cd and asset_no = :asset_no");

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

            sql.Clear();

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

            sqlParameter.AddParameterInteger("asset_no", inVo.asset_no);
            sqlParameter.AddParameterString("asset_cd", inVo.asset_cd);
            sqlParameter.AddParameterString("asset_name", inVo.asset_name);
            sqlParameter.AddParameterString("asset_model", inVo.asset_model);
            sqlParameter.AddParameterString("asset_serial", inVo.asset_serial);
            sqlParameter.AddParameterString("asset_supplier", inVo.asset_supplier);
            sqlParameter.AddParameterString("asset_invoice", inVo.asset_invoice);
            sqlParameter.AddParameter("asset_life", inVo.asset_life);
            sqlParameter.AddParameterDateTime("acquistion_date", inVo.acquistion_date);
            sqlParameter.AddParameter("acquistion_cost", inVo.acquistion_cost);
            sqlParameter.AddParameterString("asset_type", inVo.asset_type);
            sqlParameter.AddParameterString("factory_cd", inVo.factory_cd);
            sqlParameter.AddParameterString("registration_user_cd", UserData.GetUserData().UserCode);
            sqlParameter.AddParameterString("label_status", inVo.label_status);
            sqlParameter.AddParameterString("asset_po", inVo.asset_po);

            //execute SQL
            AssetMasterFAWHVo outVo = new AssetMasterFAWHVo()
            {
                executeInt = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Beispiel #5
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetMasterFAWHVo inVo = (AssetMasterFAWHVo)vo;
            StringBuilder     sql  = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("DELETE from m_asset where 1=1 ");
            if (!string.IsNullOrEmpty(inVo.asset_cd))
            {
                sql.Append("and asset_cd = '").Append(inVo.asset_cd).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_name))
            {
                sql.Append("and asset_name = '").Append(inVo.asset_name).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_type))
            {
                sql.Append("and asset_type = '").Append(inVo.asset_type).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_life))
            {
                sql.Append("and asset_life = '").Append(inVo.asset_life).Append("' ");
            }
            //if (inVo.checkDateFrom)
            //    sql.Append("and acquistion_date > '").Append(inVo.dateFrom.ToString("yyyy-MM-dd")).Append("' ");
            //if (inVo.checkDateTo)
            //    sql.Append("and acquistion_date < '").Append(inVo.dateTo.ToString("yyyy-MM-dd")).Append("' ");
            //sql.Append("order by asset_cd");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            int datareader = sqlCommandAdapter.ExecuteNonQuery(sqlParameter);

            return(inVo);
        }