public static void GetSchoolIdTest() { List <School_row> Schools; SchoolTB schooltable = new SchoolTB(); string _schoolName = "MSCreative"; string _cityName = "HYD"; Schools = schooltable.GetSchools(_schoolName, _cityName); foreach (School_row sc in Schools) { System.Console.WriteLine(sc.School_name + sc.School_cityname); } }
public List <School_row> GetSchools(string _schoolname, string _cityname) { SchoolTB _schoolTb = new SchoolTB(); return(_schoolTb.GetSchools(_schoolname, _cityname));; }
private static void Send(Socket handler, String data) { List <string> _values = new List <string>(); using (XmlReader reader = XmlReader.Create(new StringReader(data))) { while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: Console.WriteLine(reader.Name); break; case XmlNodeType.Text: Console.WriteLine(reader.Value); _values.Add(reader.Value); break; case XmlNodeType.XmlDeclaration: case XmlNodeType.ProcessingInstruction: Console.WriteLine(reader.Name + reader.Value); break; case XmlNodeType.Comment: Console.WriteLine(reader.Value); break; case XmlNodeType.EndElement: Console.WriteLine(reader.Name); break; } } } SchoolTB _schoolTb = new SchoolTB(); List <School_row> _schools = _schoolTb.GetSchools(_values[0], _values[1]); StringBuilder sb = new StringBuilder(); StringWriter stream = new StringWriter(sb); foreach (School_row sr in _schools) { XmlSerializer x = new System.Xml.Serialization.XmlSerializer(sr.GetType()); x.Serialize(stream, sr); StringReader streamreader = new StringReader(sb.ToString()); object deserialized = x.Deserialize(streamreader); School_row sr1 = (School_row)deserialized; //Console.WriteLine(); } //try //{ // using (StringWriter stream = new StringWriter(sb)) // { // BinaryFormatter bin = new BinaryFormatter(); // bin.Serialize(stream, _schools); // } //} //catch (IOException) //{ //} data = String.Format("<Classroom Id=1 Grade=10 Section=A >" + "<Student Id=1 Firstname=Ali Surname=AlQuiaty />" + "<Student Id=2 Firstname=Sayeed Surname=AlQuiaty />" + "<Student Id=3 Firstname=Salam Surname=AlQuiaty />" + "<Student Id=4 Firstname=Minhaj Surname=Ahmed />" + "<Student Id=5 Firstname=Parvez Surname=Shaik />" + "</Classroom >"); // Convert the string data to byte data using ASCII encoding. byte[] byteData = Encoding.ASCII.GetBytes(stream.ToString()); // Begin sending the data to the remote device. handler.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), handler); }