addasset.cs

来自「一个比较简单的」· CS 代码 · 共 77 行

CS
77
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AssetsSystem.Sys;
using AssetsSystem.Inc;
using AssetsSystem.Service;
using AssetsSystem.Dao;

namespace AssetsSystem.Dialog
{
    public partial class AddAsset : Form
    {

        private static AssetService service = new AssetService();

        public AddAsset()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 增加记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addbutton_Click(object sender, EventArgs e)
        {
            if (!Util.haveText(this.zcmc.Text))
            {
                MessageBox.Show("对不起,请输入资产名称!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            Asset asset = new Asset();

            asset.setZcbm(this.zcbm.Text);
            asset.setZcmc(this.zcmc.Text);
            asset.setLb(this.lb.Text);
            asset.setXh(this.xh.Text);
            asset.setDw(this.dw.Text);
            asset.setZzs(this.zzs.Text);
            asset.setCd(this.cd.Text);
            asset.setRzrq(this.rzrq.Text);
            asset.setSyrq(this.syrq.Text);
            asset.setSyqk(this.syqk.Text);
            asset.setSybm(this.sybm.Text);
            asset.setCfdd(this.cfdd.Text);
            asset.setSl(this.sl.Text);
            asset.setYz(this.yz.Text);


            int n=service.Add(asset);
            if (n != 0) this.DialogResult = DialogResult.OK;
        }


        /// <summary>
        /// 检查输入数字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sl_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Util.isnumstr(e.KeyChar.ToString()))
            {
                //MessageBox.Show("不是数字!");
                e.Handled = true;
            }

        }



    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?