📄 addasset.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 + -