Project Manager score, Project Manager Score Table

Source: Internet
Author: User

Project Manager score, Project Manager Score Table

This knowledge is used for project manager scoring.

1. How to call a method? 2. Use of value type and Application Type 3. Object Array 4. Transfer Data between forms

The form is as follows:

When you run the employee list form, the data is automatically stored on the form.

When you double-click an employee's information, the score form is displayed.

Score form. You can enter the data. When you press the score button, the data is updated on the employee list form.

Main Implementation ideas:

1. Create the SE class

Attribute:

 1  public class SE 2     { 3         private string assess; 4  5         public string Assess 6         { 7             get { return assess; } 8             set { assess = value; } 9         }10         private int score;11 12         public int Score13         {14             get { return score; }15             set { score = value; }16         }17      18         public int Id { get; set; }19         public string Name { get; set; }20         public int Age { get; set; }21     22     }

2. Create a PM class

1 public class PM2 {3 // assess: Evaluate 4 public void Judge (SE se, string assess, int score) {5 se. assess = assess; 6 se. score = score; 7 8} 9}

3. Main code in the employee list form

1 public partial class FrmShow: Form 2 {3 public FrmShow () 4 {5 InitializeComponent (); 6 this. updateView (); 7} 8 public SE [] engineers = new SE [3]; 9 // bind data 10 public void UpdateView () {11 lvlist. items. clear (); 12 engineers [0] = new SE (); 13 engineers [0]. id = 111; 14 engineers [0]. name = "Wang xiaomao"; 15 engineers [0]. age = 26; 16 engineers [0]. assess = "not evaluated"; 17 engineers [0]. score = 0; 18 engineers [1] = new SE (); 19 engineers [1]. id = 112; 20 engineers [1]. name = "Zhou Xinyu"; 21 engineers [1]. age = 22; 22 engineers [1]. assess = "not evaluated"; 23 engineers [1]. score = 0; 24 engineers [2] = new SE (); 25 engineers [2]. id = 113; 26 engineers [2]. name = "Zhang Ye"; 27 engineers [2]. age = 30; 28 engineers [2]. assess = "not evaluated"; 29 engineers [2]. score = 0; 30 for (int I = 0; I <engineers. length; I ++) 31 {32 ListViewItem item = new ListViewItem (); 33 ListViewItem lv = new ListViewItem (engineers [I]. id. toString (); 34 lv. subItems. add (engineers [I]. name); 35 lv. subItems. add (engineers [I]. age. toString (); 36 lv. subItems. add (engineers [I]. assess); 37 lv. subItems. add (engineers [I]. score. toString (); 38 this. lvlist. items. add (lv); 39 lvlist. items. add (item); 40} 41} 42 // double-click the listview control. The Frmjudege form 43 private void lvlist_DoubleClick (object sender, EventArgs e) is displayed) 44 {45 // obtain the currently selected SE del object 46 if (this. lvlist. selectedItems. count = 0) 47 {48 return; // you must first select a 49 50} 51 int index = 0; 52 for (int I = 0; I <engineers. length; I ++) 53 {54 if (engineers [I]. id. equals (this. lvlist. selectedItems [0]. text. trim () 55 {56 index = I; 57 break; 58} 59} 60 // score 61 FrmJudge frm = new FrmJudge (this, index) for the selected object ); 62 frm. show (); 63 64}

4. Code in the score form

1 public partial class FrmJudge: Form 2 {3 public FrmJudge () 4 {5 InitializeComponent (); 6} 7 // Save the instance 8 private FrmShow myParent of the parent Form; 9 // The employee object to be evaluated 10 private SE; 11 public FrmJudge (FrmShow fparent, int index) {12 InitializeComponent (); 13 this. myParent = fparent; 14 this. se = myParent. engineers [index]; 15} 16 private void FrmJudge_Load (object sender, EventArgs e) 17 {18 // form loading, display the name and score of the employee to be evaluated 19 this. t Xtname. text = se. name; 20 this.txt mark. text = se. assess; 21 this.txt Score. text = se. score. toString (); 22} 23 24 private void btnScore_Click (object sender, EventArgs e) 25 {26 // se. score = Convert. toInt32 (txtScore. text); 27 // se. assess = txtmark. text; 28 try29 {30 PM = new pm (); 31 PM. judge (se, this.txt mark. text. trim (), Int32.Parse(this.txt Score. text. trim (); 32 this. myParent. updateView (); // refresh the main form 33 thi S. Close (); 34} 35 catch (Exception) 36 {37 MessageBox. Show ("score failed! "); 38} 39} 40 // cancel 41 private void btnCancel_Click (object sender, EventArgs e) 42 {43 this. Close (); 44} 45 46}

This is the end of the process. Please try again later.

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.