コード例 #1
0
        //确定按钮点击事件
        private void confirm_btn_Click(object sender, EventArgs e)
        {
            //设置备注的默认值并确保必填项不为空
            if (remarks_txb.Text == "")
            {
                remarks_txb.Text = LoadForm.TextList[56];
            }

            if (name_txb.Text == "" || tel_txb.Text == "" || address_txb.Text == "")
            {
                MessageBox.Show(LoadForm.TextList[57]);
                return;
            }

            //更新数据库suppier表
            string sql = "update supplier set name = '" + name_txb.Text + "',tel = '" + tel_txb.Text + "',address = '" + address_txb.Text + "',remarks = '" + remarks_txb.Text + "' where id = '" + id + "'";

            cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteScalar();

            MessageBox.Show(LoadForm.TextList[80]);

            //调用父窗口的查询方法,刷新供应商列表
            sql = "select * from supplier ";
            SupplierManage supplierManage = (SupplierManage)this.Owner;

            supplierManage.supplier_list_ltv.Items.Clear();
            supplierManage.SelectSupplier(sql);
            supplierManage.Show();
            this.Dispose();
        }
コード例 #2
0
        //删除按钮点击事件
        private void delete_btn_Click(object sender, EventArgs e)
        {
            //弹出确认删除对话框
            MessageBoxButtons messbutton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show(LoadForm.TextList[81], LoadForm.TextList[63], messbutton);

            if (dr == DialogResult.OK)
            {
                string sql = ("delete from supplier where id = '" + id + "'");
                cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteScalar();

                MessageBox.Show(LoadForm.TextList[82]);

                //设置supplier表自增的主键id从0开始(实际值为当前最大值加1)
                sql = ("alter table supplier auto_increment = 0");
                cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteScalar();

                //调用父窗口的查询方法,刷新供应商列表
                sql = "select * from supplier ";
                SupplierManage supplierManage = (SupplierManage)this.Owner;
                supplierManage.supplier_list_ltv.Items.Clear();
                supplierManage.SelectSupplier(sql);
                supplierManage.Show();
                this.Dispose();
            }
        }
コード例 #3
0
        //选择供应商按钮点击事件
        private void select_supplier_btn_Click(object sender, EventArgs e)
        {
            SupplierManage supplierManage = new SupplierManage(true);

            supplierManage.isModifyingGoods = true;
            supplierManage.ShowDialog(this);

            if (selectedSupplierItem != null)
            {
                select_supplier_btn.Text = selectedSupplierItem.SubItems[1].Text;
            }
        }
コード例 #4
0
        //选择供应商按钮点击事件
        private void select_supplier_btn_Click(object sender, EventArgs e)
        {
            //打开供应商管理窗口,设置供应商管理窗口是否正在选择供应商属性为真
            SupplierManage supplierManage = new SupplierManage(true);

            supplierManage.ShowDialog(this);

            //如果选择的供应商不为空,将该按钮的文本修改为选择的供应商名称
            if (selectedSupplierItem != null)
            {
                select_supplier_btn.Text = selectedSupplierItem.SubItems[1].Text;
            }
        }