模块开发卷宗
1标题
软件系统名称:凌云办公系统
标识符:LYOA
程序编制员签名:电子商务一班第三组
修改完成日期: 20xx年6月13日
编排日期:20xx年6月15日
2模块开发情况表
1. 公司决策模块:该模块允许企业决策者决定各个主管部门的责任范围。
2. 部门决策模块: 该模块允许企业各个部门决策者,查看决策,撰写决策草案.审核决策草案。
3. 员工信息模块:该模块允许企业员工查看公司员工,添加入职人员信息,查看人员调动,查看离职人员信息。
4. 内部交流模块:该模块允许企业各个层次人员添加留言,表达个人观点。 3功能说明
本模块的功能,主要是输入、要求的处理、输出。可以从系统设计说明书中摘录。同时列出在软件需求说明书中对这些功能的说明的条款。 4设计说明
本组模块的设计考虑包括:
1.在系统设计说明书中有关对本模块设计考虑的叙述,包括本模块在软件系统中所处的层次,它同其他模块的接口;
2在程序设计说明书中有关对本模块的设计考虑,包括本模块的算法、处理流程、牵涉到的数据文卷设计限制、驱动方式和出错信息等; 3在编制目前已通过全部测试的源代码时实际使用的设计考虑。 1
5原代码清单
系统登陆验证代码:
protected void button1_click(object sender, EventArgs e) {
if (uname.Text == "" || upwd.Text == "") {
Response.Write("<script>alert('登陆名和密码不能为空!') </script>");
return;
}
else
{
string strName = uname.Text;
string strPwd = upwd.Text;
string sqlstr = "select * from Person where Person_UserName=''+@uname+'' and Person_Pwd=''+@pwd+''and Person_IsConfirm='true'";
SqlConnection conn = new SqlConnection ("server=localhost;Uid=sa;Pwd=123;database=OA");
SqlCommand cmd = new SqlCommand(sqlstr, conn); SqlParameter Uname = new SqlParameter("@uname", uname.Text);
SqlParameter Upwd = new SqlParameter("@pwd", upwd.Text);
cmd.Parameters.Add(Uname);
cmd.Parameters.Add(Upwd);
try
{
conn.Open();
DataTable dt = new DataTable(); dt.Load(cmd.ExecuteReader());
if (dt.Rows.Count == 0)
{
Response.Write("<script>alert('登陆名或密码错误,或未被审核 ') </script>");
return;
}
else
{
2
/lect * from CompanyDecision cd inner join Person ps on cd.Person_ID = ps.Person_ID inner join DepartMent dpt on ps.Dept_ID=dpt.Dept_ID
Session["UserLevel"] = dt.Rows[0] ["Person_Level"].ToString();
Session["Username"] = uname.Text;
Session["UserRname"] = dt.Rows[0] ["Person_RealName"].ToString();
Session["UserID"] = dt.Rows[0]["Person_ID"].ToString();
Session["DeptID"] = dt.Rows[0]["Dept_ID"].ToString();
Session["UserInform"] = dt.Rows[0] ["Person_Inform"].ToString();
//Session["Name"] = dt.Rows[0] ["Person_RealName"].ToString();
//Response.Write(Session["UserLevel"].ToString());
conn.Close();
Response.Redirect("~/main.aspx?user=" + Session ["UserID"]);
}
}
catch (Exception err)
{
Response.Write(err);
}
}
}
在main.aspx中用repeater分页显示公司决策,并有翻页模块:
public void bind()
{
string sqsl = "select * from CompanyDecision where Dept_ID='6' order by CD_ID DESC";
SqlConnection conn = new SqlConnection("server=localhost;Uid=sa;Pwd=123;Database=OA"); SqlCommand cmd = new SqlCommand(sqsl, conn);
conn.Open();
SqlDataReader drd = cmd.ExecuteReader();
DataTable dtb = new DataTable();
dtb.Load(drd);
conn.Close();
3
//Repeater1.DataSource = dtb;
//Repeater1.DataBind();
//分页实现
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dtb.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 9;
Repeater1.DataSource = pds;
pds.CurrentPageIndex = Convert.ToInt32(this.Ltl_Page.Text)-1;
Ltl_CountPage.Text = pds.PageCount.ToString();
Lbtn_FirstPage.Enabled = true;
Lbtn_PritPage.Enabled = true;
Lbtn_NextPage.Enabled = true;
Lbtn_LastPage.Enabled = true;
if(pds.CurrentPageIndex<1)
{
Lbtn_FirstPage.Enabled = false;
Lbtn_PritPage.Enabled = false;
}
Ddl_JumptPage.Items.Clear();
for (int i = 0; i < pds.PageCount; i++)
{
Ddl_JumptPage.Items.Add((i + 1).ToString());
}
if(pds.CurrentPageIndex==pds.PageCount-1)
{
Lbtn_NextPage.Enabled = false;
Lbtn_LastPage.Enabled = false;
}
Repeater1.DataBind();
Ddl_JumptPage.SelectedIndex = int.Parse(Ltl_Page.Text) - 1;
}
在点击CompanyDecision_Add.aspx中的Button后的保存语句:
protected void bt1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "" || TextBox2.Text == "")
{
Response.Write("<script>alert('标题|作者|连接不能为空!') 4
</script>");
return;
}
else
{
string dpt = Session["DeptID"].ToString();
string sqlcmd = "insert into CompanyDecision(CD_Title,CD_Content,Person_ID,CD_IsConfirm,CD_AddDate,CD_ConfirmDate,Dept_ID)values(@title,@content,@userid,'true','" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','" + dpt + "')";
int uid = Convert.ToInt32( Session["UserID"].ToString()); SqlConnection conn = new SqlConnection("Server=localhost;Uid=sa;Pwd=123;database=OA"); conn.Open();
SqlCommand cmd = new SqlCommand(sqlcmd, conn);
SqlParameter Ctitle = new SqlParameter("@title",TextBox1.Text);
SqlParameter Ccontent = new SqlParameter("@content",TextBox2.Text);
SqlParameter Uid = new SqlParameter("@userid",uid);
//SqlParameter Acont = new SqlParameter("@acont", TextArea1.Value);
cmd.Parameters.Add(Ctitle);
cmd.Parameters.Add(Ccontent);
cmd.Parameters.Add(Uid);
//cmd.Parameters.Add(Acont);
cmd.ExecuteNonQuery();
conn.Close();
Response.Write("<script>alert('保存成功!') </script>"); Response.Redirect("DecisionList.aspx");
}
}
在Product_Add.aspx(采购订单添加页面)的Button(保存按钮)的后台执行语句:
protected void bt1_Click(object sender, EventArgs e)
{
int a = Convert.ToInt32(TextBox2.Text);
int b = Convert.ToInt32(TextBox3.Text);
money =Convert.ToString( a * b);
string pid=Session["UserID"].ToString();
5
prdname = TextBox1.Text;
prov_name = DropDownList1.SelectedValue.ToString(); //验证 数据库中是否已经存在这种商品。
sqlstr = "select * from Products ps inner join Provider prov on ps.Prov_ID=prov.Prov_ID where Product_Name ='"+prdname+"'and Prov_CName='"+prov_name+"'";
SqlConnection conn = new SqlConnection("server=localhost;Uid=sa;Pwd=123;Database=OA");
conn.Open();
SqlCommand cmd = new SqlCommand(sqlstr, conn);
SqlDataReader drd = cmd.ExecuteReader();
DataTable dtb = new DataTable();
dtb.Load(drd);
conn.Close();
//若不存在这种商品 则对商品表进行添加操作,并同时添加这个采购单
if (dtb.Rows.Count == 0)
{
//读取供货商中的供货商编号
sqlstr = "select * from Provider where Prov_CName='" + prov_name + "'";
SqlConnection conn2 = new SqlConnection("server=localhost;Uid=sa;Pwd=123;Database=OA");
conn2.Open();
SqlCommand cmd2 = new SqlCommand(sqlstr, conn2); SqlDataReader drd2 = cmd2.ExecuteReader(); DataTable dt = new DataTable();
dt.Load(drd2);
prov_id = dt.Rows[0]["Prov_ID"].ToString(); //向商品表中添加这个商品
sqlstr = "insert into Products(Product_Name,Product_Price,Prov_ID,Person_ID,Product_AddDate,Product_Inform)values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+prov_id+"','"+pid+"','"+DateTime.Now.ToString()+"','"+TextBox5.Text+"')";
prdname=TextBox1.Text;
cmd2 = new SqlCommand(sqlstr,conn2);
cmd2.ExecuteNonQuery();
//从商品表中读取商品编号
conn2.Close();
SqlConnection conn3 = new SqlConnection("server=localhost;Uid=sa;Pwd=123;Database=OA");
conn3.Open();
6
sqlstr = "select * from Products prd inner join Provider prov on prd.Prov_ID = prov.Prov_ID where Product_Name='" + prdname + "'and Prov_CName='" + prov_name + "'";
SqlCommand cmd3 = new SqlCommand(sqlstr, conn3); SqlDataReader drd3 = cmd3.ExecuteReader(); DataTable dt1 = new DataTable();
dt1.Load(drd3);
prdid = dt1.Rows[0]["Product_ID"].ToString(); //向采购表中添加这个采购单
sqlstr = "insert into Product_Order(Product_ID,Product_Name,Product_Number,Product_Price,Order_Money,Order_IsConfirm,Order_IsPay,Prov_ID,Person_ID,Order_Inform,Order_AddDate)values('" + prdid + "','" + TextBox1.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "','" + money + "','false','false','" + prov_id + "','" + pid + "','" + TextBox5.Text + "','" + DateTime.Now.ToString() + "')";
//sqlstr = "insert into Product_Order(Product_ID,Product_Name,Product_Number,Product_Price,Order_Money,Order_IsConfirm,Order_IsPay,Prov_ID,Person_ID,Oder_Inform,Order_AddDate)values('" + prdid + "','" + TextBox1.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "','" + money + "','false','false','" + prov_id + "','" + prdid + "','" + TextBox5.Text + "','" + DateTime.Now.ToString() + "')";
cmd2 = new SqlCommand(sqlstr, conn3);
cmd2.ExecuteNonQuery();
conn2.Close();
Response.Redirect("../Purchase/ProductList.aspx");
}
else//若已经存在这个商品 则直接添加这个采购单 {
//读取供货商中的供货商编号和商品编号
prov_id = dtb.Rows[0]["Prov_ID"].ToString(); prdid = dtb.Rows[0]["Product_ID"].ToString(); //向采购表中添加这个采购单
sqlstr = "insert into Product_Order(Product_ID,Product_Name,Product_Number,Product_Price,Order_Money,Order_IsConfirm,Order_IsPay,Prov_ID,Person_ID,Order_Inform,Order_AddDate)values('"+prdid+"','"+TextBox1.Text+"','"+TextBox3.Text+"','"+TextBox2.Text+"','"+money+"','false','false','"+prov_id+"','"+pid+"','"+TextBox5.Text+"','"+DateTime.Now.ToString()+"')";
SqlConnection conn2 = new SqlConnection("server=localhost;Uid=sa;Pwd=123;Database=OA");
conn2.Open();
7
SqlCommand cmd2 = new SqlCommand(sqlstr, conn2); cmd2.ExecuteNonQuery();
Response.Redirect("../Purchase/ProductList.aspx");
}
}
6测试说明
通过输入错误的账户和密码,来检测登录模块,并出现了预期的错误输出,输入正确信息将登陆到主界面,主界面是所有模块联接的接口。通过添加采购信息让后提交,在后台可以查询到采购产品信息。通过登录人事管理系统,更改职员信息,测试人事管理系统。
7复审的结论
经测试,本系统各模块功能符合软件说明要求,能够达到需求说明中提到的功能。
8