📄 warrantupdate.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using property.model.Warrant;
using property.control.warrantInfo;
namespace property.view.WarrantInfo
{
public partial class WarrantUpdate : Form
{
public WarrantUpdate()
{
InitializeComponent();
}
public string P_str_Warid;//全局变量
public static string P_str_Update;//全局静态变量
public WarrantUpdate(string P_str_subID)
{
InitializeComponent();
P_str_Warid = P_str_subID;
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void WarrantUpdate_Load(object sender, EventArgs e)
{
string str;
GetWarInfo war = new GetWarInfo();
Warrant info = new Warrant();
info.setP_int_warrantId(Convert.ToInt32(P_str_Warid));
SqlDataReader dr = war.GetWarrarFInd(info);
while (dr.Read())
{
textSubid.Text = dr[0].ToString();
txtdate.Text = dr[3].ToString();
txtGoodMoney.Text = dr.GetValue(2).ToString();
txtlendMongy.Text = dr[1].ToString();
txtWarrId.Text = dr[4].ToString();
// this.Txtbaid.Text = dr[5].ToString();
txtdate.Enabled = false;
}// end block if
dr.Close();
textSubid.Enabled = false;
txtWarrId.Enabled = false;
}
private void txtGoodMoney_KeyPress(object sender, KeyPressEventArgs e)
{
txtlendMongy.Enabled = false;
txtlendMongy.Text = "0";
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("借方金额只能输入数字");
e.Handled = true;
}
}
private void txtlendMongy_KeyPress(object sender, KeyPressEventArgs e)
{
txtGoodMoney.Text = "0";
txtGoodMoney.Enabled = false;
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageBox.Show("货方金额只能输入数字");
e.Handled = true;
}
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult a = MessageBox.Show("是否要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Convert.ToString(a) == "Yes")
{
this.Close();
}// end block
}
//修改
private void bntSure_Click(object sender, EventArgs e)
{
if(txtlendMongy.Text==""||txtGoodMoney.Text=="")
{
MessageBox.Show("借方金额/货方金额必须填写一项 ", "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (txtlendMongy.Text == "")
{
txtlendMongy.Focus();
return;
}// end block
if (txtGoodMoney.Text=="")
{
txtGoodMoney.FindForm();
return;
}// end block
}// end if
if (txtlendMongy.Text != "0" && txtGoodMoney.Text != "0")
{
MessageBox.Show("您确认没有修改数据","友情提示");
return;
}
if (txtGoodMoney.Enabled ==true || txtlendMongy.Enabled ==true)
{
GetWarInfo getWar = new GetWarInfo();
wait want = new wait();
want.setP_int_warrantId(Convert.ToInt32(txtWarrId.Text.Trim()));
want.setP_int_subGoodsMoney(Convert.ToDecimal(txtGoodMoney.Text.Trim()));
want.setP_int_subLendmoney(Convert.ToDecimal(txtlendMongy.Text.Trim()));
P_str_Update = getWar.GetUpdateWarrt(want);//调用函数返回 参数
}// end block if
}// end block if
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -