zoukankan      html  css  js  c++  java
  • 项目经理评分

    首先先创建员工类(SE)和项目经理类(PM)

    在员工类里面封装属性

    代码:

    //工号 public string ID { get; set; }         //姓名 public string  Name { get; set; }         //年龄 public int Age { get; set; }         //性别 public char Sex { get; set; }         //人气值 private int popularity = 0;         public int Popularity         {   get { return popularity; }   set { popularity = value; }         }

            //项目经理年度评分 private int score = 0;         public int Score         {   get { return score; }   set { score = value; }         }

            // 经理评价     private String assess = "未评价"; public String Assess         {   get { return assess; }   set { assess = value; }         }

    项目经理和员工类一样也是封装的属性(这里就不写了)

    就多了个方法

    代码:

    public void Judge(SE se, string assess, int score)         {             se.Assess = assess;             se.Score = score;         }

    属性写完了,接下来写评分窗体(frmShow)

    实现思路:

    首先添加定义员工数组,将员工数组绑定到frmShow窗体的ListView控件上,在Load事件中初始化3个员工信息

    代码:

    public SE[] engineers = new SE[3];         #region 窗体Load事件 private void FrmShow_Load(object sender, EventArgs e)         {   frmSe();   UpdataListView();                 }         #endregion

            #region 初始化 private void frmSe()         {   engineers[0] = new SE();   engineers[0].ID = "111";   engineers[0].Age = 26;   engineers[0].Name = "王小毛";   engineers[0].Sex = '男';

      engineers[1] = new SE();   engineers[1].ID = "112";   engineers[1].Age = 22;   engineers[1].Name = "周新雨";   engineers[1].Sex = '男';

      engineers[2] = new SE();   engineers[2].ID = "113";   engineers[2].Age = 30;   engineers[2].Name = "张桦";   engineers[2].Sex = '男';         }         #endregion

            #region 添加数据 public void UpdataListView()         {   lvAssess.Items.Clear(); //清空ListView里面的数据信息

                  for (int i = 0; i < engineers.Length; i++)   {     ListViewItem item = new ListViewItem();     item.Text = engineers[i].ID;     item.SubItems.Add(engineers[i].Name);     item.SubItems.Add(engineers[i].Age.ToString());     item.SubItems.Add(engineers[i].Assess.ToString());     item.SubItems.Add(engineers[i].Score.ToString());     lvAssess.Items.Add(item);   }         }         #endregion

    接下来就写评分了,

    双击ListView的事件单出评分窗口

    那么这里用到了数据传递,那么这么实现呢?

    代码:

    #region    ListView的 双击事件 private void lvAssess_DoubleClick(object sender, EventArgs e)         {   FrmJudge frm = new FrmJudge(); //调用评分窗体               frm.name = lvAssess.SelectedItems[0].SubItems[1].Text;   ListViewItem item = lvAssess.SelectedItems[0];   frm.myitem = item;   frm.Show();         }         #endregion

    思路:

    首先在评分窗体里面声明俩个共有的变量

    public string name;         public ListViewItem myitem;

    在Load的事件中给文本框赋值

    #region 窗体 private void FrmJudge_Load(object sender, EventArgs e)         {   txtName.Text = name;

      txtAssess.Text = myitem.SubItems[3].Text; 

                  txtScore.Text = myitem.SubItems[4].Text;         }         #endregion

    在评分完毕后的事件里面,从新给评价和年度得分赋值

    #region 评分响应事件 private void btnOK_Click(object sender, EventArgs e)         {

      myitem.SubItems[3].Text = txtAssess.Text;   myitem.SubItems[4].Text = txtScore.Text;   this.Close(); //关闭窗体 }         #endregion

    评完分以后

  • 相关阅读:
    小组自评、互评及反馈
    "一个程序员的生命周期"读后感
    阅读《构建之法》第10-12章
    阅读《构建之法》第8,9,10章
    冒泡算法程序分析树的评论
    1014 C语言文法定义与C程序的推导过程
    0917 实验一词法分析程序
    0909 我与编译原理不得不说的秘密
    复利计算器4
    复利及单利计算
  • 原文地址:https://www.cnblogs.com/superws/p/5373330.html
Copyright © 2011-2022 走看看