public override List <MyParagraph> getTitleParagraphs(DataTable dt) { var paragraphLst = new List <MyParagraph>(); foreach (DataRow row in dt.Rows) { if (row.RowState == DataRowState.Deleted) { continue; } var par = new MyParagraph { titleId = Convert.ToUInt64(row["titleId"]), order = Convert.ToInt32(row["ord"]), alignment = Convert.ToInt32(row["alignment"]), leftIndent = Convert.ToInt32(row["leftIndent"]), fontSize = Convert.ToInt32(row["fontSize"]), fontBold = Convert.ToInt32(row["fontBold"]), fontItalic = Convert.ToInt32(row["fontItalic"]), content = Convert.ToString(row["content"]) }; paragraphLst.Add(par); } return(paragraphLst); }
public override List <MyParagraph> getTitleParagraphs(UInt64 titleId) { var paragraphLst = new List <MyParagraph>(); //get title var qry = "select * from paragraphs where titleId = @id "; var cmd = new OleDbCommand(qry, m_cnn); cmd.Parameters.AddWithValue("@id", titleId); var reader = cmd.ExecuteReader(); while (reader.Read()) { var par = new MyParagraph(); par.titleId = Convert.ToUInt64(reader["titleId"]); par.order = Convert.ToInt32(reader["ord"]); par.alignment = Convert.ToInt32(reader["alignment"]); par.leftIndent = Convert.ToInt32(reader["leftIndent"]); par.fontSize = Convert.ToInt32(reader["fontSize"]); par.fontBold = Convert.ToInt32(reader["fontBold"]); par.fontItalic = Convert.ToInt32(reader["fontItalic"]); par.content = Convert.ToString(reader["content"]); paragraphLst.Add(par); } paragraphLst.Sort((x, y) => { return(x.order - y.order); }); int order = 0; foreach (var par in paragraphLst) { Debug.Assert(par.order > order); order = par.order; } reader.Close(); return(paragraphLst); }