C#之经理评分系统
PM类,几乎全是属性
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace 上机练习三
{
class PM
{
private string id; public string Id
{
get { return id; }
set { id = value; }
}
private int age; public int Age
{
get { return age; }
set { age = value; }
}
private string name; public string Name
{
get { return name; }
set { name = value; }
}
private string sex; public string Sex
{
get { return sex; }
set { sex = value; }
}
private string longevity; public string Longevity
{
get { return longevity; }
set { longevity = value; }
} public static void score(SE se,string judge,int score) {
se.Judge = judge;
se.Score = score; } //初始化 public static void IniaitlInfo()
{
SE s1 = new SE();
s1.Id = "";
s1.Name = "二狗子";
s1.Judge = "";
s1.Age = ;
s1.Score = ;
SE.se[] = s1; SE s2 = new SE();
s2.Id = "";
s2.Name = "三狗子";
s2.Judge = "";
s2.Age = ;
s2.Score = ;
SE.se[] = s2; SE s3 = new SE();
s3.Id = "";
s3.Name = "五狗子";
s3.Judge = "";
s3.Age = ;
s3.Score = ;
SE.se[] = s3;
} }
}
添加窗体上的代码
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 第三章_上机练习一_考勤管理
{
public partial class FrmAdd : Form
{
public FrmAdd()
{
InitializeComponent();
} public Form1 main;
private void button1_Click(object sender, EventArgs e)
{ string id = textBox1.Text.Trim();
string name = textBox2.Text.Trim();
string age = textBox3.Text.ToString().Trim();
string sex = comboBox1.Text.Trim(); SE pr = new SE(); sex = "男";
if (sex == "女") {
sex = "女";
} try
{ foreach (SE item in SE.list)
{
if (item.Id.ToString() == id)
{
MessageBox.Show("你所输入的工号已经存在!!"); return;
}
else
{
pr.Id = Convert.ToInt32(textBox1.Text);
break;
}
}
}
catch
{
MessageBox.Show("网络异常!!1");
}
finally
{
pr.Name = name;
pr.Age = Convert.ToInt32(age);
pr.Sex = sex; SE.list.Add(pr); this.Close(); main.BindGrid(SE.list);
} } private void FrmAdd_Load(object sender, EventArgs e)
{ comboBox1.Items.Add("男");
comboBox1.Items.Add("女");
} }
}
SE类中属性
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace 上机练习三
{
public class SE
{
private string id; public string Id
{
get { return id; }
set { id = value; }
}
private int age; public int Age
{
get { return age; }
set { age = value; }
}
private string name; public string Name
{
get { return name; }
set { name = value; }
}
private string sex; public string Sex
{
get { return sex; }
set { sex = value; }
}
private int score; public int Score
{
get { return score; }
set { score = value; }
} private int year; public int Year
{
get { return year; }
set { year = value; }
}
private string judge; public string Judge
{
get { return judge; }
set { judge = value; }
} public static SE[] se = new SE[]; public static int counter = ;
}
}
展示窗体的代码
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 上机练习三
{
public partial class FrmJudge : Form
{
public FrmJudge()
{
InitializeComponent();
} public void FrmJudge_Load(object sender, EventArgs e)
{ if (SE.counter==)
{
PM.IniaitlInfo();
}
SE.counter++;
UpdateView(SE.se); } //绑定数据
public void UpdateView(SE[] se)
{
listView1.Items.Clear(); for (int i = ; i <se.Length; i++)
{
ListViewItem item = new ListViewItem(se[i].Id);
item.SubItems.Add(se[i].Name);
item.SubItems.Add(se[i].Age.ToString());
item.SubItems.Add(se[i].Judge);
item.SubItems.Add(se[i].Score.ToString());
listView1.Items.Add(item);
} } private void listView1_DoubleClick(object sender, EventArgs e)
{
if (this.listView1.SelectedItems.Count==)
{
return;
} string name= listView1.SelectedItems[].SubItems[].Text;
string judge = listView1.SelectedItems[].SubItems[].Text;
string score = listView1.SelectedItems[].SubItems[].Text;
string id = listView1.SelectedItems[].SubItems[].Text; ListViewItem lvlistitem = listView1.SelectedItems[]; Frm f = new Frm();
f.name = name;
f.judge = judge;
f.score = score;
f.id=id;
f.lv = lvlistitem;
f.Show();
}
}
}
添加的窗体
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 上机练习三
{
public partial class Frm : Form
{
public Frm()
{
InitializeComponent();
} public ListViewItem lv;
public string name;
public string judge;
public string score;
public string id;
private void Frm_Load(object sender, EventArgs e)
{
textBox1.Text= name;
textBox2.Text= judge;
textBox3.Text = score;
} private void button1_Click(object sender, EventArgs e)
{
Stored(SE.se); } public void Stored(SE [] se) { if (textBox2.Text.Trim() == "" || textBox3.Text.Trim() == "")
{
MessageBox.Show("你的评价或者是得分还未更改!!!");
return;
} // MessageBox.Show(lv.SubItems[3].Text); for (int i = ; i < se.Length; i++)
{
if (se[i].Id==id)
{
se[i].Judge = textBox2.Text.Trim();
se[i].Name = textBox1.Text.Trim(); if (isNaN(textBox3.Text.Trim())==true)
{
se[i].Score = Convert.ToInt32(textBox3.Text.Trim());
}
else
{
MessageBox.Show("你评价的分数格式不对,请再次来评价员工分数!!!");
return;
}
lv.SubItems[].Text = textBox3.Text;
lv.SubItems[].Text = textBox2.Text;
lv.SubItems[].Text = textBox1.Text;
MessageBox.Show("评价成功!!!");
break;
}
} } public bool isNaN(string temp) { for (int i = ; i <temp.Length; i++)
{
byte tempByte = Convert.ToByte(temp[i]); //设置byte格式
if ((tempByte<) || (tempByte>)) //如果改tempByte不在范围内
{
return false;
} } return true;
} }
}
评分系统完成了,我们下回再见!!!!!!!
C#之经理评分系统的更多相关文章
- 用C#写经理评分系统
先写需求: 01.显示员工信息 02.实现项目经理给员工评分的功能 第一步: 建立两个类,员工类和项目经理类 定义属性和方法 员工类:工号.年龄.姓名.人气值.项 ...
- 原生JS实现-星级评分系统
今天我又写了个很酷的实例:星级评分系统(可自定义星星个数.显示信息) sufuStar.star();使用默认值5个星星,默认信息 var msg = [........]; sufuStar.sta ...
- 使用C# WinForm窗体制作经理评分项目 ——S2 2.2
在窗口加载时初始化三个员工对象 用数组存放 这是员工类的大致字段和属性. 在FrmMain中给对象数组附初值 以上 FrmMain中用一个ListView控件展示员工信息,通过以上代码将对象数组中的内 ...
- 美国FICO评分系统简介
美国的个人信用评分系统,主要是Fair IsaacCompany 推出的 FICO,评分系统也由此得名.一般来讲, 美国人经常谈到的你的得分 ,通常指的是你目前的FICO分数.而实际上, Fair I ...
- 数组练习:各种数组方法的使用&&事件练习:封装兼容性添加、删除事件的函数&&星级评分系统
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 基于python 信用卡评分系统 的数据分析
基于python 信用卡评分系统 的数据分析 import pandas as pd import matplotlib.pyplot as plt #导入图像库 from sklearn.ensem ...
- Mahout分布式运行实例:基于矩阵分解的协同过滤评分系统(一个命令实现文件格式的转换)
Apr 08, 2014 Categories in tutorial tagged with Mahout hadoop 协同过滤 Joe Jiang 前言:之前配置Mahout时测试过一个简 ...
- 第二章《深入C#数据类型》项目经理评分
一:创建MyOffices项目,创建UserInfo类,用来存储员工 工号,姓名,年龄,评价,年度得分 二:创建查看评分窗体(frmShow),添加定义员工数组,将员工数据绑定到frmShow窗体的L ...
- 02章《深入C#数据类型》项目经理评分
一:创建MyOffices项目,创建UserInfo类,用来存储员工 工号,姓名,年龄,评价,年度得分 二:创建查看评分窗体(frmShow),添加定义员工数组,将员工数据绑定到frmShow窗体的L ...
随机推荐
- 基础:Post和Get区别
1.get是从服务器上获取数据,post是向服务器传送数据.2.在客户端, get方式在通过URL提交数据,数据在URL中可以看到:post方式,数据放置在HTML HEADER内提交3.对于get方 ...
- c/c++排坑(2) -- c语言中的符号重载
所谓的符号重载就是在不同的上下文环境里有不同的意义.甚至有些关键字也被重载而具有好几种意义,这也是C语言的作用域规则对程序员不那么清晰的主要原因. 本章内容摘自<c专家编程>P37. 大家 ...
- Eclipse中使用struts标签时出错
原因是Action和ActionForm对应文件中没有继承相应的类,具体来说: ActionForm的编写: 必须继承org.apache.struts.action.ActionForm Actio ...
- LeetCode 712. Minimum ASCII Delete Sum for Two Strings
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. ...
- Anton and Permutation
Anton and Permutation time limit per test 4 seconds memory limit per test 512 megabytes input standa ...
- ubuntu 14.04 gcc/g++版本降低
Matlab 2014a支持的gcc/g++版本是4.7x,而ubuntu 14.04以及更高版本默认安装的版本都是4.8及以上,因此需要降低gcc/g++版本,方法如下: 1 安装 $ sudo a ...
- 暑假集训D15总结
考试 日常爆炸= = T1数据背锅,回天乏力 推了两个小时的T2竟然莫名RE,我也是服了 T3考试时就没读懂题,做个鬼啊 今天一直在写某奇怪的技术贴,竟然没有写题解(手动滑稽) 希望明天不要乱炸吧 博 ...
- hdu 4941 stl的map<node,int>用法
#include<iostream> #include<cstdio> #include<cstring> #include<map> using na ...
- Spring MVC-集成(Integration)-生成XML示例(转载实践)
以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_xml.htm 说明:示例基于Spring MVC 4.1.6. 以下示例说明如何 ...
- GDB 调试 PHP文件
http://www.bo56.com/%E5%9C%A82016%E7%9A%84phpcon%E5%A4%A7%E4%BC%9A%E4%B8%8A%E7%9A%84%E5%88%86%E4%BA% ...