📄 frmsubjectmoney.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using property.control.Subject;
using property.model.SubjectInfo;
using property.model.Warrant;
using property.control.warrantInfo;
namespace property.view.SystemInfo
{
public partial class frmSubjectMoney : Form
{
public frmSubjectMoney()
{
InitializeComponent();
}
public string P_str_id;
private void SubjectMoney_Load(object sender, EventArgs e)
{
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frmSubInfo frmsub = new frmSubInfo();
txtMoney.Text = "";
txtMoney.Enabled = true;
// frmsub.ShowDialog();
if (frmsub.ShowDialog() == DialogResult.OK)
{ //全局变量P_str_id
P_str_id = frmSubInfo.G_str_subID;
GetSubject sub = new GetSubject();
SubInfo info = new SubInfo();
info.setsubId(Convert.ToInt32(P_str_id));
sub.GetdDataGrid(this.dataGridView1, info);
}// end block if
}
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Convert.ToString(a) == "Yes")
{
this.Close();
}// end block
}
// 保存
private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
GetSubject sub = new GetSubject();
SubInfo info = new SubInfo();
if (P_str_id == null)//判断变量是否查找了信息用来编号
{
MessageBox.Show("请先查找科目信息", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}// end block if
if (this.txtMoney.Text == "")
{
MessageBox.Show("请输入初始金额", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtMoney.Focus();
return;
}//end block
info.setsubId(Convert.ToInt32(P_str_id));
info.setsubMoney(txtMoney.Text.Trim());
string P_int_Updat = sub.MoneyUpdate(info);//调用函数修改
if (P_int_Updat == "updateOk")
{
MessageBox.Show("修改成功", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtMoney.Text = "";
txtMoney.Enabled = false;
info.setsubId(Convert.ToInt32(P_str_id));
sub.GetdDataGrid(this.dataGridView1, info);
}// end block
if (P_int_Updat == "updateNO")
{
MessageBox.Show("修改失败", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}// end block
if (P_int_Updat == "updateError")
{
MessageBox.Show("系统错误", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}// end block
}// end block
private void txtMoney_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("金额只能输入数字", "有情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Handled = true;
}
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
txtMoney.Text = "";
txtMoney.Enabled = false;
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -