/// <summary> /// if the HelpText doesn't exist, create it with the default value supplied /// </summary> /// <param name="helpTextCode"></param> /// <param name="defaultTitle"></param> /// <param name="defaultBodyText"></param> protected void init(string helpTextCode, string defaultTitle, string defaultBodyText) { this.HelpTextCode = helpTextCode; DataBlock db = new DataBlock(); db.OpenDB(); if (Web.Request["dropHelpTexts"] != null && Util.IsBewebOffice) { db.execute("delete from HelpText where HelpTextCode='" + Fmt.SqlString(helpTextCode) + "'"); } DataBlock rs = db.execute("select * from HelpText where HelpTextCode='" + Fmt.SqlString(helpTextCode) + "'"); if (rs.eof()) { defaultTitle = (defaultTitle.IsBlank()) ? helpTextCode + " Help" : defaultTitle; //autocreate empty HelpText db.execute("insert into HelpText(HelpTextCode,title,bodytexthtml,dateadded)values('" + Fmt.SqlString(helpTextCode) + "','" + Fmt.SqlString(defaultTitle) + "','" + Fmt.SqlString(defaultBodyText) + "', " + Fmt.SqlDate(DateTime.Now) + ")"); rs.close(); //close previous rs //reopen newly created block rs = db.open("select * from HelpText where HelpTextCode='" + Fmt.SqlString(helpTextCode) + "'"); } _ID = rs.GetValueInt("HelpTextID"); _BodyTextHTML = rs.GetValue("BodyTextHTML"); _Title = rs.GetValue("Title"); rs.close(); db.CloseDB(); }