作业五
| 这个作业属于哪个课程 | 2022软件代码开发技术 |
|---|---|
| 这个作业要求在哪里 | 作业五 |
| 这个作业的目标 | 1.完成系统开发 2.完成系统测试 3.完成Alpha版本发布 |
代码开发
燃尽图

运行展示
CustomersController控制器代码
public class CustomersController : Controller
{
private readonly FSPContext _context;
public CustomersController(FSPContext context)
{
_context = context;
}
public async Task<IActionResult> Index()
{
CustomersModel model = new();
model.Customers = await _context.Customer.Select(c => c).ToListAsync();
List<string> types = new();
types.AddRange(await _context.Customer.Select(c => c.Type).Distinct().ToListAsync());
model.Types = new(types);
return View(model);
}
[HttpPost]
public async Task<IActionResult> Index(CustomersModel model)
{
model.Customers = model.Type.IsNullOrEmpty() ? await _context.Customer.Select(c => c).ToListAsync()
: await _context.Customer.Where(c => c.Type == model.Type).ToListAsync();
List<string> types = new();
types.AddRange(await _context.Customer.Select(c => c.Type).Distinct().ToListAsync());
model.Types = new(types);
return View(model);
}
public IActionResult Create()
{
return View();
}
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,Name,Type")] Customer customer)
{
if (ModelState.IsValid)
{
_context.Add(customer);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(customer);
}
public async Task<IActionResult> Edit(int? id)
{
if (id == null || _context.Customer == null)
{
return NotFound();
}
var customer = await _context.Customer.FindAsync(id);
if (customer == null)
{
return NotFound();
}
return View(customer);
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,Name")] Customer customer)
{
if (id != customer.Id)
{
return NotFound();
}
if (ModelState.IsValid)
{
try
{
_context.Update(customer);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!CustomerExists(customer.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(customer);
}
public async Task<IActionResult> Delete(int? id)
{
var customer = await _context.Customer.FindAsync(id);
if (customer != null)
{
_context.Customer.Remove(customer);
}
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
}
客户页

自由职业者页

项目页

测试
测试记录
本系统在测试过程中发现了以下Bug,并进行了修复。
| 类型 | 详细 | 修复结果 |
|---|---|---|
| 路由错误 | 无法访问到对应的mvc控制器 | 已修复 |
| 路由错误 | 无法访问到FrelancersController的Delete方法 | 已修复 |
| 页面错误 | 无法显示Bootstarp的样式 | 已修复 |
| 数据库错误 | 数据库查找出的Freelance对象的TimeTable为空 | 已修复 |
场景测试
管理员:希望结合分类管理数据库中的项目、客户和自由职业者,以及自由职业的联系方式和时间表。
测试矩阵
| 测试功能 | 测试点 | 预期结果 | Edge | FireFox | Chrome |
|---|---|---|---|---|---|
| 搜索项目分类 | 选择要搜索的分类并点击搜索 | 显示分类为选中分类的项目 | ✓ | ✓ | ✓ |
| 搜索客户分类 | 选择要搜索的分类并点击搜索 | 显示分类为选中分类的客户 | ✓ | ✓ | ✓ |
| 搜索自由职业者分类 | 选择要搜索的分类并点击搜索 | 显示分类为选中分类的自由职业者 | ✓ | ✓ | ✓ |
| 管理自由职业者时间表 | 输入开始时间、结束时间和详细的内容,点击添加按钮 | 时间表中出现了新的条目 | ✓ | ✓ | ✓ |
| 管理自由职业者的联系方式 | 输入联系方式的类型和具体内容 | 联系方式中加入了新的条目 | ✓ | ✓ | ✓ |
出口条件
当系统能正常搜索自由职业者、客户、项目的分类、管理自由职业者的联系方式和管理自由职业者时间表时认为该系统已满足出口条件,可发布Alpha版本
Alpha版本发布
功能说明
本系统主要包含以下功能:
- 搜索自由职业者分类
- 管理自由职业者的联系方式
- 搜索项目分类
- 搜索客户分类
- 管理自由职业者时间表
运行环境
本系统为B/S架构,浏览器端要求使用支持Bootstrap框架的浏览器进行访问,服务器端要求配置.NET 7运行环境。
安装方法
本系统发布的服务端基于SQL Server数据库,在部署服务端前应先在系统上安装SQL Server数据库服务,并运行提供的SQL文件对数据库进行设置,随后便可启动发布文件中的运行程序。
问题和限制
本系统计划仅于公司内部进行使用,未加入复杂的身份认证程序,在数据的安全性可能有所不足,需要进一步优化。
发布方式及发布地址
本系统的源代码以及发布版本发布于项目对应的Github仓库之中,可通过以下网址进行访问:https://github.com/B9E83DA8/FSP