using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 体检套餐管理系统
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 体检套餐管理系统
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void groupBox1_Enter(object sender, EventArgs e)
{
{
}
private void Form1_Load(object sender, EventArgs e)
{
{
HealthCheckItem c1 = new HealthCheckItem();
c1.Name = "身高";
c1.Price = 5;
c1.Description = "用来检查身高";
c1.Name = "身高";
c1.Price = 5;
c1.Description = "用来检查身高";
HealthCheckItem c2 = new HealthCheckItem();
c2.Name = "体重";
c2.Price = 5;
c2.Description = "用来检查体重";
HealthCheckItem c3 = new HealthCheckItem();
c3.Name = "肝功能";
c3.Price = 50;
c3.Description = "用来检查肝功能";
c2.Name = "体重";
c2.Price = 5;
c2.Description = "用来检查体重";
HealthCheckItem c3 = new HealthCheckItem();
c3.Name = "肝功能";
c3.Price = 50;
c3.Description = "用来检查肝功能";
HealthCheckItem c4 = new HealthCheckItem();
c4.Name = "视力";
c4.Price = 10;
c4.Description = "用来检查视力";
HealthCheckItem c5 = new HealthCheckItem();
c5.Name = "听力";
c5.Price = 10;
c5.Description = "用来检查听力";
HealthCheckItem c6 = new HealthCheckItem();
c6.Name = "B超";
c6.Price = 30;
c6.Description = "用来检查B超";
HealthCheckItem c7 = new HealthCheckItem();
c7.Name = "心电图";
c7.Price = 50;
c7.Description = "用来检查心电图";
HealthCheckItem c8 = new HealthCheckItem();
c8.Name = "血压";
c8.Price = 20;
c8.Description = "用来检查血压";
HealthCheckItem c9 = new HealthCheckItem();
c9.Name = "血常规";
c9.Price = 20;
c9.Description = "用来检查血常规";
c4.Name = "视力";
c4.Price = 10;
c4.Description = "用来检查视力";
HealthCheckItem c5 = new HealthCheckItem();
c5.Name = "听力";
c5.Price = 10;
c5.Description = "用来检查听力";
HealthCheckItem c6 = new HealthCheckItem();
c6.Name = "B超";
c6.Price = 30;
c6.Description = "用来检查B超";
HealthCheckItem c7 = new HealthCheckItem();
c7.Name = "心电图";
c7.Price = 50;
c7.Description = "用来检查心电图";
HealthCheckItem c8 = new HealthCheckItem();
c8.Name = "血压";
c8.Price = 20;
c8.Description = "用来检查血压";
HealthCheckItem c9 = new HealthCheckItem();
c9.Name = "血常规";
c9.Price = 20;
c9.Description = "用来检查血常规";
HealthCheckItem.list.Add(c1);
HealthCheckItem.list.Add(c2);
HealthCheckItem.list.Add(c3);
HealthCheckItem.list.Add(c4);
HealthCheckItem.list.Add(c5);
HealthCheckItem.list.Add(c6);
HealthCheckItem.list.Add(c7);
HealthCheckItem.list.Add(c8);
for (int i = 0; i < HealthCheckItem.list.Count; i++)
{
comboBox2.Items.Add(HealthCheckItem.list[i].Name);
}
List<HealthCheckItem> li = new List<HealthCheckItem>();
li.Add(c1);
li.Add(c2);
li.Add(c3);
HealthCheckItem.dictionary.Add("入学体检", li);
}
private void button1_Click(object sender, EventArgs e)
{
{
//添加体检套餐管理系统
List<HealthCheckItem> li = new List<HealthCheckItem>();
string name = textBox1.Text;
HealthCheckItem.dictionary.Add("name", li);
comboBox1.Items.Add(textBox1.Text);
MessageBox.Show("添加成功!");
List<HealthCheckItem> li = new List<HealthCheckItem>();
string name = textBox1.Text;
HealthCheckItem.dictionary.Add("name", li);
comboBox1.Items.Add(textBox1.Text);
MessageBox.Show("添加成功!");
}
private void button2_Click(object sender, EventArgs e)
{
int sum=0;
string name = comboBox1.Text;
List<HealthCheckItem> li = HealthCheckItem.dictionary[name];
foreach (HealthCheckItem c in HealthCheckItem.list)
{
if (c.Name == comboBox2.Text)
{
li.Add(c);
sum += c.Price;
MessageBox.Show("添加成功");
break;
{
int sum=0;
string name = comboBox1.Text;
List<HealthCheckItem> li = HealthCheckItem.dictionary[name];
foreach (HealthCheckItem c in HealthCheckItem.list)
{
if (c.Name == comboBox2.Text)
{
li.Add(c);
sum += c.Price;
MessageBox.Show("添加成功");
break;
}
label7.Text = sum.ToString();
this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
}
label7.Text = sum.ToString();
this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
}
private void button3_Click(object sender, EventArgs e)
{
int sum = 0;
string name = comboBox1.Text;
List<HealthCheckItem> li = HealthCheckItem.dictionary[name];
string str = "";
foreach (HealthCheckItem c in HealthCheckItem.list)
{
str = dataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString();
if (c.Name== str)
{
li.Remove(c);
sum -= c.Price;
MessageBox.Show("删除成功!");
break;
}
}
label7.Text = sum.ToString();
this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
{
int sum = 0;
string name = comboBox1.Text;
List<HealthCheckItem> li = HealthCheckItem.dictionary[name];
string str = "";
foreach (HealthCheckItem c in HealthCheckItem.list)
{
str = dataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString();
if (c.Name== str)
{
li.Remove(c);
sum -= c.Price;
MessageBox.Show("删除成功!");
break;
}
}
label7.Text = sum.ToString();
this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int sum = 0;
label5.Text = comboBox1.Text;
{
int sum = 0;
label5.Text = comboBox1.Text;
List<HealthCheckItem> li = new List<HealthCheckItem>();
li = HealthCheckItem.dictionary[comboBox1.Text];
foreach (HealthCheckItem c in li)
{
sum += c.Price;
}
label7.Text = sum.ToString(); this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
}
}
li = HealthCheckItem.dictionary[comboBox1.Text];
foreach (HealthCheckItem c in li)
{
sum += c.Price;
}
label7.Text = sum.ToString(); this.dataGridView1.DataSource = new BindingList<HealthCheckItem>(HealthCheckItem.dictionary[comboBox1.Text]);
}
}
}