Ejemplo n.º 1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                AssetInfoVo outAsset = (AssetInfoVo)DefaultCbmInvoker.Invoke(new GetAssetInfoCbm(), new AssetInfoVo
                {
                    asset_cd = txtAssetCode.Text,
                    asset_no = int.Parse(txtAssetNo.Text)
                });
                AccountInfoVo outVo = new AccountInfoVo
                {
                    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 = (AccountInfoVo)DefaultCbmInvoker.Invoke(new UpdateAccountInfoCbm(), outVo);
                MessageBox.Show("Update finish!!!", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "WARRING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 2
0
 public UpdateAssetForm(AssetInfoVo inVo, bool addForm)
 {
     InitializeComponent();
     checkAddFrm = addForm;
     if (!addForm)
     {
         this.Width   -= dgvAddAssetList.Width;
         btnApply.Text = "Update Asset";
     }
     voInfo = inVo;
 }
Ejemplo n.º 3
0
        private void AddAssetList()
        {
            bool checkEmpty = false;

            foreach (Control x in grUpdate.Controls)
            {
                if (string.IsNullOrEmpty(x.Text) && !(x is Label) && (x.Name != txtAssetPO.Name))
                {
                    checkEmpty = true;
                    break;
                }
            }
            if (checkEmpty)
            {
                MessageBox.Show("Must fill all infomation before add!", "CAUTION", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                voInfo = new AssetInfoVo
                {
                    acquistion_cost = double.Parse(txtAcqCost.Text),
                    acquistion_date = dtpAcqDate.Value,
                    asset_cd        = txtAssetCode.Text,
                    asset_invoice   = txtAssetInvoice.Text,
                    asset_life      = (double)numLife.Value,
                    asset_model     = txtAssetModel.Text,
                    asset_name      = txtAssetName.Text,
                    asset_no        = (int)numAssetNo.Value,
                    asset_po        = txtAssetPO.Text,
                    asset_serial    = txtAssetSerial.Text,
                    asset_supplier  = txtSupplier.Text,
                    asset_type      = cmbAssetType.Text,
                    factory_cd      = txtFactory.Text,
                    label_status    = label
                };
                dgvAddAssetList.Rows.Add(voInfo.asset_cd, voInfo.asset_no, voInfo.asset_name, voInfo.asset_serial,
                                         voInfo.asset_model, voInfo.asset_life, voInfo.acquistion_cost, voInfo.acquistion_date, voInfo.asset_invoice,
                                         voInfo.asset_po, voInfo.asset_type, voInfo.factory_cd, voInfo.asset_supplier, voInfo.label_status);
                infoList.Add(voInfo);
                dgvAddAssetList.Refresh();
                btnAddAsset.Enabled = infoList.Count > 0;
                tsRowCount.Text     = dgvAddAssetList.RowCount.ToString() + " rows";
            }
        }
Ejemplo n.º 4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoVo   inVo = (AssetInfoVo)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
            AssetMaster2019Vo outVo = new AssetMaster2019Vo
            {
                executeInt = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Ejemplo n.º 5
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoVo   inVo = (AssetInfoVo)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
            AssetMaster2019Vo outVo = new AssetMaster2019Vo()
            {
                executeInt = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Ejemplo n.º 6
0
 public AssetMaster2019Form()
 {
     InitializeComponent();
     vo     = new AssetMaster2019Vo();
     voInfo = new AssetInfoVo();
 }
Ejemplo n.º 7
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            AssetInfoVo inVo = (AssetInfoVo)vo;
            ValueObjectList <AssetInfoVo> voList = new ValueObjectList <AssetInfoVo>();
            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())
            {
                AssetInfoVo outVo = new AssetInfoVo
                {
                    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);
        }