深入.NET 第七章上机2上机3 员工工作
2017-03-02 13:15
253 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using Syst
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; name
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 上机2__员工工作
{
public abstract class Job
{
public string Type { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Job(string type, string name, string descrription)
{
this.Type = type;
this.Name = name;
this.Description = descrription;
}
public abstract string Show();
public Job()
{
}
public abstract void Execute();
}
}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 上机2__员工工作
{
class PM : Employee
{
public PM(string id, string name, int age, Gender gender, int yearOfExperience, List<Job> list)
: base(id, age, name, gender, list)
{
this.YearOfExperience = yearOfExperience;
}
public PM() { }
/// <summary>
/// 资历
/// </summary>
private int _yearOfExperience;
public int YearOfExperience
{
get { return _yearOfExperience; }
set { _yearOfExperience = value; }
}
/// <summary>
/// 工作
/// </summary>
/// <returns></returns>
public override string DoWork()
{
string message = this.Name + ":管理员工完成工作内容!";
return message;
}
}
}
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace 上机2__员工工作 { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 上机2__员工工作
{
/// <summary>
/// 程序员类
/// </summary>
class SE:Employee
{
/// <summary>
/// 带参构造函数
/// </summary>
/// <param name="id">工号</param>
/// <param name="name">姓名</param>
/// <param name="age">年龄</param>
/// <param name="gender">性别</param>
/// <param name="popularity">人气值</param>
public SE(string id,string name,int age, Gender gender, int popularity,List<Job> list): base(id,age, name,gender,list)
{
this.Popularity = popularity;
}
public SE() { }
/// <summary>
/// 人气值
/// </summary>
private int _popularity;
public int Popularity
{
get { return _popularity; }
set { _popularity = value; }
}
/// <summary>
/// 工作
/// </summary>
/// <returns></returns>
public override string DoWork()
{
StringBuilder sb = new StringBuilder();
sb.Append(this.Name+":\n");
for (int i = 0; i < this.WorkList.Count; i++ )
{
sb.Append((i + 1) + "、" + WorkList[i].Name + ":" + WorkList[i].Description+"\n");
}
return sb.ToString();
}
}
}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 上机2__员工工作
{
public class TestJob:Job
{
public TestJob(string type, string name, string desc) : base(type,name,desc)
{
}
public TestJob(){}
public int CaseNum { get; set; }
public int FindBugs { get; set; }
public int WorkDay { get; set; }
public override void Execute()
{
Form3 f3=new Form3(this);
f3.ShowDialog();
}
public override string Show()
{
this.CaseNum = 200;
this.Description = "代码";
this.FindBugs = 9;
this.WorkDay = 5;
string info = string.Format("编写用例个数:{0}\n发现的Bug数量:{1}\n工作日:{2}", this.Name, this.CaseNum, this.FindBugs, this.WorkDay);
return info;
}
}
}
space 上机2__员工工作{ public enum Gender { 男,女 }}
em.Linq;using System.Security.Cryptography.X509Certificates;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace 上机2__员工工作{ public partial class Form3 : Form { TestJob job=new TestJob(); public Form3(TestJob testJob) { InitializeComponent();
} private void button1_Click(object sender, EventArgs e) { bool isError = false; try { job.CaseNum = Int32.Parse(this.textBox1.Text.ToString()); job.FindBugs = Int32.Parse(this.textBox2.Text.ToString()); job.WorkDay = Int32.Parse(this.textBox3.Text.ToString());
} catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } if (!isError) { MessageBox.Show("提交成功", "提示"); this.Close(); } } private void Form3_Load(object sender, EventArgs e) { textBox1.Text = "200"; textBox2.Text = "6"; textBox3.Text = "225";
} private void button2_Click(object sender, EventArgs e) { this.Close(); } }}
namespace 上机2__员工工作{ public class CodeJob:Job { public CodeJob(string type, string name, string desc) : base(type,name,desc) { } public CodeJob() { } public int CodingLines { get; set; } public int Bugs { get; set; } public int WorkDay { get; set; } public
override void Execute() { Form2 f2=new Form2(this); f2.ShowDialog(); } public override string Show() { this.CodingLines = 1000; this.Description = "代码"; this.Bugs = 9; this.WorkDay = 5; string info = string.Format("有效编码行数:{0}\n遗留问题:{1}\n工作日:{2}\n", this.CodingLines,
this.Bugs, this.WorkDay); return info; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 上机2__员工工作
{
public class Employee
{
public Employee()
{
}
public Employee(string id, int age, string name, Gender gender, List<Job> list)
{
this.Id = id;
this.Age = age;
this.Name = name;
this.Gender = gender;
this.WorkList = list;
}
public string Id
{
get;
set;
}
public string Name
{
get;
set;
}
public int Age
{
get;
set;
}
public Gender Gender
{
get;
set;
}
public List<Job> WorkList { get; set; }
public virtual string DoWork()
{
return "工作列表";
}
}
}
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using 交通工具; namespace 上机2__员工工作{ public partial class Form1 : Form { Employee _empl; public Form1() { InitializeComponent(); into(); UpdateJob(); this.groupBox1 4000 .Text = _empl.Name; } public void into() { List<Job> engineers = new List<Job>(); engineers.Add(new CodeJob("编码","编码","实现购物车模块")); engineers.Add(new CodeJob("编码", "编码基类", "完成项目基类编码")); engineers.Add(new CodeJob("测试", "压力测试", "测试项目以实现模块")); _empl=new SE("1120","哈哈",22,Gender.男,100,engineers); } public void UpdateJob() { this.dataGridView1.DataSource = _empl.WorkList; } private void Form1_Load(object sender, EventArgs e) { } private void 执行ToolStripMenuItem_Click(object sender, EventArgs e) { int index = this.dataGridView1.CurrentRow.Index; _empl.WorkList[index].Execute(); } private void 完成情况ToolStripMenuItem_Click(object sender, EventArgs e) { int index = this.dataGridView1.CurrentRow.Index; string info = _empl.WorkList[index].Show(); MessageBox.Show(info, "指标完成情况"); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 上机2__员工工作
{
public partial class Form2 : Form
{
public Form2(CodeJob codeJob)
{
InitializeComponent();
}
CodeJob job=new CodeJob();
private void button1_Click(object sender, EventArgs e)
{
bool isError = false;
try
{
job.CodingLines = Int32.Parse(this.textBox1.Text.ToString());
job.Bugs = Int32.Parse(this.textBox2.Text.ToString());
job.WorkDay = Int32.Parse(this.textBox3.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
this.Close();
}
if (!isError)
{
MessageBox.Show("提交成功", "提示");
this.Close();
}
}
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = "1000";
textBox2.Text = "6";
textBox3.Text = "25";
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
相关文章推荐
- 深入.NET 第七章上机4 给宠物看病
- 深入.NET平台 第四章 上机2 员工薪资
- ACCP7.0s2深入.net和c#第七章上机123
- 深入.NET 第七章 上机1 演奏
- 深入.NET平台和C#编程 第一章 概念+上机
- 深入.NET平台和C#编程 第二章 上机3 经理评分
- .NET 第六章 上机二 实现工作汇报
- 深入.NET平台和C#语言 第三章员工打卡
- 深入.NET平台和C#编程第二张上机练习2
- 深入.NET 第二章 上机练习1
- 深入.NET 第四章 上机4 点餐
- 深入.NET 第四章上机3 模拟小汽车
- accp7.0S2深入.net和c#第三章上机123
- 深入.NET 第六章 上机1
- 深入.NET 第六章 上机4
- 深入.NET 第二章 上机练习2
- accp7.0S2深入.NET和C#第二章上机3
- 深入.NET和C#第二章上机3
- ACCP7.0S2深入.NET和C#编程第二章上机1,2
- ACCP7.0S2深入.net和c#第6章上机练习