frmmedicine.cs
来自「关于医院进销存的系统」· CS 代码 · 共 597 行 · 第 1/2 页
CS
597 行
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;
namespace YYJXC
{
public partial class frmMedicine : Form
{
private SqlDataAdapter da = null;
public frmMedicine()
{
InitializeComponent();
}
/// <summary>
/// 按钮状态
/// </summary>
/// <param name="State"></param>
public void ControlButtonState(bool State)
{
if (State)
{
btAdd.Enabled = false;
btDelete.Enabled = false;
btSave.Enabled = true;
tbCancel.Enabled = true;
}
else
{
btAdd.Enabled = true;
btDelete.Enabled = true;
btSave.Enabled = false;
tbCancel.Enabled = false;
}
}
public void ViewData()
{
SqlConnection Conn = new SqlConnection("server=" + CLoad.ReadServer() + ";pwd=" + CLoad.ReadPwd() + ";uid=sa;database=YYJXC");
da = new SqlDataAdapter("select * from tb_medicine",Conn);
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da.Fill(dataSet1);
bindingSource1.DataSource = dataSet1.Tables[0];
dataGridView1.DataSource = bindingSource1;
}
public void BindData()
{
tbId.DataBindings.Add("Text", bindingSource1, "药品编号");
tbTiaoMa.DataBindings.Add("Text", bindingSource1, "药品条码");
tbName.DataBindings.Add("Text", bindingSource1, "药品名称");
tbTongYong.DataBindings.Add("Text", bindingSource1, "通用名");
tbPinYin.DataBindings.Add("Text", bindingSource1, "拼音码");
cbDanWei.DataBindings.Add("Text", bindingSource1, "单位");
tbGuiGe.DataBindings.Add("Text", bindingSource1, "规格");
tbShengCanTime.DataBindings.Add("Text", bindingSource1, "生产日期");
cbJiXing.DataBindings.Add("Text", bindingSource1, "剂型");
tbCanDi.DataBindings.Add("Text", bindingSource1, "产地");
tbDaBao.DataBindings.Add("Text", bindingSource1, "大包装数");
tbZhongBao.DataBindings.Add("Text", bindingSource1, "中包装数");
cbYouXiaoQi.DataBindings.Add("Text", bindingSource1, "有效期");
cbZhiLiangBiaoZhun.DataBindings.Add("Text", bindingSource1, "质量标准");
cbJingXiaoFangChi.DataBindings.Add("Text", bindingSource1, "经销方式");
tbPiHao.DataBindings.Add("Text", bindingSource1, "批号");
tbShangBiaoHao.DataBindings.Add("Text", bindingSource1, "商标号");
tbChangJia.DataBindings.Add("Text", bindingSource1, "厂价");
tbLingShouJia.DataBindings.Add("Text", bindingSource1, "零售价");
tbPiFaJia.DataBindings.Add("Text", bindingSource1, "批发价");
tbJinHuoJia.DataBindings.Add("Text", bindingSource1, "进贷价");
cbLeiBie.DataBindings.Add("Text", bindingSource1, "类别");
tbBaoXianHao.DataBindings.Add("Text", bindingSource1, "医疗保险编号");
tbGongYingShangId.DataBindings.Add("Text", bindingSource1, "供贷商编号");
tbGongYingShangName.DataBindings.Add("Text", bindingSource1, "供贷商名称");
}
private void frmMedicine_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
cbFields.Items.Add("药品编号");
cbFields.Items.Add("药品条码");
cbFields.Items.Add("药品名称");
cbFields.Items.Add("拼音码");
cbFields.Items.Add("规格");
cbFields.Items.Add("剂型");
cbFields.Items.Add("产地");
cbFields.Items.Add("单位");
cbFields.Items.Add("类别");
cbFields.Items.Add("供贷商名称");
cbFields.SelectedIndex = 1;
cbOperator.Items.Add("like");
cbOperator.Items.Add("=");
cbOperator.Items.Add(">");
cbOperator.Items.Add("<");
cbOperator.SelectedIndex = 0;
cbDanWei.Items.Add("盒");
cbDanWei.Items.Add("包");
cbDanWei.Items.Add("袋");
cbDanWei.Items.Add("个");
cbDanWei.Items.Add("罐");
cbDanWei.Items.Add("粒");
cbDanWei.Items.Add("片");
cbDanWei.Items.Add("瓶");
cbDanWei.SelectedIndex = 0;
cbJiXing.Items.Add("针剂");
cbJiXing.Items.Add("片剂");
cbJiXing.Items.Add("脐囊");
cbJiXing.Items.Add("口服液");
cbJiXing.Items.Add("冲剂");
cbJiXing.Items.Add("丸剂");
cbJiXing.SelectedIndex = 1;
cbYouXiaoQi.Items.Add("半年");
cbYouXiaoQi.Items.Add("一年");
cbYouXiaoQi.Items.Add("一年半");
cbYouXiaoQi.Items.Add("二年");
cbYouXiaoQi.Items.Add("二年半");
cbYouXiaoQi.Items.Add("三年");
cbYouXiaoQi.Items.Add("三年以上");
cbYouXiaoQi.SelectedIndex = 1;
cbZhiLiangBiaoZhun.Items.Add("中国药典");
cbZhiLiangBiaoZhun.Items.Add("卫生部药品标准");
cbZhiLiangBiaoZhun.Items.Add("地方药品标准");
cbZhiLiangBiaoZhun.Items.Add("进口国药标准");
cbZhiLiangBiaoZhun.Items.Add("企业标准");
cbZhiLiangBiaoZhun.SelectedIndex = 0;
cbJingXiaoFangChi.Items.Add("经销");
cbJingXiaoFangChi.Items.Add("代销");
cbJingXiaoFangChi.SelectedIndex = 0;
cbLeiBie.Items.Add("西药");
cbLeiBie.Items.Add("中药");
cbLeiBie.Items.Add("中成药(外用)");
cbLeiBie.Items.Add("消毒");
cbLeiBie.Items.Add("参茸");
cbLeiBie.SelectedIndex = 1;
ViewData();
BindData();
ControlButtonState(false);
}
private void tbId_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbTiaoMa.Focus();
tbTiaoMa.SelectAll();
e.Handled = true;
}
}
private void tbTiaoMa_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbName.Focus();
tbName.SelectAll();
e.Handled = true;
}
}
private void tbName_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbTongYong.Focus();
tbTongYong.SelectAll();
e.Handled = true;
}
}
private void tbTongYong_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbPinYin.Focus();
tbPinYin.SelectAll();
e.Handled = true;
}
}
private void tbPinYin_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
cbDanWei.Focus();
cbDanWei.SelectAll();
e.Handled = true;
}
}
private void cbDanWei_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbGuiGe.Focus();
tbGuiGe.SelectAll();
e.Handled = true;
}
}
private void tbGuiGe_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
cbJiXing.Focus();
cbJiXing.SelectAll();
e.Handled = true;
}
}
private void cbJiXing_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbShengCanTime.Focus();
tbShengCanTime.SelectAll();
e.Handled = true;
}
}
private void tbCanDi_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbDaBao.Focus();
tbDaBao.SelectAll();
e.Handled = true;
}
}
private void tbDaBao_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbZhongBao.Focus();
tbZhongBao.SelectAll();
e.Handled = true;
}
}
private void tbZhongBao_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
cbYouXiaoQi.Focus();
cbYouXiaoQi.SelectAll();
e.Handled = true;
}
}
private void cbYouXiaoQi_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
cbZhiLiangBiaoZhun.Focus();
cbZhiLiangBiaoZhun.SelectAll();
e.Handled = true;
}
}
private void cbZhiLiangBiaoZhun_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
cbJingXiaoFangChi.Focus();
cbJingXiaoFangChi.SelectAll();
e.Handled = true;
}
}
private void cbJingXiaoFangChi_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbPiHao.Focus();
tbPiHao.SelectAll();
e.Handled = true;
}
}
private void tbPiHao_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbShangBiaoHao.Focus();
tbShangBiaoHao.SelectAll();
e.Handled = true;
}
}
private void tbShangBiaoHao_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
tbChangJia.Focus();
tbChangJia.SelectAll();
e.Handled = true;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?