思路定义几个类:HealthCheckItem类:检查项目属性: public string Description { get; set; } public int Price { get; set; } public string Name { get; set ...
思路
定义几个类:
HealthCheckItem类:检查项目
属性:
public get='_blank'>string Description { get; set; } public int Price { get; set; } public string Name { get; set; }
//当选择套餐下拉框中的套餐时,套餐下所有检查项目都添加到dgvlist中显示 public HealthCheckItem(string name, int price, string description) { Name = name; Price = price; Description = description; }
主界面:
public HealthCheckSet() { Items = new List<HealthCheckItem>(); } public HealthCheckSet(string name, List<HealthCheckItem> items) { Name = name; Items = items; }
获取价格的方法:
//添加新套餐 private void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text.Equals("")) { MessageBox.Show("请输入套餐名称!"); } else { HealthCheckSet hc = new HealthCheckSet(); hs.Add(txtName.Text, hc); // 调加载套餐下拉框信息方法 InitiateHealthSetList(); cboList.SelectedIndex = hs.Count(); lblname.Text = cboList.Text; hc.Name = cboList.Text; MessageBox.Show("添加成功!"); } }
加载套餐下拉框信息:
//添加检查项目 private void btnOk_Click(object sender, EventArgs e) { if (cboProject.Text.Equals("请选择")||cboProject.Text.Equals("")) { MessageBox.Show("请选择项目"); return; } if (cboList.Text == "请选择") { MessageBox.Show("请选择套餐"); return; } //List<T>.Contains(对象)可以判断某个对象是否在集合中 if (!hs[cboList.Text].Items.Contains(allitems[cboProject.SelectedIndex])) { //添加检查项目 hs[cboList.Text].Items.Add(allitems[cboProject.SelectedIndex]); //重新计算总价格 hs[cboList.Text].CalcPrice(); //更新 UpdateSet(hs[cboList.Text]); //刷新窗体集合名称 lblname.Text = hs[cboList.Text].Name; // //刷新窗体集合价格 lblprice.Text = hs[cboList.Text].Price.ToString(); MessageBox.Show("添加成功"); } else { MessageBox.Show("该项目已经存在"); } }
删除体检套餐信息:
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:体检套餐关键思路
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。