C#oop体检套餐管理系统
来源:互联网 发布:讨鬼传2最美捏脸数据 编辑:程序博客网 时间:2024/05/01 01:26
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HealthCheck
{
//检查项目
class HealthCheckItem
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string bewrite;
public string Bewrite
{
get { return bewrite; }
set { bewrite = value; }
}
private int price;
public int Price
{
get { return price; }
set { price = value; }
}
public HealthCheckItem()
{}
public HealthCheckItem(string name,int price,string bewrite)
{
this.name = name;
this.price = price;
this.bewrite = bewrite;
}
public static Dictionary<string, HealthCheckItem> ItemDic = new Dictionary<string, HealthCheckItem>()
{
{"身高",new HealthCheckItem("身高",5,"用于测量身高")},
{"体重",new HealthCheckItem("体重",5,"用于测量体重")},
{"视力",new HealthCheckItem("视力",5,"用于检查视力")},
{"听力",new HealthCheckItem("听力",5,"用于检查听力")},
{"肝功能",new HealthCheckItem("肝功能",200,"用于检测肝功能")},
{"B超",new HealthCheckItem("B超",60,"用于B超检查")},
{"心电图",new HealthCheckItem("心电图",100,"用于检查心电图")},
{"肺活量",new HealthCheckItem("肺活量",8,"用于测量肺活量")}
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HealthCheck
{
//套餐
class HealthCheckSet
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public List<HealthCheckItem> ItemList=new List<HealthCheckItem>();
public static Dictionary<string, List<HealthCheckItem>> SetDic = new Dictionary<string, List<HealthCheckItem>>();
public HealthCheckSet()
{
this.ItemList = new List<HealthCheckItem>();
ItemList.Add(HealthCheckItem.ItemDic["身高"]);
ItemList.Add(HealthCheckItem.ItemDic["体重"]);
ItemList.Add(HealthCheckItem.ItemDic["视力"]);
ItemList.Add(HealthCheckItem.ItemDic["听力"]);
ItemList.Add(HealthCheckItem.ItemDic["肺活量"]);
SetDic.Add("入学体检",this.ItemList);
}
public HealthCheckSet(string name)
{
SetDic.Add(name,this.ItemList);
}
/// <summary>
/// Dic_Values 添加
/// </summary>
/// <param name="str"></param>
public static void DicAdd(List<HealthCheckItem> list,string str)
{
list.Add(HealthCheckItem.ItemDic[str]);
}
}
}
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;
namespace HealthCheck
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
cboItem.Items.Add("请选择");
cboItem.SelectedIndex = 0;
RenovateItem();
HealthCheckSet set = new HealthCheckSet();
RenovateList();
cboList.SelectedIndex = 0;
cboItem.Enabled = false;
btnAddItem.Enabled = false;
btnDeleteItem.Enabled = false;
}
//更新检查项目列表
private void RenovateItem()
{
foreach (KeyValuePair<string, HealthCheckItem> item in HealthCheckItem.ItemDic)
{
cboItem.Items.Add(item.Key);
}
}
//更新套餐列表
private void RenovateList()
{
cboList.Items.Clear();
cboList.Items.Add("请选择");
foreach (KeyValuePair<string, List<HealthCheckItem>> item in HealthCheckSet.SetDic)
{
cboList.Items.Add(item.Key);
}
if (cboList.Items.Count>2)
{
cboList.SelectedIndex = cboList.Items.Count - 1;
}
}
//套餐列表
private void cboList_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboList.SelectedIndex>0)
{
lblChooseName.Text = cboList.Text;
cboItem.Enabled = true;
RenovateDGV();
}
else
{
cboItem.Enabled = false;
}
}
/// <summary>
/// 刷新DGV列表
/// </summary>
private void RenovateDGV()
{
dgvHealthCheckInfo.DataSource = new BindingList<HealthCheckItem>(HealthCheckSet.SetDic[cboList.Text]);
lblChoosePrice.Text = PriceSum(cboList.Text).ToString();
}
/// <summary>
/// 检查总金额
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
private int PriceSum(string key)
{
int sum = 0;
foreach (HealthCheckItem item in HealthCheckSet.SetDic[key])
{
sum += item.Price;
}
return sum;
}
//项目列表
private void cboItem_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboItem.SelectedIndex>0)
{
btnAddItem.Enabled = true;
}
else
{
btnAddItem.Enabled = false;
btnDeleteItem.Enabled = false;
}
}
//DGV单击事件
private void dgvHealthCheckInfo_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (!btnDeleteItem.Enabled)
{
btnDeleteItem.Enabled = true;
}
}
//删除检查项目
private void btnDeleteItem_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("您确定要删除吗?","警告!",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
if (result == DialogResult.OK)
{
if (dgvHealthCheckInfo.SelectedRows[0] != null && dgvHealthCheckInfo.SelectedRows[0].Cells[0] != null && dgvHealthCheckInfo.SelectedRows[0].Cells[0].Value != null)
{
//删除 套餐中所选的与内置检查项目相匹配的项
HealthCheckSet.SetDic[cboList.Text].Remove(HealthCheckItem.ItemDic[dgvHealthCheckInfo.SelectedRows[0].Cells["clmItemName"].Value.ToString()]);
RenovateDGV();
}
}
}
//添加检查项目
private void btnAddItem_Click(object sender, EventArgs e)
{
if (HealthCheckSet.SetDic[cboList.Text].Contains(HealthCheckItem.ItemDic[cboItem.Text]))
{
MessageBox.Show(cboList.Text+"套餐中已存在该检查项目!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
else
{
HealthCheckSet.DicAdd(HealthCheckSet.SetDic[cboList.Text],cboItem.Text);
RenovateDGV();
}
}
//套餐添加
private void btnAdd_Click(object sender, EventArgs e)
{
if (txtName.Text!="")
{
foreach (string item in HealthCheckSet.SetDic.Keys)
{
if (txtName.Text.Equals(item))
{
MessageBox.Show("已经存在"+txtName.Text+"套餐!");
return;
}
}
HealthCheckSet dic = new HealthCheckSet(txtName.Text);
RenovateList();
}
}
}
}
- C#oop体检套餐管理系统
- 体检套餐管理系统
- 体检套餐管理系统
- C# 体检套餐管理系统
- 体检套餐系统
- 体检套餐系统
- 体检套餐
- 体检套餐
- 体检套餐
- 体验套餐管理系统
- 体验套餐管理系统
- 体检之一:体检豪华套餐
- 体检套餐 关键代码
- 第五章 体检套餐
- 体检套餐项目
- 第五章 体检套餐
- 第五章体检套餐
- 医院体检管理系统说明书
- nutch 抓取流程解析
- 全面理解Java内存模型
- 怎么解决maven管理jar包冲突问题
- VMware使用nat模式使主机系统和虚拟系统通信
- Container With Most Water问题及解法
- C#oop体检套餐管理系统
- HPUOJ---2017寒假训练--专题3/A-Til the Cows Come Home(最短路-dijkstra)
- Java多线程之Synchronized应用在static和非static方法上的区别
- MUI框架学习之[事件取消][事件触发][手势事件][自定义事件]
- jdbcTemplate的queryForList
- xhprof php7问题
- String(字符串)数目统计
- android广播中实现弹出窗口
- Java源代码阅读——HashMap实现原理