/// <summary> /// Create a new model that fetches data from the specified server. /// </summary> /// <param name="password">The password to the server</param> /// <param name="server">The address of the server.</param> public LogModel(string password, string server) { this.password = password; this.server = server; var conn = DigitalVoterList.GetInstance("groupCJN", this.password, this.server); this.logs = new BindingList<LogDO>(); this.lDAO = new LogDAO(conn); this.vDAO = new VoterDAO(conn); this.Update(); this.filter = new LogFilter(); }
/// <summary> /// Create a new model that fetches data from the specified server. /// </summary> /// <param name="password">The password to the server</param> /// <param name="server">The address of the server.</param> public LogModel(string password, string server) { this.password = password; this.server = server; var conn = DigitalVoterList.GetInstance("groupCJN", this.password, this.server); this.logs = new BindingList <LogDO>(); this.lDAO = new LogDAO(conn); this.vDAO = new VoterDAO(conn); this.Update(); this.filter = new LogFilter(); }
/// <summary> /// React to the GUI's refresh button being clicked by fetching data from the view /// and creating a new filter. /// </summary> public void RefreshClicked() { uint cprInt; uint.TryParse(view.Cpr, out cprInt); uint tableInt; uint.TryParse(view.Table, out tableInt); LogFilter l = new LogFilter() { Activity = view.Activity, Cpr = cprInt != 0 ? cprInt : (uint?)null, From = view.From != view.To ? view.From : (DateTime?)null, Table = tableInt != 0 ? tableInt : (uint?)null, To = view.To != view.From ? view.To : (DateTime?)null }; this.model.UpdateFilter(l); }
public void UpdateFilter(LogFilter f) { this.filter = f; this.logs.Clear(); this.Update(); }