public static void AddReportContentList(string reportContent, string reportID, string authorid, int status, string domain, bool ispositive, string naturaltext, ref System.Data.SqlClient.SqlCommand cmd) { cmd.CommandTimeout = 0; cmd.Parameters.Clear(); JavaScriptSerializer a = new JavaScriptSerializer(); ReportContent temp = a.Deserialize <ReportContent>(reportContent); string sql = string.Format("insert into tReportContentList(TemplateId,TemplateVersion," + "ReportId,ReportVersion,ContentHtml,AuthorName,AutherId,CreateDate,Status,Doman,IsPositive,NaturalContentHtml) " + "values(@TemplateId,@TemplateVersion,@ReportId,@ReportVersion,@ContentHtml," + "@AuthorName,@AutherId,@CreateDate,@Status,@Domain,@IsPositive,@NaturalContentHtml)"); cmd.CommandText = sql; cmd.Parameters.AddWithValue("@TemplateId", temp.TemplateId); cmd.Parameters.AddWithValue("@TemplateVersion", temp.TemplateVersion); cmd.Parameters.AddWithValue("@ReportId", reportID); cmd.Parameters.AddWithValue("@ReportVersion", 0); cmd.Parameters.AddWithValue("@ContentHtml", temp.ContentHtml); cmd.Parameters.AddWithValue("@AuthorName", authorid); cmd.Parameters.AddWithValue("@AutherId", authorid); cmd.Parameters.AddWithValue("@CreateDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Status", status); cmd.Parameters.AddWithValue("@Domain", domain); cmd.Parameters.AddWithValue("@IsPositive", ispositive); cmd.Parameters.AddWithValue("@NaturalContentHtml", naturaltext); }
public static void UpdateReportContent(string reportContent, string reportID, string authorid, int status, string naturaltext, ref System.Data.SqlClient.SqlCommand cmd) { JavaScriptSerializer a = new JavaScriptSerializer(); ReportContent temp = a.Deserialize <ReportContent>(reportContent); cmd.CommandTimeout = 0; cmd.Parameters.Clear(); string sql = string.Format("update tReportContent set ContentHtml=@ContentHtml," + " AuthorName=@AuthorName, " + " AutherId=@AutherId, " + " Status=@Status, " + " ModifyDate=@ModifyDate, " + " NaturalContentHtml=@NaturalContentHtml " + " where ReportId=@ReportId"); cmd.CommandText = sql; cmd.Parameters.AddWithValue("@ReportId", reportID); cmd.Parameters.AddWithValue("@AuthorName", authorid); cmd.Parameters.AddWithValue("@AutherId", authorid); cmd.Parameters.AddWithValue("@Status", status); cmd.Parameters.AddWithValue("@ContentHtml", temp.ContentHtml); cmd.Parameters.AddWithValue("@ModifyDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@NaturalContentHtml", naturaltext); }