




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、一.實(shí)驗(yàn)?zāi)康模和ㄟ^(guò)實(shí)驗(yàn),進(jìn)一步理解DO項(xiàng)型,熟悉各個(gè)語(yǔ)言的xml編程方法。鍛煉軟件開(kāi)發(fā)能力。二.實(shí)驗(yàn)內(nèi)容:1 、 要求做一個(gè)管理信息系統(tǒng),實(shí)現(xiàn)對(duì)某個(gè)事物的管理,做成網(wǎng)頁(yè)的形式(B/S)或者(C/S)形式。要求有界面。2 、 這個(gè)系統(tǒng)后臺(tái)的數(shù)據(jù)存放在xml 里,要實(shí)現(xiàn)對(duì)xml 文檔的增刪改查。3 、界面盡可能好看,功能盡可能貼近實(shí)際應(yīng)用。4 、編程語(yǔ)言不限。三實(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(您輸入的用戶名或密碼錯(cuò)誤!請(qǐng)重試,登陸失敗, 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(用戶名已存在,注冊(cè)失敗,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(恭喜您!成功注冊(cè),注冊(cè)成功,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 . 用戶注冊(cè)界面: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(用戶名已存在,注冊(cè)失敗,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(恭喜您!成功注冊(cè),注冊(cè)成功,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(密碼修改成功!請(qǐng)重新登錄,操作成功 , MessageBoxButtons.OK, MessageBoxIcon.Information);this.Close();return;MessageBox.Show(您輸入的用戶名或密碼錯(cuò)誤!請(qǐng)重試,修改失敗, 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已無(wú)數(shù)據(jù),此操作無(wú)效,無(wú)數(shù)據(jù),MessageBoxButtons.OK, MessageBoxIcon.Warning);return;n+;xnode=xnode.NextSibling;private void PreviousNode() if (xnode.PreviousSibling = null)Messa
26、geBox.ShowC已無(wú)數(shù)據(jù),此操作無(wú)效,無(wú)數(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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《機(jī)械設(shè)計(jì)基礎(chǔ)》課件-第8章 鏈傳動(dòng)
- 預(yù)防夏季疾病班會(huì)課件
- 陶瓷地磚銷(xiāo)售培訓(xùn)
- 培訓(xùn)小組匯報(bào)展示
- 音樂(lè)課件背景圖片
- 電網(wǎng)側(cè)獨(dú)立儲(chǔ)能示范項(xiàng)目風(fēng)險(xiǎn)管理方案(參考范文)
- 汽車(chē)配套產(chǎn)業(yè)基地項(xiàng)目資金申請(qǐng)報(bào)告
- 物流業(yè)貨物運(yùn)輸安全預(yù)案
- 2025年動(dòng)物炭黑、動(dòng)物膠及其衍生物合作協(xié)議書(shū)
- 2025年射頻同軸電纜組件項(xiàng)目合作計(jì)劃書(shū)
- 公司崗位職級(jí)管理制度
- D500-D505 2016年合訂本防雷與接地圖集
- 漏肩風(fēng)(肩周炎)中醫(yī)臨床路徑及入院標(biāo)準(zhǔn)2020版
- 光面爆破知識(shí)講座課件
- 工程結(jié)構(gòu)檢測(cè)鑒定與加固第1章工程結(jié)構(gòu)檢測(cè)鑒定與加固概論課件
- 高鐵站裝飾裝修方案
- DB4401-T 112.1-2021 城市道路占道施工交通組織和安全措施設(shè)置+第1部分:交通安全設(shè)施設(shè)置-(高清現(xiàn)行)
- 質(zhì)量整改通知單(樣板)
- 杭州市高級(jí)中學(xué)2022年高一新生素質(zhì)測(cè)試(分班考)模擬試卷
- 《碳纖維片材加固混凝土結(jié)構(gòu)技術(shù)規(guī)程》(2022年版)
- 短視頻:策劃+拍攝+制作+運(yùn)營(yíng)課件(完整版)
評(píng)論
0/150
提交評(píng)論