




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、WEB程序設(shè)計課程設(shè)計報告一、程序總體功能描述首頁登陸注冊密碼修改任務(wù)統(tǒng)計設(shè)備分類管理我的維護任務(wù)我們通過設(shè)計首頁來讓員工注冊自己的個人信息才能登陸進我們的管理系統(tǒng)。登陸系統(tǒng)后,就可以方便維修人員對自己的工作的安排,首先是自己的工作任務(wù),還可以在設(shè)備分類里面添加我們的設(shè)備,對用戶送來修理的設(shè)備進行錄入,最后每天都可以查看自己的工作的統(tǒng)計。我們進行了一個詳細(xì)的分類總結(jié)。二、添加分類需求程序詳細(xì)設(shè)計(一)設(shè)備分類管理功能詳細(xì)設(shè)計(梅浩)1、功能描述2、實現(xiàn)描述在sort_add代碼中添加分類需求這個字段,然后在后臺代碼中添加能夠判斷數(shù)據(jù)庫讀寫的字段,在SortDataAccess.cs代碼中添加寫
2、入數(shù)據(jù)的代碼,并且在添加、修改、刪除的數(shù)據(jù)段中都必須添加此字段,否則會運行報錯3、主要功能函數(shù)解析sort_add.aspx代碼<% Page Language="C#" MasterPageFile="/master/MasterPage.master" AutoEventWireup="true" CodeFile="sort_add.aspx.cs" Inherits="sort_sort_add" %><asp:Content ID="Content1&quo
3、t; ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <div> <asp:Button ID="Button2" runat="server" Text="返回" PostBackUrl="/sort/sort_list.aspx" /><br /> <br /> <table width="100%" class="
4、;default"> <tr class="title"> <td colspan="2" style="height: 20px"> 添加新的維修設(shè)備 </td> </tr> <tr> <td class="item" width="40%"> 設(shè)備分類名稱 </td> <td> <asp:TextBox ID="TextBoxSortName" runat
5、="server" MaxLength="100"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxSortName" ErrorMessage="*必須輸入分類名稱" ValidationGroup="v1"></asp:RequiredFie
6、ldValidator> </td> </tr> <tr> <td class="item" width="40%"> 分類簡介 </td> <td> <asp:TextBox ID="TextBoxIntro" runat="server" TextMode="MultiLine" Width="300"></asp:TextBox> </td> </tr
7、> <tr> <td> 用戶需求</td> <td> <asp:TextBox ID="TextBoxSortRemark" runat="server" MaxLength="100" align="right"></asp:TextBox></td> </tr> </table> <asp:Button ID="Button1" runat="
8、server" Text="確定" ValidationGroup="v1" OnClick="Button1_Click" /><br /> <asp:Label ID="resLabel" runat="server"></asp:Label> </div></asp:Content>這個是sort_add.aspx界面,在界面上添加文字。使用后臺的aspx.cs后臺代碼來實現(xiàn)他的有關(guān)功能sort_add.aspx.
9、cs界面using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;publ
10、ic partial class sort_sort_add : System.Web.UI.Page private CommDataAccess cda = new CommDataAccess(); private SortDataAccess sda = new SortDataAccess(); private TaskDataAccess tda = new TaskDataAccess(); protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) cda.changeHeadBg("h2
11、", Master); protected void Button1_Click(object sender, EventArgs e) int res = 0; try res = sda.addSort(TextBoxSortName.Text, TextBoxIntro.Text,TextBoxSortRemark.Text);/這個是最主要的字段,將TextBox中的SortRemark文本框中的字段添加到數(shù)據(jù)庫中 if (res > 0) resLabel.Text = "操作成功" else resLabel.Text = "操作失敗&
12、quot; /使用判斷語句判斷是否操作成功,但是我們還要在數(shù)據(jù)庫中添加備注這個字段,所以就要修改數(shù)據(jù)庫的代碼。 catch (Exception ex) resLabel.Text = "操作失?。≡蚴牵?quot; + ex.ToString(); SortDataAccess.cs代碼分析我們是在sort_add代碼中添加的模塊所以在數(shù)據(jù)庫中我們就要在sortdataaccess.cs中添加我們所需要的數(shù)據(jù)信息,下面我們著重介紹添加的數(shù)據(jù)流程我們在獲取任務(wù)分類,刪除任務(wù)分類,修改任務(wù)分類,增加任務(wù)分類中都用到了sort_remark這個字段,所以在數(shù)據(jù)庫添加的文件中也必須要修改
13、這幾個字段,在這幾個代碼中添加這個字段的名稱即可using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using Sys
14、tem.Data.SqlClient;using System.Collections.Generic;/ <summary>/ Summary description for SortDataAccess/ </summary>public class SortDataAccess public SortDataAccess() /獲取Web.Config中設(shè)置的連接字符串 connectionString = "server='.'database='task'uid='sa'pwd='307'
15、;" /connectionString = "Data Source=.SQLEXPRESS;Initial Catalog=task;Integrated Security=True" private string connectionString; / <summary> / 獲取任務(wù)分類信息 / </summary> / public DataSet SortList() using (SqlConnection conn = new SqlConnection(connectionString) string sqlstr = &
16、quot;SELECT sortid,sortname,intro,sortremark FROM task.dbo.sort ORDER BY sortid DESC" SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(cmd); /將數(shù)據(jù)填充到DataSet中 sda.Fill(ds); return ds; / <summ
17、ary> / 刪除任務(wù)分類 / </summary> / public int delSort(string sortid) using (SqlConnection conn = new SqlConnection(connectionString) string sqlstr = "delete from task.dbo.sort where sortid = sortid" SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; cmd.
18、Parameters.Add("sortid", SqlDbType.VarChar); cmd.Parameters"sortid".Value = sortid; conn.Open(); int res = cmd.ExecuteNonQuery(); return res; / <summary> / 修改任務(wù)分類 / </summary> / public int updateSort(string sortid, string sortname, string intro, string sortremark) usi
19、ng (SqlConnection conn = new SqlConnection(connectionString) string sqlstr = "update task.dbo.sort set sortname=sortname,intro=intro ,sortremark=sortremark where sortid = sortid" SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; cmd.Parameters.Add("so
20、rtid", SqlDbType.VarChar); cmd.Parameters"sortid".Value = sortid; cmd.Parameters.Add("sortname", SqlDbType.VarChar); cmd.Parameters"sortname".Value = sortname; cmd.Parameters.Add("intro", SqlDbType.VarChar); cmd.Parameters"intro".Value = intro;
21、cmd.Parameters.Add("sortremark", SqlDbType.VarChar); cmd.Parameters"sortremark".Value = sortremark; conn.Open(); int res = cmd.ExecuteNonQuery(); return res; / <summary> / 增加任務(wù)分類 / </summary> / public int addSort(string sortname, string intro,string sortremark) using
22、(SqlConnection conn = new SqlConnection(connectionString) string sqlstr = "insert into task.dbo.sort(sortname,intro,sortremark) values (sortname,intro,sortremark)" SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; cmd.Parameters.Add("sortname", S
23、qlDbType.VarChar); cmd.Parameters"sortname".Value = sortname; cmd.Parameters.Add("intro", SqlDbType.VarChar); cmd.Parameters"intro".Value = intro; cmd.Parameters.Add("sortremark", SqlDbType.VarChar); cmd.Parameters"sortremark".Value = sortremark; con
24、n.Open(); int res = cmd.ExecuteNonQuery(); return res; / <summary> / 獲取分類中任務(wù)的數(shù)量 / </summary> / public int getSortNum(string sortid) using (SqlConnection conn = new SqlConnection(connectionString) string sqlstr = "select count(*) from task.dbo.task where sortid = sortid" SqlComm
25、and cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; cmd.Parameters.Add("sortid", SqlDbType.VarChar); cmd.Parameters"sortid".Value = sortid; conn.Open(); int res = Convert.ToInt32(cmd.ExecuteScalar(); return res; / <summary> / 根據(jù)任務(wù)sortid獲取任務(wù)信息 / <
26、/summary> / public Dictionary<string, string> selectInfoBySortid(string sortid) using (SqlConnection conn = new SqlConnection(connectionString) conn.Open(); string sqlstr = "select * from task.dbo.sort where sortid=" + sortid; SqlCommand cmd = new SqlCommand(); cmd.Connection = co
27、nn; cmd.CommandText = sqlstr; SqlDataReader reader = cmd.ExecuteReader(); Dictionary<string, string> sortInfo = new Dictionary<string, string>(); while (reader.Read() sortInfo.Add("sortid", reader0.ToString(); sortInfo.Add("sortname", reader1.ToString(); sortInfo.Add(
28、"intro", reader2.ToString(); sortInfo.Add("sortremark", reader3.ToString(); return sortInfo; / <summary> / 統(tǒng)計任務(wù)分類 / </summary> / public DataSet getStatistic() using (SqlConnection conn = new SqlConnection(connectionString) string sqlstr = "SELECT sortid, sortname
29、, (SELECT count(*) FROM task WHERE sortid = S.sortid) as Total, (SELECT count(*) FROM task WHERE sortid = S.sortid and taskstatus='未完成') as TotalIncomplete, (SELECT count(*) FROM task WHERE sortid = S.sortid and taskstatus='完成') as TotalComplete FROM sort S" SqlCommand cmd = new
30、 SqlCommand(); cmd.Connection = conn; cmd.CommandText = sqlstr; conn.Open(); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(cmd); /將數(shù)據(jù)填充到DataSet中 sda.Fill(ds); return ds; public int addSort(string p, string p_2, TextBox TextBoxSortRemark) throw new Exception("The method or
31、operation is not implemented."); (二)注冊功能詳細(xì)設(shè)計(朱佳宇、馬海濤、孫軒凱)1、功能描述添加工作人員注冊模塊,為我們的上班人員注冊自己的賬戶2、實現(xiàn)描述在以前現(xiàn)有的模版上添加了注冊的模塊,我們只需要截取userid以及username加入數(shù)據(jù)庫中user的表中就可以添加一行數(shù)據(jù)項,但是還要在數(shù)據(jù)庫的表中添加userdataaccess.cs文件3、主要功能函數(shù)解析register.aspx代碼<% Page Language="C#" AutoEventWireup="true" CodeFile=&
32、quot;register.aspx.cs" Inherits="register" %><!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Transitional/EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml" ><head runat="server"&g
33、t; <title>用戶注冊</title></head><body> <form id="form1" runat="server"> <div id="LoginPage" style="padding-top: 150px;" align="center"> <table style="width: 680px; height: 347px;"> </table> <t
34、able style="width: 680px; height: 347px; border-collapse: collapse; text-align: center;"> <tr> <td colspan="3"> <asp:Image ID="Image3" runat="server" ImageUrl="/images/company.jpg" Width="680px" BorderStyle="None"
35、; Height="646px" /></td> </tr> <tr bgcolor="#065b92" > <td style="font-size: larger; text-decoration: blink;" height="30px" colspan="3"><strong>用戶注冊</strong></td> </tr> <tr bgcolor="#065b92&q
36、uot;> <td height="30px"><asp:Label ID="Label3" runat="server" Text="用戶名:" Font-Size="Large" ></asp:Label></td> <td height="30px"><asp:TextBox ID="txtUserName" runat="server" Font-Size=
37、"Large" ></asp:TextBox></td> <td height="30px" style="width: 191px"> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="必須填寫" ControlToValidate="txtUserName"></asp:R
38、equiredFieldValidator></td> </tr> <tr bgcolor="#065b92"> <td height="30px" > <asp:Label ID="Label2" runat="server" Text="密碼:" Font-Size="Large" Height="33px"></asp:Label></td> <td he
39、ight="30px"> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Font-Size="Large" ></asp:TextBox> </td> <td height="30px" style="width: 191px"><asp:RequiredFieldValidator ID="Requir
40、edFieldValidator2" runat="server" ErrorMessage="密 碼不能為空" ControlToValidate="txtPassword" ></asp:RequiredFieldValidator></td> </tr> <tr bgcolor="#065b92" > <td height="30px"><asp:Label ID="Label1" run
41、at="server" Text="確認(rèn)密碼:" Font-Size="Large" ></asp:Label></td> <td height="30px"><asp:TextBox ID="txtPasswordQR" runat="server" TextMode="Password" Font-Size="Large" ></asp:TextBox></td
42、> <td height="30px" style="width: 191px"> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="兩次密碼不一樣" ControlToCompare="txtPassword" ControlToValidate="txtPasswordQR"></asp:CompareValidator
43、></td> </tr> <tr bgcolor="#065b92"> <td height="30px"><asp:Label ID="Label4" runat="server" Text="性別:" Font-Size="Large" ></asp:Label></td> <td height="30px"> <asp:RadioButton
44、ID="RadioButton1" runat="server" Text="男" GroupName="Choose" />      <asp:RadioButton ID="RadioButton2" runat="server" Text="女" GroupName="Choose" /> </td> <td he
45、ight="30px" style="width: 191px"></td> </tr> <tr bgcolor="#065b92"> <td height="30px"><asp:Label ID="Label5" runat="server" Text="真實姓名:" Font-Size="Large" ></asp:Label></td> &
46、lt;td height="30px"><asp:TextBox ID="TextBox1" runat="server" Font-Size="Large" ></asp:TextBox></td> <td height="30px" style="width: 191px"></td> </tr> <tr bgcolor="#065b92"> <td hei
47、ght="30px"><asp:Label ID="Label6" runat="server" Text="電話:" Font-Size="Large" ></asp:Label></td> <td height="30px"><asp:TextBox ID="TextBox2" runat="server" Font-Size="Large" >&
48、lt;/asp:TextBox></td> <td height="30px" style="width: 191px" ></td> </tr> <tr bgcolor="#065b92" > <td height="30px"><asp:Label ID="Label7" runat="server" Text="電子郵件:" Font-Size="Large
49、" ></asp:Label></td> <td height="30px"><asp:TextBox ID="TextBox3" runat="server" Font-Size="Large" ></asp:TextBox></td> <td height="30px" style="width: 191px"> <asp:RequiredFieldValidator
50、 ID="RequiredFieldValidator3" runat="server" ErrorMessage="必須填寫" ControlToValidate="TextBox3"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="格式不正確
51、" ControlToValidate="TextBox3" ValidationExpression="w+(-+.'w+)*w+(-.w+)*.w+(-.w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr bgcolor="#065b92"> <td height="30px"></td> <td height="30px">
52、 <asp:Button ID="Button1" runat="server" Text="注冊" style="text-align: left; font-size: large;" Onclick="Button1_Click"/>       <asp:Button ID="Button2" runat="server" Text="取消&
53、quot; Onclick="Button2_Click" style="font-size: large" CausesValidation="False"/> </td> <td height="30px" style="width: 191px"></td> </tr> <tr bgcolor="#065b92"> <td height="30px"></td>
54、 <td height="30px"> <asp:Label ID="resLabel" runat="server"></asp:Label></td> <td height="30px" style="width: 191px"></td> </tr> </table> </div> </form></body></html>register.asp
55、x.cs代碼主要涉及到的代碼:將文件中的txtUserName.Text, txtPassword.Text字段添加到數(shù)據(jù)庫中using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.U
56、I.HtmlControls;public partial class register : System.Web.UI.Page private CommDataAccess cda = new CommDataAccess(); private SortDataAccess sda = new SortDataAccess(); private UsersDataAccess uda = new UsersDataAccess(); protected void Page_Load(object sender, EventArgs e) protected void Button1_Click(object sender, EventArgs e) int res = 0; try res = uda.addUsers(txtUserName.Text, txtPassword.Text); if (res > 0) resLabel.Text = "操作成功" Response.Redire
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 勘察設(shè)計合同住建部
- 2025年咸寧貨運從業(yè)資格證考試模擬考試題庫
- 2025年西雙版納貨運運輸駕駛員從業(yè)資格證考試試題
- 電商總監(jiān)勞務(wù)合同5篇
- 2023年高考真題全國乙卷地理試卷解析
- 微晶玻璃管戰(zhàn)略市場規(guī)劃報告
- 加班裝貨送貨合同范本
- 鹵肉店培訓(xùn)合同范本
- 廚房技術(shù)購買合同范本
- 1+X無人機模擬題與答案
- 牙周炎-侵襲性牙周炎
- 心理委員工作記錄表
- 新教科版五下科學(xué)1-5《當(dāng)環(huán)境改變了》公開課課件
- 教師的十大轉(zhuǎn)變課件
- 焦化廠生產(chǎn)工序及工藝流程圖
- 可下載打印的公司章程
- 中藥熏洗法課件
- 本特利探頭應(yīng)用
- 城市雕塑藝術(shù)工程工程量計價清單定額2022年版
- QMR-110-00員工手部、接觸面等微生物檢驗記錄記錄
- 外陰及陰道炎癥
評論
0/150
提交評論