Example #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                AssetInfoFAWHVo outAsset = (AssetInfoFAWHVo)DefaultCbmInvoker.Invoke(new GetAssetInfoFAWHCbm(), new AssetInfoFAWHVo
                {
                    asset_cd = txtAssetCode.Text,
                    asset_no = int.Parse(txtAssetNo.Text)
                });
                AccountInfoFAWHVo outVo = new AccountInfoFAWHVo
                {
                    account_main_id     = accountVo.account_main_id,
                    asset_id            = outAsset.asset_id,
                    qty                 = int.Parse(txtQty.Text),
                    unit_id             = int.Parse(cmbUnit.ValueMember),
                    account_code_id     = int.Parse(cmbAccountCode.ValueMember),
                    account_location_id = int.Parse(cmbSection.ValueMember),
                    rank_id             = int.Parse(cmbRank.ValueMember),
                    comment_data        = txtComment.Text,
                    depreciation_start  = dtpDeprStart.Value,
                    depreciation_end    = dtpDeprEnd.Value,

                    location_id      = int.Parse(cmbLocation.ValueMember),
                    user_location_id = user_location_id,
                };
                outVo = (AccountInfoFAWHVo)DefaultCbmInvoker.Invoke(new UpdateAccountInfoFAWHCbm(), outVo);
                MessageBox.Show("Update finish!!!", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "WARRING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoFAWHVo inVo = (AssetInfoFAWHVo)vo;
            ValueObjectList <AssetInfoFAWHVo> voList = new ValueObjectList <AssetInfoFAWHVo>();
            StringBuilder sql = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("select * from m_asset where 1=1 ");
            if (inVo.asset_id > 0)
            {
                sql.Append("and asset_id='").Append(inVo.asset_id).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.asset_cd))
            {
                sql.Append("and asset_cd='").Append(inVo.asset_cd).Append("' ");
            }
            if (inVo.asset_no > 0)
            {
                sql.Append("and asset_no='").Append(inVo.asset_no).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.label_status))
            {
                sql.Append("and label_status='").Append(inVo.label_status).Append("' ");
            }
            sql.Append("order by asset_id");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (datareader.Read())
            {
                AssetInfoFAWHVo outVo = new AssetInfoFAWHVo
                {
                    asset_id               = (int)datareader["asset_id"],
                    asset_cd               = datareader["asset_cd"].ToString(),
                    asset_no               = (int)datareader["asset_no"],
                    asset_name             = datareader["asset_name"].ToString(),
                    asset_model            = datareader["asset_model"].ToString(),
                    asset_serial           = datareader["asset_serial"].ToString(),
                    acquistion_cost        = (double)datareader["acquistion_cost"],
                    acquistion_date        = (DateTime)datareader["acquistion_date"],
                    asset_life             = (double)datareader["asset_life"],
                    asset_type             = datareader["asset_type"].ToString(),
                    asset_invoice          = datareader["asset_invoice"].ToString(),
                    asset_supplier         = datareader["asset_supplier"].ToString(),
                    factory_cd             = datareader["factory_cd"].ToString(),
                    label_status           = datareader["label_status"].ToString(),
                    asset_po               = datareader["asset_po"].ToString(),
                    registration_user_cd   = datareader["registration_user_cd"].ToString(),
                    registration_date_time = (DateTime)datareader["registration_date_time"],
                };
                voList.add(outVo);
            }
            datareader.Close();
            return(voList);
        }