码迷,mamicode.com
首页 > 其他好文 > 详细

三层架构

时间:2017-03-17 23:31:17      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:.exe   技术   begin   val   visual   label   ++   blog   1.5   

1、计划

 

计划时间

实际完成时间

估计任务需要时间

7天

 

需求分析

10min

 

生成设计文档

30min

 

设计复审

1h

 

代码规范

20min

 

具体设计

3h

 

具体编码

5day

 

代码复审

1h

 

测试

1h

 

测试报告

30min

 

计算工作量

30min

 

事后总结并提出过程改进计划

 

 

2、

开发
   需求分析
      作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况。
    生成设计文档

技术分享

 设计复审

技术分享

代码规范
  SQL server2008、Visual Studio2010

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

private static readonly string constr = ConfigurationManager.ConnectionStrings["itcast"].ConnectionString;
public static int ExecuteNonQuery(string sql,params SqlParameter[] pms)
{
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(sql, con))
{
if (pms != null)
{
cmd.Parameters.AddRange(pms);

}
con.Open();
return cmd.ExecuteNonQuery();
}
}

}
public static object ExecuteScalar(string sql,params SqlParameter[] pms)
{
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(sql, con))
{
if (pms != null)
{
cmd.Parameters.AddRange(pms);

}
con.Open();
return cmd.ExecuteScalar();
}
}
}
public static SqlDataReader ExecuteReader(string sql, params SqlParameter[] pms)
{
SqlConnection con = new SqlConnection(constr);
using (SqlCommand cmd = new SqlCommand(sql, con))
{
if (pms != null)
{
cmd.Parameters.AddRange(pms);

}
try
{
con.Open();
return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
}
catch(Exception)
{
con.Close();
con.Dispose();//释放所有资源
throw;
}
}
}
public static DataTable ExecuteDataTable(string sql, params SqlParameter[] pms)
{
DataTable dt = new DataTable();
using (SqlDataAdapter adapter = new SqlDataAdapter(sql, constr))
{
if (pms != null)
{
adapter.SelectCommand.Parameters.AddRange(pms);

}
adapter.Fill(dt);
}
return dt;
}

}

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Model;


namespace sceneJiFenDAL
{

public class BeginDal
{

public int Insert(Fen fen)
{
string sql = "insert into Fen values(@TeamA,@ADeFen,@TeamAFenName,@TeamB,@BDeFen,@TeamBFenName)";
SqlParameter[] paras = new SqlParameter[]{
new SqlParameter("@TeamA",fen.TeamA),
new SqlParameter("@TeamAFenName",fen.TeamAFenName),
new SqlParameter("@TeamA",fen.TeamB),
new SqlParameter("@TeamAFenName",fen.TeamBFenName)
};
int count = SqlHelper.ExecuteNonQuery(sql,paras);
return count;
}
public List<Fen> SelectAllFen()
{
string sql = "select * from Fen";
List<Fen> fenlist = new List<Fen>();
using (SqlDataReader reader = SqlHelper.ExecuteReader(sql))
{
if(reader.HasRows)
{
while (reader.Read())
{
Fen fen = new Fen();
fen.TeamA = reader.GetString(1);
fen.ADeFen = reader.GetString(2);
fen.TeamAFenName = reader.GetString(3);
fen.TeamB = reader.GetString(4);
fen.BDeFen = reader.GetString(5);
fen.TeamBFenName = reader.GetString(6);
fenlist.Add(fen);
}

}
}
return fenlist;
}

}
}

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using sceneJiFenDAL;

namespace sceneJiFenBLL
{
public class FenBLL
{
BeginDal dal = new BeginDal();
public bool Insert(Fen fen)
{

return dal.Insert(fen) > 0;
}
public List<Fen> GetAllFen()
{
return dal.SelectAllFen().Count > 0 ? dal.SelectAllFen() : null;
}
}
}

 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Model;
using sceneJiFenBLL;


namespace sceneJiFen
{
public partial class One : Form
{
public One()
{
InitializeComponent();
}
int Adefen=0;
int Bdefen = 0;
private FenBLL bll = new FenBLL();
private void button1_Click(object sender, EventArgs e)
{
Adefen++;
Fen fen=new Fen();
fen.TeamA=label1.Text;
fen.TeamB = label2.Text;
fen.ADeFen = Adefen.ToString();
if (radioBtn2.Checked == true)

fen.TeamAFenName = radioBtn2.Text;
}

if (radioButton2.Checked == true)
{
fen.TeamAFenName = radioButton2.Text;
}
if (radioButton3.Checked == true)
{
fen.TeamAFenName = radioButton3.Text;
}
if (radioButton14.Checked == true)
{
fen.TeamAFenName = radioButton14.Text;
}
if (radioButton6.Checked == true)
{
fen.TeamAFenName = radioButton6.Text;
}
if (radioButton5.Checked == true)
{
fen.TeamAFenName = radioButton5.Text;
}
if (radioButton4.Checked == true)
{
fen.TeamAFenName = radioButton4.Text;
}
if (radioButton13.Checked == true)
{
fen.TeamAFenName = radioButton13.Text;
}

}

private void button2_Click(object sender, EventArgs e)
{
Bdefen++;
Fen fen = new Fen();
fen.TeamA = label1.Text;
fen.TeamB = label2.Text;
fen.BDeFen = Bdefen.ToString();
if (radioButton12.Checked == true)
{
fen.TeamAFenName = radioButton12.Text;
}

if (radioButton11.Checked == true)
{
fen.TeamAFenName = radioButton11.Text;
}
if (radioButton10.Checked == true)
{
fen.TeamAFenName = radioButton10.Text;
}
if (radioButton9.Checked == true)
{
fen.TeamAFenName = radioButton9.Text;
}
if (radioButton8.Checked == true)
{
fen.TeamAFenName = radioButton8.Text;
}
if (radioButton7.Checked == true)
{
fen.TeamAFenName = radioButton7.Text;
}

}

private void One_Load(object sender, EventArgs e)
{

}
}
}

最终测试结果

技术分享

计算工作量

 

 

计划时间

实际完成时间

估计任务需要时间

7天

 8day

需求分析

10min

 10,min

生成设计文档

30min

 45min

设计复审

1h

 2h

代码规范

20min

 10min

具体设计

3h

 5h

具体编码

5day

 6day

代码复审

1h

 30min

测试

1h

 1.5h

测试报告

30min

 10min

计算工作量

30min

 40min

事后总结并提出过程改进计划

 

 

 总结

好难啊,知识点一会不用就会忘,以后要学一步做一步

三层架构

标签:.exe   技术   begin   val   visual   label   ++   blog   1.5   

原文地址:http://www.cnblogs.com/152miaomiao/p/6569058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!