• c#进销存


    今天做了杨老师的c#进销存系统

    cunchu.cs

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DZY;
    using MySql.Data.MySqlClient;
    namespace DZY
    {
        public partial class cKucun : Form
        {
            public cKucun()
            {
                InitializeComponent();
            }
    
            getKucun KcGoods = new getKucun();
            wKucun Kc = new wKucun();
            public int intCount = 0;
            public string kcId = "";
            public string GoodId = null;
            private void frmKcGoods_Load(object sender, EventArgs e)
            {
                Kc.KcGoodsFind(dataGridView1);
            }
    
    
            public void Clear()
            {
                txtSellID.Text = "";
                txtGoodsName.Text = "";
                txtSellGoodsNum.Text = "";
                txtKcName.Text = "";
            }
            public int fillGetInfo()
            {
                int intResult = 0;
                if (intCount == 1 || intCount == 2)
                {
                    if (txtSellID.Text == "")
                    {
                        MessageBox.Show("商品销售编号不能为空");
                        return intResult;
                    }
                    if (txtGoodsName.Text == "")
                    {
                        MessageBox.Show("商品名称不能为空");
                        return intResult;
                    }
                    if (txtSellGoodsNum.Text == "")
                    {
                        MessageBox.Show("商品数量不能为空");
                        return intResult;
                    }
                    KcGoods.getKcID = txtSellID.Text;
                    KcGoods.getKcNum = txtSellGoodsNum.Text;
                    KcGoods.getKcGoodsName = txtGoodsName.Text;
                    KcGoods.getKcDeptName = txtKcName.Text;
    
                }
                if (txtSellID.Text == "")
                {
                    MessageBox.Show("商品销售编号不能为空!,请选择要删除的商品信息", "信息提示");
                    return intResult;
                }
                if (txtKcName.Text == "")
                {
                    MessageBox.Show("仓库名称不能为空!");
                    return intResult;
                }
                intResult = 1;
                return intResult;
            }
            //保存
            private void toolSave_Click(object sender, EventArgs e)
            {
                if (fillGetInfo() == 1)
                {
                    if (intCount == 1)
                    {
                        if (Kc.KcGoodsAdd(KcGoods) == 1)
                        {
                            MessageBox.Show("添加成功");
                            Clear();
                            intCount = 0;
                            Kc.KcGoodsFind(dataGridView1);
                        }
                        else
                        {
    
                            MessageBox.Show("添加成功");
                            Clear();
    
                            intCount = 0;
                        }
    
                    }
                    if (intCount == 2)
                    {
                        if (Kc.KcGoodsUpdate(KcGoods) == 1)
                        {
                            MessageBox.Show("修改成功");
                            Clear();
                            intCount = 0;
                            Kc.KcGoodsFind(dataGridView1);
                        }
                        else
                        {
    
                            MessageBox.Show("修改成功");
                            Clear();
    
                            intCount = 0;
                        }
                    }
                    if (intCount == 3)
                    {
                        if (Kc.KcGoodsDelete(KcGoods) == 1)
                        {
                            MessageBox.Show("删除成功");
                            Clear();
                            intCount = 0;
                            Kc.KcGoodsFind(dataGridView1);
    
                        }
                        else
                        {
                            MessageBox.Show("删除成功");
                            Clear();
    
                            intCount = 0;
                        }
                    }
                }//
            }
            private void toolCancel_Click(object sender, EventArgs e)
            {
                Clear();
    
                intCount = 0;
            }
            private void toolAdd_Click(object sender, EventArgs e)
            {
                Clear();
    
                intCount = 1;
                txtSellID.Text = Kc.getKcID();
            }
            private void toolAmend_Click(object sender, EventArgs e)
            {
                Clear();
    
                intCount = 2;
            }
            private void toolExit_Click(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void txtKcGoodsNum_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
                {
                    MessageBox.Show("输入数字");
                    e.Handled = true;
                }
            }
            private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
            {
                if (intCount == 2 || intCount == 3)
                {
                    FillControls();
                }
            }
            private void FillControls()
            {
                try
                {
                    MySqlDataReader sqldr = Kc.KcGoodsFind(this.dataGridView1[0, this.dataGridView1.CurrentCell.RowIndex].Value.ToString());
                    sqldr.Read();
                    if (sqldr.HasRows)
                    {
    
                        txtSellID.Text = sqldr[0].ToString();
                        txtSellGoodsNum.Text = sqldr[3].ToString();
                        txtGoodsName.Text = sqldr[2].ToString();
                        txtKcName.Text = sqldr[1].ToString();
    
                    }
                    sqldr.Close();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.ToString());
                }
            }
    
    
            private void toolDelete_Click(object sender, EventArgs e)
            {
    
                intCount = 3;
            }
    
            private void txtKcName_TextChanged(object sender, EventArgs e)
            {
    
            }
        }
    }
    View Code

    chaxun .cs

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DZY;
    
    namespace DZY
    {
        public partial class cMaicha : Form
        {
            public cMaicha()
            {
                InitializeComponent();
            }
    
            wMaihuo Sellh = new wMaihuo();
            getMaihuo SellGoods = new getMaihuo();
            private void button1_Click(object sender, EventArgs e)
            {
    
                if (comboBox1.Text == "")
                {
                    MessageBox.Show("请选择查询条件!");
                    return;
                }
                if (textBox1.Text == "")
                {
                    MessageBox.Show("请输入查询信息");
                    return;
                }
                switch (comboBox1.Text)
                {
                    case "商品名称":
                        SellGoods.getGoodsName = textBox1.Text;
                        Sellh.SellGoodsFind(dataGridView1, 1, SellGoods);
                        break;
                    case "销售人员":
                        SellGoods.getEmpId = textBox1.Text;
                        Sellh.SellGoodsFind(dataGridView1, 2, SellGoods);
                        break;
                }
            }
    
            private void cMaicha_Load(object sender, EventArgs e)
            {
    
            }
    
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
    
            }
        }
    }
    View Code
  • 相关阅读:
    Linux中权限管理之文件特殊权限
    Linux中权限管理之ACL权限
    Linux用户管理命令
    【并发编程】实现多线程的几种方式
    “数据中台”的再思考
    软件工程六大设计原则总结,案例演示
    你必须要知道的移动端开发知识
    【搞定面试官】你还在用Executors来创建线程池?会有什么问题呢?
    EasyCode实现数据库到Swagger全自动化
    【Java实例】使用Thumbnailator生成缩略图(缩放、旋转、裁剪、水印)
  • 原文地址:https://www.cnblogs.com/zhjvvvvvv/p/14206533.html
Copyright © 2020-2023  润新知