游戏技术文章

体检套餐管理系统

时间:2017-3-16 16:38:58  作者:棋牌资源网  来源:棋牌资源网  查看:7799  评论:0
内容摘要: using System;using System.Collections.Generic;using System.Text;namespace ExaminationList{       public ...
体检套餐管理系统

 

using System;
using System.Collections.Generic;
using System.Text;

namespace ExaminationList
{
   
    public class HealthCheckItem
    {
        public HealthCheckItem(string name, int price, string description)
        {
            this.Name = name;
            this.Price = price;
            this.Description = description;
        }
        public HealthCheckItem()
        {
        }

       
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

      
        private string description;
        public string Description
        {
            get { return description; }
            set { description = value; }
        }

       
        private int price;
        public int Price
        {
            get { return price; }
            set { price = value; }
        }
    }
}

 

using System;
using System.Collections.Generic;
using System.Text;
namespace ExaminationList
{
   
    public class HealthCheckSet
    {
        public HealthCheckSet()
        {
            items = new List<HealthCheckItem>();
        }
        public HealthCheckSet(string name, List<HealthCheckItem> items)
        {
            this.Name = name;
            this.items = items;
        }

       
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

       
        private List<HealthCheckItem> items;
        public List<HealthCheckItem> Items
        {
            get { return items; }
            set { items = value; }
        }

       
        private int price;
        public int Price
        {
            get { return price; }
        }

      
        public void CalcPrice()
        {
            int totalPrice = 0;
            foreach (HealthCheckItem item in items)
            {
                totalPrice += item.Price;
            }
            this.price = totalPrice;
        }
    }
}

 

 

 

 

 

 

 

using ExaminationList;
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 js
{
    public partial class Form1 : Form
    {
        HealthCheckItem height, weight, sight, hearing, liverFun, ekg;
        HealthCheckSet setA;
       

        public Form1()
        {
            InitializeComponent();
        }

        List<HealthCheckItem> AllItem = new List<HealthCheckItem>();
        List<HealthCheckItem> items = new List<HealthCheckItem>();

        public Dictionary<string, HealthCheckSet> healthset = new Dictionary<string, HealthCheckSet>();

        private void Form1_Load(object sender, EventArgs e)
        {
            lblSetName.Text = "";
            lblSetPrice.Text = "";
            this.btnAdd.Enabled = false;
            this.btnDel.Enabled = false;

            InitItems();
            InitSets();
            InitHealthSetList();
        }


        public void InitItems()
        {
           
            height = new HealthCheckItem("身高",5,"用于检查身高");
            weight = new HealthCheckItem("体重",8,"用于检查体重");
            sight = new HealthCheckItem("视力",10,"用于检查视力");
            hearing = new HealthCheckItem("听力",10,"用于检查听力");
            liverFun = new HealthCheckItem("肝功能",50,"用于检查肝功能");
            ekg = new HealthCheckItem("心电图",100,"用于检查心电图");
           
            AllItem.Add(height);
            AllItem.Add(weight);
            AllItem.Add(sight);
            AllItem.Add(hearing);
            AllItem.Add(liverFun);
            AllItem.Add(ekg);
        }
        public void InitSets()
        {
            items = new List<HealthCheckItem>();
            items.Add(height);
            items.Add(weight);
            items.Add(sight);
            setA = new HealthCheckSet("入学体检",items);
            setA.CalcPrice();
            this.healthset.Add("入学体检",setA);
        }

        public void InitHealthSetList()
        {
            this.cboSets.Items.Clear();
            this.cboSets.Items.Add("请选择");
            foreach(string key in this.healthset.Keys){
                this.cboSets.Items.Add(key);
            }
            this.cboSets.SelectedIndex = 0;
        }
        private void UpdateSet(HealthCheckSet set)
        {
            this.dgvHealthList.DataSource = new BindingList<HealthCheckItem>(this.items);
        }

        private void cboSets_SelectedIndexChanged(object sender, EventArgs e)
        {
            string setName = this.cboSets.Text;
            if(setName=="请选择"){
                this.dgvHealthList.DataSource = new BindingList<HealthCheckItem>();
                lblSetName.Text = "";
                lblSetPrice.Text = "";
                return;
            }
            lblSetName.Text = this.healthset[setName].Name;
            lblSetPrice.Text = this.healthset[setName].Price.ToString();
            UpdateSet(healthset[setName]);
            this.btnDel.Enabled = true;
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            string setName = this.cboSets.Text;
            if(this.dgvHealthList.SelectedRows.Count==0){
                MessageBox.Show("您没有选中删除项","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return;
            }
            int index = this.dgvHealthList.SelectedRows[0].Index;
            this.healthset[setName].Items.RemoveAt(index);
            this.healthset[setName].CalcPrice();
            UpdateSet(healthset[setName]);
            this.lblSetName.Text = setA.Name;
            this.lblSetPrice.Text = setA.Price.ToString();
            MessageBox.Show("删除成功!","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

        private void cboItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cboItems.Text != "请选择")
            {
                this.btnAdd.Enabled = true;
            }
            else
            {
                this.btnAdd.Enabled = false;
            }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            if(this.cboItems.SelectedIndex==0){
                MessageBox.Show("请选择一个项目");
                return;
            }
            string cboSetText = this.cboSets.Text;
            if(cboSetText=="请选择"){
                MessageBox.Show("请选择套餐");
                return;
            }
            int index = this.cboItems.SelectedIndex - 1;
            if (!this.healthset[cboSetText].Items.Contains(AllItem[index]))
            {
                this.healthset[cboSetText].Items.Add(AllItem[index]);
                this.healthset[cboSetText].CalcPrice();
                UpdateSet(this.healthset[cboSetText]);
                this.lblSetName.Text = this.healthset[cboSetText].Name;
                this.lblSetPrice.Text = this.healthset[cboSetText].Price.ToString();
                MessageBox.Show("添加成功!", "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information);


            }
            else
            {
                MessageBox.Show("该项目已存在!","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(string.IsNullOrEmpty(this.txtHealthName.Text.Trim())){
                MessageBox.Show("请输入套餐名称","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

            }
            HealthCheckSet Hch = new HealthCheckSet();
            this.healthset.Add(this.txtHealthName.Text.Trim(),Hch);
            this.InitHealthSetList();
            this.cboSets.SelectedIndex = this.healthset.Count;
            MessageBox.Show("添加成功!","友情提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

    }
}

标签:体检套餐管理系统 

欢迎加入VIP,【VIP售价:只要288元永久VIP会员】畅享商业棋牌游戏程序下载,点击开通!

下载说明


☉本站所有源码和资源均由站长亲自测试-绝对保证都可以架设,运营!
☉如源码和资源有损坏或所有链接均不能下载,请告知管理员,

☉本站软件和源码大部分为站长独资,资源购买和收集,放心下载!

☉唯一站长QQ:1004003180  [人格担保-本站注重诚信!]

☉购买建议E-mail:1004003180@qq.com   源码收购 E-mail:1004003180@qq.com    

☉本站文件解压密码  【文章内都自带解压密码,每个密码不同!】


本站提供的所有源码,均来源站长提供,仅学习交流 浙ICP备09009969号

由此产生不良后果和法律责任与本站无关,如果侵犯了您的版权,请来信告知 1004003180@qq.com 将及时更正和删除! 

Copyright © 2008-2022 棋牌资源网,你身边的棋牌资源下载站    All Rights Reserved