public ExecuteSql ( string sqlString ) : bool | ||
sqlString | string | |
return | bool |
public void Save() { string notes = $" '<Script Name=\"{_name}\" Type=\"{ _type}\" Language=\"{_language}\" Notes=\"\"/>' "; if (Exists()) { string sqlUpdate = "update t_script set " + $"script = '{_model.EscapeSqlString(_code)}' " + $", notes = {notes} " + " where ScriptID = " + _id; _model.ExecuteSql(sqlUpdate); } else { string guid = "{" + Guid.NewGuid() + "}"; string sql = "insert into t_script (ScriptCategory, ScriptAuthor, ScriptName, Notes, Script) " + @" Values (" + $"'{ScriptCategory}', " + $"'{_groupGuid}', " + $"'{guid}', " + $"{notes}, " + $"'{_model.EscapeSqlString(_code)}' )"; _model.ExecuteSql(sql); // update script information GetInfo(); } }
/// <summary> /// adds the given code to the end of the script /// </summary> /// <param name="functionCode">the code to be added</param> public void AddCode(string functionCode) { Code += functionCode; string sqlUpdate = "update t_script set script = '" + _model.EscapeSqlString(Code) + "' where ScriptID = " + _scriptId; _model.ExecuteSql(sqlUpdate); }
/// <summary> /// Save EaScriptGroup. /// </summary> /// <returns>true = successful</returns> public void Save() { var guid = "{" + System.Guid.NewGuid() + "}"; string sql = "insert into t_script (ScriptCategory, ScriptName,Notes, Script) " + $" Values ('{ScriptGroupCategory}','{guid}','<Group Type=\"{GetGroupType()}\" Notes=\"\"/>','{_name}')"; _model.ExecuteSql(sql); GetInfo(); }
/// <summary> /// copy the working set tot the given user /// </summary> /// <param name="user">the user to copy the working set to</param> /// <param name="overwrite">if true then the first working set found with the same name /// for the given user will be overwritten</param> public void CopyToUser(User user, bool overwrite) { if (overwrite) { //check if a working set with the same name already exists WorkingSet workingSetToOverwrite = Model.WorkingSets.Find(w => w.User != null && w.User.Login == user.Login && w.Name == Name); workingSetToOverwrite?.Delete(); } string insertQuery = @"insert into t_document (DocID,DocName, Notes, Style,ElementID, ElementType,StrContent,BinContent,DocType,Author,DocDate ) select '" + Guid.NewGuid().ToString("B") + @"',d.DocName, d.Notes, d.Style, d.ElementID, d.ElementType,d.StrContent,d.BinContent,d.DocType,'" + user.FullName + @"',d.DocDate from t_document d where d.DocID like '" + Id + "'"; Model.ExecuteSql(insertQuery); }
/// <summary> /// deletes the working set from the database /// </summary> void Delete() { string deleteQuery = $"delete from t_document where docid like '{Id} '"; Model.ExecuteSql(deleteQuery); }