Ejemplo n.º 1
0
        public response GetYouTube(int JakataID)
        {
            var dataTable = new DataTable();

            dataTable = new DataTable {
                TableName = "YouTube"
            };
            //var conString1 = ConfigurationManager.ConnectionStrings["LocalEvolution"];
            //string connString = conString1.ConnectionString;
            string connString = URLInfo.GetDataBaseConnectionString();

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

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



                    YouTubeList list = new YouTubeList();
                    foreach (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);
        }
Ejemplo n.º 2
0
 public IList AddYouTubeList(YouTubeList list)
 {
     data.Add(list);
     return(data);
 }