/// <summary> /// 获得数据列表 /// </summary> public List <tdps.Model.SBXML> DataTableToList(DataTable dt) { List <tdps.Model.SBXML> modelList = new List <tdps.Model.SBXML>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { tdps.Model.SBXML model; for (int n = 0; n < rowsCount; n++) { model = new tdps.Model.SBXML(); if (dt.Rows[n]["SBXXID"].ToString() != "") { model.SBXXID = int.Parse(dt.Rows[n]["SBXXID"].ToString()); } model.FileName = dt.Rows[n]["FileName"].ToString(); model.SBXMLData = dt.Rows[n]["SBXMLData"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(tdps.Model.SBXML model, object trans) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SBXML("); strSql.Append("SBXXID,FileName,SBXMLData)"); strSql.Append(" values ("); strSql.Append("@SBXXID,@FileName,@SBXMLData)"); SQLiteParameter[] parameters = { new SQLiteParameter("@SBXXID", DbType.Int32, 4), new SQLiteParameter("@FileName", DbType.String, 200), new SQLiteParameter("@SBXMLData", DbType.String) }; parameters[0].Value = model.SBXXID; parameters[1].Value = model.FileName; parameters[2].Value = RefactoringXMLData(model.SBXMLData, model.FileName); //var tag = new object(); //RefactoringXMLData(tag); //string xmlPath = string.Format("{0}\\xml\\{0}", ""); //CreateXMLFile(tag, xmlPath); SQLiteHelper.ExecuteNonQueryByTransaction(strSql.ToString(), (SQLiteTransaction)trans, parameters); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(tdps.Model.SBXML model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(tdps.Model.SBXML model) { dal.Add(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(tdps.Model.SBXML model, object trans) { dal.Add(model, trans); }