Example #1
0
 private void _loading()
 {
     RingVisibility = Visibility.Visible;
     Task.Factory.StartNew(() =>
     {
         DatabaseHelper.Open();
         SystemHelper.Open();
         var reader = DatabaseHelper.Select <ChapterItem>("Id,Name,Url", $"WHERE BookId = {_book.Id}");
         while (reader.Read())
         {
             if (reader.HasRows)
             {
                 var item = new ChapterItem(reader);
                 Application.Current.Dispatcher.Invoke(() =>
                 {
                     ChaptersList.Add(item);
                 });
             }
         }
         reader.Close();
         _setConent();
         DatabaseHelper.Close();
         RingVisibility = Visibility.Collapsed;
     });
 }
        private void DisplayChapters()
        {
            string  novelId = Page.RouteData.Values["ID"].ToString();
            string  sql     = String.Format("SELECT * FROM Chapters WHERE NovelID = {0}", novelId);
            DataSet data    = connector.query(sql);

            ChaptersList.DataSource = data;
            ChaptersList.DataBind();
        }
	private void StartUp()
	{
		if (chaptersList == null)
		{
			chaptersList = ((GameObject)GameObject.Instantiate(Resources.Load<GameObject> ("Code Structures/ChaptersList"))).GetComponent<ChaptersList>();
			chaptersList.name = "ChaptersList";
			GameObject.DontDestroyOnLoad(chaptersList.gameObject);
		}
		if (!PlayerPrefs.HasKey("CHAPTER_LIST_ON_PREFS"))
			SaveOnPlayerPrefs();
		else
			LoadFromPlayerPrefs();

	}
        public ActionResult ListOfChapter(int tutorialid)
        {
            List <ChaptersList> chapters = new List <ChaptersList>();
            string constring             = ConfigurationManager.ConnectionStrings["TutorialsContext"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constring))
            {
                SqlCommand command = new SqlCommand();
                command.CommandText = "select ChapterID,ChapterName from Chapters Where TutorialID=@TutorialID";
                command.Parameters.AddWithValue("@TutorialID", tutorialid);
                command.Connection = con;

                con.Open();

                SqlDataReader reader = command.ExecuteReader();
                if (reader == null)
                {
                    if (command != null)
                    {
                        command.Dispose();
                    }
                    if (command != null)
                    {
                        con.Dispose();
                    }
                    return(Json("null", JsonRequestBehavior.AllowGet));
                }
                while (reader.Read())
                {
                    ChaptersList c = new ChaptersList()
                    {
                        ChapterID   = (int)reader["ChapterID"],
                        ChapterName = (string)reader["ChapterName"],
                    };
                    chapters.Add(c);
                }
                if (command != null)
                {
                    command.Dispose();
                }
                if (command != null)
                {
                    con.Dispose();
                }
                return(Json(chapters, JsonRequestBehavior.AllowGet));
            }
        }
Example #5
0
 public override string ToString()
 {
     return (ChaptersList.ToString());
 }