Exemplo n.º 1
0
        public response GetSpecificStory(int ID)
        {
            var dataTable = new DataTable();

            dataTable = new DataTable {
                TableName = "Stories"
            };
            //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("GetSpecificStory", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = ID;
                    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;



                    SpecificStoryList list = new SpecificStoryList();
                    foreach (DataRow row in dataTable.Rows)
                    {
                        specificStory myprod = new specificStory();
                        myprod.ID                 = row["ID"].ToString();
                        myprod.JakataID           = row["JakataID"].ToString();
                        myprod.AnimalType         = row["AnimalType"].ToString();
                        myprod.Comments           = row["Comments"].ToString();
                        myprod.MoralType          = row["MoralType"].ToString();
                        myprod.Stories            = row["Stories"].ToString();
                        myprod.StoryCategorytName = row["StoryCategorytName"].ToString();
                        myprod.Title              = row["Title"].ToString();


                        list.specificStory.Add(myprod);
                    }
                    response.AddSpecificStoryList(list);

                    response.log.Add(numberOfRecords + " Records found");
                }
            }
            return(response);
        }
Exemplo n.º 2
0
 //Simply
 public System.Collections.IList AddSpecificStoryList(SpecificStoryList list)
 {
     data.Add(list);
     return(data);
 }