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

📄 入库信息修改.cs

📁 湖南岳阳电力部门 电力管理系统 .net C#开发的
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 计量
{
    public partial class 入库信息修改 : Form
    {
        public 入库信息修改()
        {
            InitializeComponent();
        }

        private void 入库信息修改_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“sqldatabase_DataDataSet.出入库明细表”中。您可以根据需要移动或移除它。
            this.出入库明细表TableAdapter.FillBy1(this.sqldatabase_DataDataSet.出入库明细表,"入库");
            this.textBox1.ReadOnly = true;
            this.textBox2.ReadOnly = true;
            this.textBox5.ReadOnly = true;
            this.textBox6.ReadOnly = true;
            this.textBox8.ReadOnly = true;
            this.textBox9.ReadOnly = true;
            this.textBox10.ReadOnly = true;
            this.textBox11.ReadOnly = true;
            this.textBox13.ReadOnly = true;
            this.textBox14.ReadOnly = true;
            this.comboBox2.Visible = false;
            this.comboBox2.SelectedIndex = 1;
            this.setreadolytrue();
            this.button2.Enabled = false;
            this.button3.Enabled = false; 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.comboBox2.Visible = true;
            this.comboBox1.Enabled = false;
            this.dataGridView1.Enabled = false;
            this.setreadolyfalse();
            this.button2.Enabled = true;
            this.button3.Enabled = true;
            this.button1.Enabled = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.comboBox2.Visible = false;
            this.comboBox1.Enabled = true;
            this.setreadolytrue();
            this.button1.Enabled = true;
            this.button2.Enabled = false;
            this.button3.Enabled = false;
            this.dataGridView1.Enabled = true;
            try
            {
                this.textBox8.Text = ((int.Parse(this.textBox6.Text.Trim()) * float.Parse(this.textBox7.Text.Trim())) + "");
            }
            catch (Exception exc)
            {
                MessageBox.Show("输入有误:" + exc.Message);
            }
            string a = "", b = "", c = "", d = "", ee = "", f = "", g = "", h = "", i = "", j = "", k = "", l = "", n = "", m = "", o = "";
            a = this.comboBox1.Text.Trim();
            b = this.textBox1.Text.Trim();
            c = this.textBox2.Text.Trim();
            d = this.textBox3.Text.Trim();
            ee = this.textBox4.Text.Trim();
            f = this.textBox5.Text.Trim();
            g = this.textBox6.Text.Trim();
            h = this.textBox7.Text.Trim();
            i = this.textBox8.Text.Trim();
            j = this.textBox9.Text.Trim();
            k = this.textBox10.Text.Trim();
            l = this.textBox11.Text.Trim();
            n = this.textBox12.Text.Trim();
            m = this.comboBox2.Text.Trim();
            o = this.textBox14.Text.Trim();
            try
            {
                int ii = this.出入库明细表TableAdapter.UpdateQuery(b, c, d, ee, f, int.Parse(g), float.Parse(h), float.Parse(i), j, k, l, n, m, o, this.comboBox1.Text.Trim(), this.comboBox1.Text.Trim());
                if (ii == 0) MessageBox.Show("修改失败");
                else MessageBox.Show("修改成功");
            }
            catch (Exception exc)
            {
                MessageBox.Show("修改失败:"+exc.Message);
            }
            this.出入库明细表TableAdapter.FillBy1(this.sqldatabase_DataDataSet.出入库明细表, "入库");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            
            this.comboBox2.Visible = false;
            this.comboBox1.Enabled = true;
            this.button1.Enabled = true;
            this.button2.Enabled = false;
            this.button3.Enabled = false; 
            this.setreadolytrue();
            this.dataGridView1.Enabled = true;
            this.出入库明细表TableAdapter.FillBy1(this.sqldatabase_DataDataSet.出入库明细表, "入库");

        }

        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                this.textBox8.Text = ((int.Parse(this.textBox6.Text.Trim()) * float.Parse(this.textBox7.Text.Trim())) + "");
            }
            catch (Exception exc)
            {
                MessageBox.Show("输入有误:"+exc.Message);
            }
        }
        private void setreadolytrue()
        {
            this.textBox3.ReadOnly = true;
            this.textBox4.ReadOnly = true; 
            this.textBox7.ReadOnly = true;
            this.textBox12.ReadOnly = true; 
        }
        private void setreadolyfalse()
        {
            this.textBox3.ReadOnly = false;
            this.textBox4.ReadOnly = false; 
            this.textBox7.ReadOnly = false;
            this.textBox12.ReadOnly = false;
        }
         
    }
}

⌨️ 快捷键说明

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