public bool AddSignature(Annotations customAnnotation) { using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection)) { try { const string query = "INSERT INTO [Annotation]" + " (" + " [ActiveDirectoryUser]" + ",[Name]" + " ,[Annotation]" + " )" + " VALUES" + " (" + "@ActiveDirectoryUser,@Name,@Annotation" + " )"; int rowsAffectd = db.Execute(query, new { @ActiveDirectoryUser = customAnnotation.ActiveDirectoryUser, @Name = customAnnotation.Name, @Annotation = customAnnotation.NewAnnotation }); return true; } catch (Exception er) { string s1 = er.ToString(); return false; //Log.LogMessage(er.ToString()); } } }
public bool UpdateAnnotation(Annotations annotations) { using (IDbConnection db = new SqlConnection(ConfigurationValues.PostOfficeDatabaseConnection)) { try { const string query = "update [Annotation]" + " set [ActiveDirectoryUser] = @ActiveDirectoyUser " + " , [Name] = @Name " //+ " , [Annotation] = @Annotation " + " where ID = @ID"; int rowsAffectd = db.Execute(query, new { @ActiveDirectoyUser = annotations.ActiveDirectoryUser, @Name = annotations.Name, //@Annotation = annotations.NewAnnotation, @ID = annotations.ID, }); return true; } catch (Exception er) { Logging.LogErrors(ConfigurationValues.ErrorLogPath, er.ToString()); return false; } } }