⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addasset.cs

📁 一个比较简单的
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -