Comprehensive version of the medical Checkup package management System

Source: Internet
Author: User

Steps:

Define several classes:

Healthcheckitem class: Checking items

Property:

    Public string Get Set ; }          Public int Get Set ; }          Public string Get set; }

Methods in the Healthcheckitem class:

  // When you select a package in the Package drop-down box, all of the check items under the package are added to the dgvlist display         Public Healthcheckitem (stringintstring  description)        {            = name;             = Price ;             = description;        }

Main interface:

   //define multiple check itemsHealthcheckitem M,HG, WG, SG, HR, LF, eg, BA, BP, BT; //Define system Default check plan "Entrance examination";Healthcheckset SetA; //use generic collection list to save all medical itemsListNewList(); //Use the generic collection list to save the medical items in the packagelistNewList(); //Save a package collection using a two-column collection (dictionary)         Publicdictionary<string, healthcheckset> HS =Newdictionary<string, healthcheckset> ();

Healthcheckset Class: Medical Package

Property:

   Public int Get set; }//ItemProperty Check the price of the project and public        stringgetset;}          Public Get set; }//items is a collection of Healthcheckitem,

Methods in the Healthcheckset class:

   Public Healthcheckset ()        {            new list();        }          Public Healthcheckset (string name, list items)        {            = name;             = items;        }

How to get the price:

   // How to get the price         Public void CalcPrice ()        {            int0;             foreach inch Items)            {                = Tatolprice + item. Price;            }             // the price of the package is equal to the price of each medical item and            Price = tatolprice;        }

Add a new package:

  //Add a new plan        Private voidbtnAdd_Click (Objectsender, EventArgs e) {            if(TxtName.Text.Equals ("") {MessageBox.Show ("Please enter the package name!"); }            Else{Healthcheckset HC=NewHealthcheckset (); Hs.                ADD (txtName.Text, HC); //Reload Package drop-down box information methodinitiatehealthsetlist (); Cbolist.selectedindex=HS.                Count (); Lblname. Text=Cbolist.text; Hc. Name=Cbolist.text; MessageBox.Show ("Add success!"); }        }

Load Package drop-down box information:

 Private voidinitiatehealthsetlist () {//Load Package drop-down box information//Empty the drop-down box list firstcboList.Items.Clear (); //Add Please selectCBOLIST.ITEMS.ADD ("Please select"); //binds the key value of the dictionary to the drop-down box, the value that is displayed as a drop-down box            foreach(stringKinchHS.            Keys) {cboList.Items.Add (k); }            //default first item is selectedCbolist.selectedindex =0; }

Initialize the check item:

New Healthcheckitem (" height  " to check height "new" Healthcheckitem (" weight  " " for Weight check ")  ); AllItems. Add (Hg); AllItems. ADD (WG);

To add a check item:

  //Add a check item        Private voidBtnok_click (Objectsender, EventArgs e) {            if(CboProject.Text.Equals ("Please select")|| CboProject.Text.Equals ("") {MessageBox.Show ("Please select a project"); return; }                    if(Cbolist.text = ="Please select") {MessageBox.Show ("Please select a package"); return; }            //List<t>. Contains (object) to determine whether an object is in the collection            if(!Hs[cbolist.text]. Items.contains (Allitems[cboproject.selectedindex])) {//add Check item Hs[cbolist.text].                Items.Add (Allitems[cboproject.selectedindex]); //Recalculate Total PriceHs[cbolist.text].               CalcPrice (); //UpdateUpdateset (Hs[cbolist.text]); //Refresh Form collection nameLblname. Text =Hs[cbolist.text].                Name; // //Refresh the form collection priceLblprice. Text =Hs[cbolist.text].                Price.tostring (); MessageBox.Show ("Add Success"); }            Else{MessageBox.Show ("the project already exists"); }        }

To delete your health plan information:

  //Delete Information        Private voidBtndelete_click (Objectsender, EventArgs e) {            if( This. DgvInfo.SelectedRows.Count = =0) {MessageBox.Show ("Please select a row to delete"); return; }            //Find Index            intindex = dgvinfo.selectedrows[0].            Index; //Delete the check item data//Generic collection method for deleting items: RemoveAt ();Hs[cbolist.text].            Items.removeat (index); //Recalculate PricesHs[cbolist.text].            CalcPrice (); //Update dgvlist DataUpdateset (Hs[cbolist.text]); Lblname. Text=Seta.name; stringChoS =Cbolist.text; Lblprice. Text=Hs[chos].        Price.tostring (); }

Fill in the dgvlist of the package, update the package check item

  // fill in the dgvlist of the package, update the package check item        Private void Set         {            new bindinglistset). Items);        }

This is simple and clear-----------------------------------

Comprehensive version of the medical Checkup package management System

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.