Esempio n. 1
0
        public response GetYouTube(int JakataID)
        {
            var dataTable = new System.Data.DataTable();

            dataTable = new System.Data.DataTable {
                TableName = "YouTube"
            };
            string connString = URLInfo.GetDataBaseConnectionString();

            System.IO.StringWriter writer = new System.IO.StringWriter();
            string   returnString         = "";
            response response             = new response();

            response.result = 0;
            using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connString))
            {
                using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("GetYouTube", con))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add("@JakataID", System.Data.SqlDbType.NVarChar).Value = JakataID;
                    con.Open();
                    var dataReader = cmd.ExecuteReader();
                    dataTable.Load(dataReader);
                    dataTable.WriteXml(writer, System.Data.XmlWriteMode.WriteSchema, false);
                    returnString = writer.ToString();
                    int numberOfRecords = dataTable.Rows.Count;
                    response.result = numberOfRecords;



                    YouTubeList list = new YouTubeList();
                    foreach (System.Data.DataRow row in dataTable.Rows)
                    {
                        youTube myprod = new youTube();
                        myprod.ID       = row["ID"].ToString();
                        myprod.JakataID = row["JakataID"].ToString();
                        myprod.URL      = row["URL"].ToString();


                        list.youTubeLists.Add(myprod);
                    }
                    response.AddYouTubeList(list);

                    response.log.Add(numberOfRecords + " Records found");
                }
            }
            return(response);
        }
Esempio n. 2
0
 public System.Collections.IList AddYouTubeList(YouTubeList list)
 {
     data.Add(list);
     return(data);
 }