//插入数据 public int Add(classInfo c) { return(cdal.Add(c)); }
//更新数据 public int Update(classInfo c) { return(cdal.Update(c)); }
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //PageTitle.Text = e.Result; // now change to go to next page... String xmlString = e.Result; do { int rowindex = xmlString.IndexOf("</row>"); String rowinfo = xmlString.Substring(0, rowindex); rowinfo = rowinfo.Substring(rowinfo.IndexOf("<row>") + 6); xmlString = xmlString.Substring(rowindex + 7); classInfo ci; ci = new classInfo(); string value; int eIndex; int sIndex; //term eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.term = value; rowinfo = rowinfo.Substring(eIndex + 8); //subj eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.subj = value; rowinfo = rowinfo.Substring(eIndex + 8); //subj discription eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.Subject_desc = value; rowinfo = rowinfo.Substring(eIndex + 8); //number eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.numb = value; rowinfo = rowinfo.Substring(eIndex + 8); //unknown.... eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); rowinfo = rowinfo.Substring(eIndex + 8); //title eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.title = value; rowinfo = rowinfo.Substring(eIndex + 8); //instructor first name eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.instr_fname = value; rowinfo = rowinfo.Substring(eIndex + 8); //instructor last name eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.instr_lname = value; rowinfo = rowinfo.Substring(eIndex + 8); //CRN eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.CRN = value; rowinfo = rowinfo.Substring(eIndex + 8); //campus eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.campus = value; rowinfo = rowinfo.Substring(eIndex + 8); //building eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.building = value; rowinfo = rowinfo.Substring(eIndex + 8); //room eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.room = value; rowinfo = rowinfo.Substring(eIndex + 8); //monday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.mon = value; rowinfo = rowinfo.Substring(eIndex + 8); //tuesday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.tue = value; rowinfo = rowinfo.Substring(eIndex + 8); //wednesday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.wed = value; rowinfo = rowinfo.Substring(eIndex + 8); //thursday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.thu = value; rowinfo = rowinfo.Substring(eIndex + 8); //friday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.fri = value; rowinfo = rowinfo.Substring(eIndex + 8); //saturday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.sat = value; rowinfo = rowinfo.Substring(eIndex + 8); //sunday eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.sun = value; rowinfo = rowinfo.Substring(eIndex + 8); //beguin time eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.begin_time = value; rowinfo = rowinfo.Substring(eIndex + 8); //end time eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.end_time = value; rowinfo = rowinfo.Substring(eIndex + 8); //start date eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.start_date = value; rowinfo = rowinfo.Substring(eIndex + 8); //end date eIndex = rowinfo.IndexOf("</value>"); sIndex = rowinfo.IndexOf("<value>") + 7; value = rowinfo.Substring(0, eIndex); value = value.Substring(sIndex); ci.end_date = value; rowinfo = rowinfo.Substring(eIndex + 8); if (ClassTypeExist(ci.subj) == null) { ClassType ct = new ClassType(); ct.ShortName = ci.subj; ct.LongName = ci.Subject_desc; ClassTypes.Add(ct); ct.Classes.Add(ci); } else { ClassTypeExist(ci.subj).Classes.Add(ci); } } while (xmlString.Contains("<row>")); PopulateClassTypes(); }