/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.Template_Reports model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@TemplReportId", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 255), new SqlParameter("@Standard", SqlDbType.Bit, 1), new SqlParameter("@HtmlTemplContent", SqlDbType.VarChar) }; parameters[0].Value = model.TemplReportId; parameters[1].Value = model.Name; parameters[2].Value = model.Standard; parameters[3].Value = model.HtmlTemplContent; DbHelperSQL.RunProcedure("UP_Template_Reports_Update", parameters, out rowsAffected); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LPWeb.Model.Template_Reports model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@TemplReportId", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 255), new SqlParameter("@Standard", SqlDbType.Bit, 1), new SqlParameter("@HtmlTemplContent", SqlDbType.VarChar) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.Name; parameters[2].Value = model.Standard; parameters[3].Value = model.HtmlTemplContent; DbHelperSQL.RunProcedure("UP_Template_Reports_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public LPWeb.Model.Template_Reports GetModel(int TemplReportId) { SqlParameter[] parameters = { new SqlParameter("@TemplReportId", SqlDbType.Int, 4) }; parameters[0].Value = TemplReportId; LPWeb.Model.Template_Reports model = new LPWeb.Model.Template_Reports(); DataSet ds = DbHelperSQL.RunProcedure("UP_Template_Reports_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["TemplReportId"].ToString() != "") { model.TemplReportId = int.Parse(ds.Tables[0].Rows[0]["TemplReportId"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); if (ds.Tables[0].Rows[0]["Standard"].ToString() != "") { if ((ds.Tables[0].Rows[0]["Standard"].ToString() == "1") || (ds.Tables[0].Rows[0]["Standard"].ToString().ToLower() == "true")) { model.Standard = true; } else { model.Standard = false; } } model.HtmlTemplContent = ds.Tables[0].Rows[0]["HtmlTemplContent"].ToString(); return(model); } else { return(null); } }