/// <summary> /// Persists a new instance of SavedQuery. /// </summary> /// <returns></returns> public void Save(SavedQuery savedQuery) { if (savedQuery == null) { return; } if (savedQuery.Id == Guid.Empty) { savedQuery.Id = Guid.NewGuid(); if (savedQuery.CreatedBy == Guid.Empty) { savedQuery.CreatedBy = savedQuery.LastModBy; } DBSavedQuery.Create( savedQuery.Id, savedQuery.Name, savedQuery.Statement, savedQuery.CreatedUtc, savedQuery.CreatedBy); } else { DBSavedQuery.Update( savedQuery.Id, savedQuery.Statement, savedQuery.LastModUtc, savedQuery.LastModBy); } }
private List <SavedQuery> LoadListFromReader(IDataReader reader) { List <SavedQuery> savedQueryList = new List <SavedQuery>(); try { while (reader.Read()) { SavedQuery savedQuery = new SavedQuery(); savedQuery.Id = new Guid(reader["Id"].ToString()); savedQuery.Name = reader["Name"].ToString(); savedQuery.Statement = reader["Statement"].ToString(); savedQuery.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]); savedQuery.CreatedBy = new Guid(reader["CreatedBy"].ToString()); savedQuery.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]); savedQuery.LastModBy = new Guid(reader["LastModBy"].ToString()); savedQueryList.Add(savedQuery); } } finally { reader.Close(); } return(savedQueryList); }
public SavedQuery Fetch(string name) { using (IDataReader reader = DBSavedQuery.GetOne(name)) { if (reader.Read()) { SavedQuery savedQuery = new SavedQuery(); savedQuery.Id = new Guid(reader["Id"].ToString()); savedQuery.Name = reader["Name"].ToString(); savedQuery.Statement = reader["Statement"].ToString(); savedQuery.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]); savedQuery.CreatedBy = new Guid(reader["CreatedBy"].ToString()); savedQuery.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]); savedQuery.LastModBy = new Guid(reader["LastModBy"].ToString()); return(savedQuery); } } return(null); }
public SavedQuery Fetch(string name) { using (IDataReader reader = DBSavedQuery.GetOne(name)) { if (reader.Read()) { SavedQuery savedQuery = new SavedQuery(); savedQuery.Id = new Guid(reader["Id"].ToString()); savedQuery.Name = reader["Name"].ToString(); savedQuery.Statement = reader["Statement"].ToString(); savedQuery.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]); savedQuery.CreatedBy = new Guid(reader["CreatedBy"].ToString()); savedQuery.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]); savedQuery.LastModBy = new Guid(reader["LastModBy"].ToString()); return savedQuery; } } return null; }
private List<SavedQuery> LoadListFromReader(IDataReader reader) { List<SavedQuery> savedQueryList = new List<SavedQuery>(); try { while (reader.Read()) { SavedQuery savedQuery = new SavedQuery(); savedQuery.Id = new Guid(reader["Id"].ToString()); savedQuery.Name = reader["Name"].ToString(); savedQuery.Statement = reader["Statement"].ToString(); savedQuery.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]); savedQuery.CreatedBy = new Guid(reader["CreatedBy"].ToString()); savedQuery.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]); savedQuery.LastModBy = new Guid(reader["LastModBy"].ToString()); savedQueryList.Add(savedQuery); } } finally { reader.Close(); } return savedQueryList; }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByCreatedUtc(SavedQuery savedQuery1, SavedQuery savedQuery2) { return(savedQuery1.CreatedUtc.CompareTo(savedQuery2.CreatedUtc)); }
void btnSave_Click(object sender, EventArgs e) { if (txtQuery.Text.Trim().Length == 0) { lblError.Text = DevTools.NoQueryWarning; return; } if (txtQueryName.Text.Trim().Length == 0) { lblError.Text = DevTools.QueryNameRequired; return; } SavedQuery q = repository.Fetch(txtQueryName.Text); if (q == null) { q = new SavedQuery(); } q.Statement = txtQuery.Text; q.Name = txtQueryName.Text; if (currentUser != null) { q.LastModBy = currentUser.UserGuid; } q.LastModUtc = DateTime.UtcNow; repository.Save(q); RedirectToQuery(q.Id.ToString()); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByName(SavedQuery savedQuery1, SavedQuery savedQuery2) { return(savedQuery1.Name.CompareTo(savedQuery2.Name)); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByStatement(SavedQuery savedQuery1, SavedQuery savedQuery2) { return(savedQuery1.Statement.CompareTo(savedQuery2.Statement)); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByLastModUtc(SavedQuery savedQuery1, SavedQuery savedQuery2) { return(savedQuery1.LastModUtc.CompareTo(savedQuery2.LastModUtc)); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByCreatedUtc(SavedQuery savedQuery1, SavedQuery savedQuery2) { return savedQuery1.CreatedUtc.CompareTo(savedQuery2.CreatedUtc); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByStatement(SavedQuery savedQuery1, SavedQuery savedQuery2) { return savedQuery1.Statement.CompareTo(savedQuery2.Statement); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByName(SavedQuery savedQuery1, SavedQuery savedQuery2) { return savedQuery1.Name.CompareTo(savedQuery2.Name); }
/// <summary> /// Compares 2 instances of SavedQuery. /// </summary> public static int CompareByLastModUtc(SavedQuery savedQuery1, SavedQuery savedQuery2) { return savedQuery1.LastModUtc.CompareTo(savedQuery2.LastModUtc); }