体检套餐

 
  public void Checkitem() {
        #region 设定的项目
        height = new HealthCheckitem("身高", 5, "测量身高");
         weight = new HealthCheckitem("体重", 5, "用于测量体重");
         ganpower = new HealthCheckitem("肝功能", 30, "用于测试肝功能");
        Bover = new HealthCheckitem("B超", 30, "用于测试肝功能");
         heart = new HealthCheckitem("心电图", 30, "用于测试心跳");
        hearted = new HealthCheckitem("听觉", 30, "用于听力");
        #endregion
            alitem.Add(height.Name,height);
            alitem.Add(weight.Name,weight);
            alitem.Add(ganpower.Name,ganpower);
            alitem.Add(Bover.Name,Bover);
            alitem.Add(heart.Name,heart);
            alitem.Add(hearted.Name,hearted);
          
        }
//设置添加 检查项目的具体项目

 private void end() {
           this.commenu.Items.Clear();
           this.commenu.Items.Add("请选择");
           foreach (string item in alitem.Keys)
           {
               this.commenu.Items.Add(item);
           }
           this.commenu.SelectedIndex = 0;
       }
//向检查项目的下拉框添加数据的方法

 private void Start() {
            item.Add(height.Name,height);
            item.Add(weight.Name,weight);
            item.Add(ganpower.Name,ganpower);
            set = new HealthCheckSet("入学体检",item);
            set.SumPirce();
            allset.Add("入学体检",set);
              
        }
//如果套餐为入学体检  两个文本的实现以及DGV里的数据

 public void inset() {
            this.comlist.Items.Clear();
            this.comlist.Items.Add("请选择");
            foreach(string item in allset.Keys){
                this.comlist.Items.Add(item);
            }
            this.comlist.SelectedIndex = 0;
        }
//向套餐选择框里添加数据
 string name = this.comlist.Text;
            if(name=="请选择"){
                this.dgvmess.DataSource = new BindingList<HealthCheckitem>();
                this.lblna.Text = "";
                this.lblprices.Text = "";
                return;
            }
            this.lblna.Text = name;
            this.lblprices.Text = allset[name].Price.ToString();
            UpdateSet(allset[name]);

//下拉框改变时数据发生的改变

            if(this.commenu.SelectedIndex==0){
                MessageBox.Show("请选择项目");
                return;
            }
            string name = this.comlist.Text;
            if(name=="请选择"){
                MessageBox.Show("请选择套餐");
                return;
            }
            if (!allset[name].Items.Keys.ToList().Contains(this.commenu.Text))
            {
                allset[name].Items.Add(this.commenu.Text, alitem[this.commenu.Text]);
                allset[name].SumPirce();
                this.lblna.Text = name;
                this.lblprices.Text = allset[name].Price.ToString();
                UpdateSet(allset[name]);
            }
            else {
                MessageBox.Show("该项已存在");
            }
//非空验证及向DGV里添加数据

            if (this.txtName.Text.Trim() != null)
            {
                HealthCheckSet set = new HealthCheckSet();
                allset.Add(this.txtName.Text.Trim(), set);
                inset();
                this.comlist.SelectedIndex = allset.Count;
                set.SumPirce();
            }
            else {
                MessageBox.Show("输入添加的套餐");
            }
//添加套餐 及已存在的事件的判断
 string name = this.dgvmess.SelectedRows[0].Cells["name"].Value.ToString();
            string healthname = this.comlist.Text;
            allset[healthname].Items.Remove(name);
            UpdateSet(allset[healthname]);
            set.SumPirce();
            this.lblprices.Text = allset[healthname].Price.ToString();

//删除事件




猜你喜欢

转载自blog.csdn.net/qq_39799629/article/details/79026985
今日推荐