P2员工月度工作P160-P163

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了P2员工月度工作P160-P163相关的知识,希望对你有一定的参考价值。

技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace WindowsFormsApplication2.Entity
 8 {
 9     //编写类
10    public class CodeJob : Job
11     {
12        //编写代码行数
13         public int CodingLines { get; set; }
14        //多少个BUG
15         public int Bugs { get; set; }
16        //工作日
17         public int WorkDay { get; set; }
18 
19         //重学Execute方法
20         public override void Execute()
21         {
22             frmCode code = new frmCode(this);
23             code.ShowDialog();
24         }
25        //重学show方法
26         public override string show() {
27             return "有效编码行数:" + CodingLines.ToString() + "\n遗留问题:" + Bugs.ToString() + "\n工作日"+WorkDay.ToString();
28         }
29     }
30 }
编写代码类
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace WindowsFormsApplication2.Entity
 8 {
 9     //工作类
10   public abstract class Job
11     {
12       //工作类型
13       public string type { set; get; }
14       //工作名称
15       public string Name { set; get; }
16       //工作详情
17       public string Description { set; get; }
18       //创建抽象方法
19       public abstract void Execute();
20       public abstract string show();
21 
22     }
23     
24 }
工作类
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace WindowsFormsApplication2.Entity
 8 {
 9   public  class SE
10     {
11       //员工名字
12         public string name { set; get; }
13       //一个员工可以有多个工作
14         public List<Job> job { set; get; }
15 
16     }
17 }
员工类
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace WindowsFormsApplication2.Entity
 8 {
 9     //测试类
10    public  class TestJob:Job
11     {
12        //测试个数
13        public int CaseNum { set; get; }
14        //多少个BUG
15        public int FindBugs { set; get; }
16        //用时
17        public int WorkDay { set; get; }
18        //重写Execute方法
19         public override void Execute()
20     {
21         frmTest test = new frmTest(this);
22         test.ShowDialog();
23     }
24         //重写show方法
25         public override string show()
26         {
27             return "测试用例的个数:" + CaseNum.ToString()+"\n发现的Bug:"+FindBugs.ToString()+"\n用时"+WorkDay.ToString();
28         }
29 }
30 }
测试工作类
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Threading.Tasks;
 9 using System.Windows.Forms;
10 using WindowsFormsApplication2.Entity;
11 
12 namespace WindowsFormsApplication2
13 {
14     //编写窗口
15     public partial class frmCode : Form
16     {
17       
18         CodeJob cj;
19         
20         public frmCode()
21         {
22             InitializeComponent();
23         }
24         public frmCode(CodeJob j)
25         {
26             InitializeComponent();
27             this.cj = j;
28         }
29 
30         
31         //点击提交按钮
32         private void button1_Click(object sender, EventArgs e)
33         {
34            
35                 cj.Bugs= int.Parse(textBox2.Text);
36                 cj.CodingLines = int.Parse(textBox1.Text);
37                 cj.WorkDay = int.Parse(textBox3.Text);
38                 
39                 MessageBox.Show("提交成功");
40                 this.Close();
41            
42         }
43 
44        
45 
46        
47     }
48 }
编写窗口
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Threading.Tasks;
 9 using System.Windows.Forms;
10 using WindowsFormsApplication2.Entity;
11 //测试工作窗口
12 namespace WindowsFormsApplication2
13 {
14     public partial class frmTest : Form
15     {
16         public frmTest()
17         {
18             InitializeComponent();
19         }
20         TestJob j;
21         //添加一个沟造函数
22         public frmTest(TestJob j) {
23             this.j = j;
24             InitializeComponent();
25         }
26         //点击提交的按钮
27         private void button1_Click(object sender, EventArgs e)
28         {
29             j.CaseNum = int.Parse(textBox1.Text);
30             j.FindBugs = int.Parse(textBox2.Text);
31             j.WorkDay = int.Parse(textBox3.Text);
32             MessageBox.Show("提交成功");
33             this.Close();
34         }
35 
36        
37 
38        
39     }
40 }
测试工作窗口
技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Threading.Tasks;
 9 using System.Windows.Forms;
10 using WindowsFormsApplication2.Entity;
11 
12 namespace WindowsFormsApplication2
13 {
14     public partial class list : Form
15     {
16         public list()
17         {
18             
19             InitializeComponent();
20         }
21        
22        //创建一个员工对象
23        public SE s = new SE();
24         //创建一个工作类(job)的list
25        public List<Job> job = new List<Job>();
26         private void list_Load(object sender, EventArgs e)
27         {
28             
29             //向JOB中添加数据
30             job.Add(new CodeJob() {type="编码",Name="编码1",Description="写代码",Bugs=1,CodingLines = 1,WorkDay = 1});
31             job.Add(new CodeJob() { type = "编码", Name = "编码1", Description = "写代码", Bugs = 2, CodingLines = 2, WorkDay = 2 });
32             job.Add(new TestJob() {type="测试",Name="测试1",Description="测试软件" });
33 
34             s.job = job;
35             s.name = "叼汉阳";
36             dataGridView1.DataSource = job;
37             groupBox1.Text = s.name;
38 
39         }
40         /// <summary>
41         /// 右键菜单的执行项
42         /// </summary>
43         /// <param name="sender"></param>
44         /// <param name="e"></param>
45         private void 执行ToolStripMenuItem_Click(object sender, EventArgs e)
46         {
47             //提取当前选中的dataGridView1index
48             int iten = dataGridView1.CurrentRow.Index;
49             
50             s.job[iten].Execute();
51             
52         }
53        
54        /// <summary>
55        /// 右键菜单的完成情况项
56        /// </summary>
57        /// <param name="sender"></param>
58        /// <param name="e"></param>
59         private void 完成情况ToolStripMenuItem_Click(object sender, EventArgs e)
60         {
61             //提取当前选中的dataGridView1index
62             int iten = dataGridView1.CurrentRow.Index;
63 
64            MessageBox.Show( job[iten].show());
65         }
66     }
67 }
工作列表窗口

 

以上是关于P2员工月度工作P160-P163的主要内容,如果未能解决你的问题,请参考以下文章

每个员工的月度结果

django配置发送邮箱

3步轻松申请邮箱账号,申请163vip邮箱

N的阶乘 mod P

结对项目之需求分析与原型设计

流量管理技术