コード例 #1
0
        public response GetSpecificStoryDropdownStatus(int ID)
        {
            var dataTable = new DataTable();

            dataTable = new DataTable {
                TableName = "JakataMaster"
            };
            //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 (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connString))
            {
                using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("GetSpecificStoryDropdownStatus", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@StoryImported", 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;

                    //JakataMasterList list = new JakataMasterList();
                    //foreach (DataRow row in dataTable.Rows)
                    //{
                    //    jakataMaster myprod = new jakataMaster();
                    //    myprod.ID = row["JakataID"].ToString();
                    //    myprod.Title = row["Title"].ToString();


                    //    list.jakataMasterLists.Add(myprod);
                    //}


                    ToDoList list = new ToDoList();
                    foreach (DataRow row in dataTable.Rows)
                    {
                        toDo myprod = new toDo();
                        myprod.ID    = row["JakataID"].ToString();
                        myprod.Title = row["Title"].ToString();


                        list.toDoLists.Add(myprod);
                    }
                    //response.AddJakataMasterList(list);
                    response.AddToDoList(list);
                    //response.AddToDoList(list);



                    response.log.Add(numberOfRecords + " Records found");
                }
            }
            return(response);
        }
コード例 #2
0
        //public response GetSpecificStory(Story myStoryies)
        public String GetSpecificStory(Story myStoryies)
        {
            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;
            string resultstring = "";

            SpecificStoryList list = new SpecificStoryList();



            using (SqlConnection con = new SqlConnection(connString))
            {
                using (SqlCommand cmd = new SqlCommand("GetSearchStory", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;



                    //cmd.Add("@JakataID", myStory.JakataID);
                    //cmd.Add("@StoryCategorytName", 1);
                    //cmd.Add("@Title", myStory.Title);
                    //cmd.Add("@AnimalType", myStory.AnimalType);


                    if (myStoryies.Title > 0)
                    {
                        cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = myStoryies.Title;
                    }

                    if (myStoryies.JakataID > 0)
                    {
                        cmd.Parameters.Add("@JakataID", SqlDbType.Int).Value = myStoryies.JakataID;
                    }

                    if (myStoryies.AnimalType != "0")
                    {
                        cmd.Parameters.Add("@AnimalType", SqlDbType.NVarChar).Value = myStoryies.AnimalType;
                    }

                    if (myStoryies.MoralType > 0)
                    {
                        cmd.Parameters.Add("@MoralType", SqlDbType.Int).Value = myStoryies.MoralType;
                    }

                    if (myStoryies.Comments != "0")
                    {
                        cmd.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = myStoryies.Comments;
                    }

                    if (myStoryies.Stories != "0")
                    {
                        cmd.Parameters.Add("@Stories", SqlDbType.NVarChar).Value = myStoryies.Stories;
                    }


                    con.Open();
                    var dataReader = cmd.ExecuteReader();
                    dataTable.Load(dataReader);
                    dataTable.WriteXml(writer, XmlWriteMode.WriteSchema, false);
                    returnString = writer.ToString();

                    //return returnString;
                    int numberOfRecords = dataTable.Rows.Count;
                    response.result = numberOfRecords;



                    //SpecificStoryList list = new SpecificStoryList();
                    foreach (DataRow row in dataTable.Rows)
                    {
                        //specificStory myprod = new specificStory();
                        resultstring = resultstring + row["ID"].ToString() + "|";


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

                    //response.log.Add(numberOfRecords + " Records found");
                }
            }

            //return list;
            return(resultstring);
            //return response;
        }