




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、一.實(shí)驗(yàn)?zāi)康模和ㄟ^實(shí)驗(yàn),進(jìn)一步理解DO項(xiàng)型,熟悉各個(gè)語言的xml編程方法。鍛煉軟件開發(fā)能力。二.實(shí)驗(yàn)內(nèi)容:1 、 要求做一個(gè)管理信息系統(tǒng),實(shí)現(xiàn)對某個(gè)事物的管理,做成網(wǎng)頁的形式(B/S)或者(C/S)形式。要求有界面。2 、 這個(gè)系統(tǒng)后臺的數(shù)據(jù)存放在xml 里,要實(shí)現(xiàn)對xml 文檔的增刪改查。3 、界面盡可能好看,功能盡可能貼近實(shí)際應(yīng)用。4 、編程語言不限。三實(shí)驗(yàn)步驟或程序(經(jīng)調(diào)試后正確的源程序)1 .登陸界面:namespace XMLpublic partial class Login : Formpublic Login()InitializeComponent();private voi
2、d Yes_Click(object sender, EventArgs e)XmlDocument xmldoc = new XmlDocument();xmldoc.Load(F:peoples.xml);foreach(XmlNodexnodeinxmldoc.SelectSingleNode(peoples).ChildNodes)if (xnode.ChildNodes0.InnerText = txtname.Text &xnode.ChildNodes1.InnerText = txtpassword.Text)MessageBox.Show(歡迎進(jìn)入個(gè)人理財(cái)系統(tǒng),登陸成功,Me
3、ssageBoxButtons.OK, MessageBoxIcon.Information);this.DialogResult = DialogResult.OK;this.Tag = true;return;MessageBox.Show(您輸入的用戶名或密碼錯誤!請重試,登陸失敗, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);this.Tag = false;private void Register_Click(object sender, EventArgs e) XmlDocument xmldoc = new XmlDoc
4、ument();xmldoc.Load(F:peoples.xml);foreach(XmlNodexnodeinxmldoc.SelectSingleNode(peoples).ChildNodes)if (xnode.ChildNodes0.InnerText = txtname.Text)MessageBox.Show(用戶名已存在,注冊失敗,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);this.Tag = false;return;XmlElement FirstNode = xmldoc.CreateElement(people
5、);XmlElement NameNode = xmldoc.CreateElement(name);XmlNode name = xmldoc.CreateTextNode(txtname.Text);NameNode.AppendChild(name);XmlElement PasswordNode = xmldoc.CreateElement(password);XmlNode password = xmldoc.CreateTextNode(txtpassword.Text);PasswordNode.AppendChild(password);FirstNode.AppendChil
6、d(NameNode);FirstNode.AppendChild(PasswordNode);xmldoc.DocumentElement.AppendChild(FirstNode);xmldoc.Save(F:peoples.xml);MessageBox.Show(恭喜您!成功注冊,注冊成功,MessageBoxButtons.OK, MessageBoxIcon.Information);2 .本人統(tǒng)計(jì)查詢界面namespace XMLpublic partial class About_me : Formpublic About_me()InitializeComponent();
7、ShowMessage();public void ShowMessage()XmlDocument xmldoc = new XmlDocument();xmldoc.Load(F:Registration.xml);double income = 0.0, expend = 0.0;foreach(XmlNodexnodeinxmldoc.SelectSingleNode(registrations).ChildNodes)if (xnode.ChildNodes0.InnerText = 收入 )income += double.Parse(xnode.ChildNodes5.Inner
8、Text); elseexpend += double.Parse(xnode.ChildNodes5.InnerText);string message = String.Format(目前您的總收入為:0元n總支出為:1元n 總計(jì):2元”,income,expend,(income-expend);txtmessage.Text = message;private void btn_cancel_Click(object sender, EventArgs e)this.Close();3 . 添加收支項(xiàng)目界面:namespace XMLpublic partial class Add_i
9、tem : Formpublic Add_item()InitializeComponent();private void button1_Click(object sender, EventArgs e)if (txtname.Text.Trim().Length = 0)MessageBox.Show(輸入信息不完整!,信息不完整,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);elsetabControl1.SelectedIndex = 1;private void tabControl1_SelectedIndexChanged(o
10、bjectsender, EventArgs e)if(tabControl1.SelectedIndex=1)if (txtname.Text.Trim().Length = 0)MessageBox.Show(輸入信息不完整!,信息不完整,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);tabControl1.SelectedIndex = 0; elsestring name = txtname.Text;string t = ;if (isshouru.Checked)t = isshouru.Text;elset = iszhich
11、u.Text;string message = String.Format(要添力口的收支項(xiàng)目為:0n 所屬類別: 1,name,t);txtInfo.Text = message;private void button2_Click(object sender, EventArgs e)MessageBox.Show(項(xiàng)目添加成功!,操作成功MessageBoxButtons.OK, MessageBoxIcon.Information);4.添加收支情況界面:namespace XMLpublic partial class Add_Registration : Formpublic Ad
12、d_Registration()InitializeComponent();private void btn_yes_Click(object sender, EventArgs e)XmlDocument xmldoc = new XmlDocument();xmldoc.Load(F:Registration.xml);XmlElement secondNode = xmldoc.CreateElement(registration);XmlElement TypeNode = xmldoc.CreateElement(type);string t=;if(isshouru.Checked
13、)t=isshouru.Text;elset=iszhichu.Text;XmlNode type = xmldoc.CreateTextNode(t);TypeNode.AppendChild(type);XmlElement KindNode = xmldoc.CreateElement(kind);string k = txtKind.SelectedItem.ToString();XmlNode kind = xmldoc.CreateTextNode(k);KindNode.AppendChild(kind);XmlElement RemarkNode = xmldoc.Create
14、Element(remark);XmlNode remark = xmldoc.CreateTextNode(txtbz.Text);RemarkNode.AppendChild(remark);XmlElement objectNode = xmldoc.CreateElement(object);string o = ;if (checkBox1.Checked) o += checkBox1.Text + ;if (checkBox2.Checked) o += checkBox2.Text + ;if (checkBox3.Checked) o += checkBox3.Text +
15、;if (checkBox4.Checked) o += checkBox4.Text + ;if (checkBox5.Checked) o += checkBox5.Text + ;if (checkBox6.Checked) o += checkBox6.Text + ;XmlNode Object = xmldoc.CreateTextNode(o);objectNode.AppendChild(Object);XmlElement DateNode = xmldoc.CreateElement(date);string d = dateTime.Value.ToShortDateSt
16、ring();XmlNode date = xmldoc.CreateTextNode(d);DateNode.AppendChild(date);XmlElement QuantityNode = xmldoc.CreateElement(quantity);XmlNode quantity = xmldoc.CreateTextNode(txtquantity.Text);QuantityNode.AppendChild(quantity);secondNode.AppendChild(TypeNode);secondNode.AppendChild(KindNode);secondNod
17、e.AppendChild(RemarkNode);secondNode.AppendChild(objectNode);secondNode.AppendChild(DateNode);secondNode.AppendChild(QuantityNode);xmldoc.DocumentElement.AppendChild(secondNode);xmldoc.Save(F:Registration.xml);MessageBox.Show(巴保存,記錄成功, MessageBoxButtons.OK,MessageBoxIcon.Information);private void bt
18、n_cancel_Click(object sender, EventArgs e)this.Close();4 . 用戶注冊界面:namespace XMLpublic partial class Add_user : Formpublic Add_user()InitializeComponent();private void btn_ok_Click(object sender, EventArgs e)XmlDocument xmldoc = new XmlDocument();xmldoc.Load(F:peoples.xml);foreach(XmlNodexnodeinxmldo
19、c.SelectSingleNode(peoples).ChildNodes)if (xnode.ChildNodes0.InnerText = txtname.Text)MessageBox.Show(用戶名已存在,注冊失敗,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);this.Tag=false;return;XmlElement FirstNode = xmldoc.CreateElement(people);XmlElement NameNode = xmldoc.CreateElement(name);XmlNode name
20、= xmldoc.CreateTextNode(txtname.Text);NameNode.AppendChild(name);XmlElement PasswordNode = xmldoc.CreateElement(password);XmlNode password = xmldoc.CreateTextNode(txtpassword.Text);PasswordNode.AppendChild(password);FirstNode.AppendChild(NameNode);FirstNode.AppendChild(PasswordNode);xmldoc.DocumentE
21、lement.AppendChild(FirstNode);xmldoc.Save(F:peoples.xml);MessageBox.Show(恭喜您!成功注冊,注冊成功,MessageBoxButtons.OK, MessageBoxIcon.Information);this.Tag = true;private void btn_cancel_Click(object sender, EventArgs e)this.Close();5 . 修改密碼界面:namespace XMLpublic partial class Charge_password : Formpublic Cha
22、rge_password()InitializeComponent();private void btn_next_Click(object sender, EventArgs e)XmlDocument xmldoc = new XmlDocument();xmldoc.Load(F:peoples.xml);foreach(XmlNodexnodeinxmldoc.SelectSingleNode(peoples).ChildNodes)if (xnode.ChildNodes0.InnerText = txtname.Text &xnode.ChildNodes1.InnerText =
23、 txtpassword.Text)xnode.ChildNodes1.InnerText = txtnewpassword.Text;xmldoc.Save(F:peoples.xml);MessageBox.Show(密碼修改成功!請重新登錄,操作成功 , MessageBoxButtons.OK, MessageBoxIcon.Information);this.Close();return;MessageBox.Show(您輸入的用戶名或密碼錯誤!請重試,修改失敗, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);6 .管理收支情況界
24、面:namespace xmlpublic partial class Charge_Item : FormXmlDocument xmldoc = new XmlDocument();private static XmlNode xnode;XmlNodeList xnodelist;XmlNode xnodeparent;public static int n = 0;public Charge_Item()InitializeComponent();xmldoc.Load(F:Registration.xml);xnodeparent = xmldoc.FirstChild;xnodel
25、ist = xnodeparent.ChildNodes;xnode = xnodelistn;ShowCurrentItem(xnode);private void NextNode()if (xnode.NextSibling = null)MessageBox.ShowC已無數(shù)據(jù),此操作無效,無數(shù)據(jù),MessageBoxButtons.OK, MessageBoxIcon.Warning);return;n+;xnode=xnode.NextSibling;private void PreviousNode() if (xnode.PreviousSibling = null)Messa
26、geBox.ShowC已無數(shù)據(jù),此操作無效,無數(shù)據(jù),MessageBoxButtons.OK, MessageBoxIcon.Warning);return;n-;xnode=xnode.PreviousSibling;private void ShowCurrentItem(XmlNode xxnode)string type = xxnode.ChildNodes0.InnerText;if (type = 收入 )isshouru.Checked = true;elseiszhichu.Checked = true;txtkind.Text = xxnode.ChildNodes1.In
27、nerText;txtbz.Text = xxnode.ChildNodes2.InnerText;string Object = new string6;Object = xxnode.ChildNodes3.InnerText.Split( );checkBox1.Checked = false;checkBox2.Checked = false;checkBox3.Checked = false;checkBox4.Checked = false;checkBox5.Checked = false;checkBox6.Checked = false;foreach (string s i
28、n Object)switch (s)case 我: checkBox1.Checked = true; break;case 親戚 : checkBox2.Checked = true; break;case 家人 : checkBox3.Checked = true; break;case 朋友 : checkBox4.Checked = true; break;case 同學(xué) : checkBox5.Checked = true; break;case 其他 : checkBox6.Checked = true; break;txttime.Text = xxnode.ChildNode
29、s4.InnerText;txtquantity.Text = xxnode.ChildNodes5.InnerText;private void btnPrevious_Click(object sender, EventArgs e)PreviousNode();ShowCurrentItem(xnode);private void btnNext_Click(object sender, EventArgs e)NextNode();ShowCurrentItem(xnode);private void btnEdit_Click(object sender, EventArgs e)X
30、mlDocument doc = new XmlDocument();doc.Load(F:Registration.xml);XmlNode root = doc.DocumentElement;XmlNodeList list = root.ChildNodes;string t=;if(isshouru.Checked)t=isshouru.Text;else t=iszhichu.Text;listn.ChildNodes0.InnerText = t;if(txtkind.SelectedItem!=null)listn.ChildNodes1.InnerText = txtkind
31、.SelectedItem.ToString();listn.ChildNodes2.InnerText = txtbz.Text;string o = ;if (checkBox1.Checked) o += checkBox1.Text + ;if (checkBox2.Checked) o += checkBox2.Text + ;if (checkBox3.Checked) o += checkBox3.Text + ;if (checkBox4.Checked) o += checkBox4.Text + ;if (checkBox5.Checked) o += checkBox5.
32、Text + ;if (checkBox6.Checked) o += checkBox6.Text + ;listn.ChildNodes3.InnerText = o;listn.ChildNodes4.InnerText = txttime.Text;listn.ChildNodes5.InnerText = txtquantity.Text;doc.Save(F:Registration.xml);MessageBox.Show(巴修改!,操作成功,MessageBoxButtons.OK,MessageBoxIcon.Information); private void btnDel
33、ete_Click(object sender, EventArgs e) XmlDocument doc = new XmlDocument();doc.Load(F:Registration.xml);XmlNode root = doc.DocumentElement;XmlNodeList list = root.ChildNodes;root.RemoveChild(listn);doc.Save(F:Registration.xml);MessageBox.Show(巴刪除!,操作成功,MessageBoxButtons.OK,MessageBoxIcon.Information)
34、;DataSet ds = new DataSet();private void btn_ReadXML_Click(object sender, EventArgs e) ds.Tables.Clear();dataGridView1.DataSource = ds.Tables;ds.ReadXml(F:Registration.xml);dataGridView1.DataSource = ds.Tables0;7.主界面: namespace XML public partial class MainFrm : Formprivate bool isLogined = false;pu
35、blic MainFrm() InitializeComponent();private void tsmExit_Click(object sender, EventArgs e)Application.Exit();private void tsmNewsz_Click(object sender, EventArgs e)if (isLogined)Add_Registration rForm = new Add_Registration(); rForm.MdiParent = this;rForm.Show();tssMsg.Text = rForm.Text; elsetssMsg.Text =注意,必須先登錄才能使用本系統(tǒng)!private void tsmNewmeau_Click(object sender, EventArgs e) if (isLogined)Add_item iForm = new Add_item();iForm.MdiParent = this;iForm.Show();tssMsg.Tex
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年市政工程工程技能提升試題及答案
- 2025年汽車行業(yè)芯片短缺應(yīng)對策略與汽車租賃市場投資機(jī)會報(bào)告
- 現(xiàn)代管理學(xué)的挑戰(zhàn)與機(jī)遇試題及答案
- 行政管理學(xué)的關(guān)鍵概念試題及答案
- 中級經(jīng)濟(jì)師備考實(shí)踐經(jīng)驗(yàn)分享試題及答案
- 全景式分析2025公文處理能力的試題及答案
- 經(jīng)濟(jì)政策對市場的影響試題及答案
- 行政管理中的持續(xù)改善與創(chuàng)新試題及答案
- 工業(yè)互聯(lián)網(wǎng)平臺入侵檢測系統(tǒng)2025年智能化升級與優(yōu)化策略報(bào)告
- 行政管理本科考前試題及答案備考
- GB/T 35513.2-2017塑料聚碳酸酯(PC)模塑和擠出材料第2部分:試樣制備和性能測試
- GB/T 1266-2006化學(xué)試劑氯化鈉
- GB/T 12402-2000經(jīng)濟(jì)類型分類與代碼
- GB/T 11606-2007分析儀器環(huán)境試驗(yàn)方法
- GA 1551.5-2019石油石化系統(tǒng)治安反恐防范要求第5部分:運(yùn)輸企業(yè)
- 拘留所教育課件02
- 11471勞動爭議處理(第4章)
- 公共管理學(xué)黎民講義
- 公路下穿鐵路工程施工組織設(shè)計(jì)
- T-CEEAS 004-2021 企業(yè)合規(guī)師職業(yè)技能評價(jià)標(biāo)準(zhǔn)
- 初三數(shù)學(xué)總復(fù)習(xí)教學(xué)策略課件
評論
0/150
提交評論