public void RecordBug(string description,Exception ex) { if (application.Equals(null)) throw new ApplicationException(RM.GetString("")); Bug bug = new Bug() { Application = application, CreateDate = DateTime.Now, CreatedBy = "UNKNOWN", Description = description, isFixed = false, IsActivate = true, ExceptionContent = ObjSerilizator.SerializeToString<Exception>(ex) }; try { BugProvider.Create(bug); } catch (Exception) { throw new ApplicationException(RM.GetString("")); } }
public void Delete(Bug bug) { if (_bugs.Remove(bug) && BugDeleted != null) { BugDeleted(this, new BugEvent(bug)); File.Delete(GetFile(bug)); } }
private void Persist(Bug bug) { EnsureBugStore(); using (FileStream stream = File.Open(GetFile(bug), FileMode.OpenOrCreate)) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, bug); } }
public void PostNewBugWhenTextIsNullShouldReturn400() { var repo = Mock.Create<IBugTrackerData>(); var bug = new Bug { Text = null }; var server = new InMemoryHttpServer<Bug>(InMemoryServerUrl, repo); var response = server.CreatePostRequest("/api/Bugs/Log", bug); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); }
public void RecordBug(Bug bug) { if (application.Equals(null)) throw new ApplicationException(RM.GetString("")); try { BugProvider.Create(bug); } catch (Exception) { throw new ApplicationException(RM.GetString("")); } }
Bug IDataAccess.GetBug(int id) { using (conn = new SQLiteConnection(connectionString)) { conn.Open(); var bug = new Bug(); var reader = new SQLiteCommand(SQLFixedQueries.SelectBug(id), conn) .ExecuteReader(); while (reader.Read()) bug = ReadBugFromSQL(reader); return bug; } }
public void Save(Bug bug) { if (bug.Id == 0) { bug.Id = _bugs.Any() ? _bugs.Max(x => x.Id) + 1 : 1; bug.CreatedOn = DateTime.Now; _bugs.Add(bug); } else { _bugs.Add(bug); } Persist(bug); if (BugSaved != null) { var timer = new Timer(2000); timer.Elapsed += (sender, args) => BugSaved(this, new BugEvent(bug)); timer.Start(); } }
public IResult Open(Bug bug) { return new OpenResult<BugViewModel>() .In<DetailViewModel>() .BeforeActivation(x => x.Bug = bug); }
public BugEvent(Bug bug) { Bug = bug; }
private string GetFile(Bug bug) { return Path.Combine(BugStore, bug.Id + ".dat"); }
private void UpdateBugInDB(Bug bug) { new SQLiteCommand(SQLFixedQueries.UpdateBug(bug.ID, bug.VersionFound, bug.VersionFixed, bug.DetailedDescription, bug.StepsToReproduce, bug.Workaround, bug.Fix), conn).ExecuteNonQuery(); }
private Bug ReadBugFromSQL(SQLiteDataReader reader) { var bug = new Bug(); bug.ID = Convert.ToInt32(reader[1]); bug.VersionFound = reader[2].ToString(); bug.VersionFixed = reader[3].ToString(); bug.DetailedDescription = reader[4].ToString(); bug.StepsToReproduce = reader[5].ToString(); bug.Workaround = reader[6].ToString(); bug.Fix = reader[7].ToString(); return bug; }
private void InsertBugInDB(Bug bug, int issueID) { new SQLiteCommand(SQLFixedQueries.InsertBug(issueID, bug.VersionFound, bug.VersionFixed, bug.DetailedDescription, bug.StepsToReproduce, bug.Workaround, bug.Fix), conn).ExecuteNonQuery(); }
int IDataAccess.SaveBug(Issue issue, Bug bug) { using (conn = new SQLiteConnection(connectionString)) { conn.Open(); if (issue.IssueID == 0 || !IssueExists(issue.IssueID)) { int ID = InsertIssueInDBAndGetID(issue, GetUserID(issue.UserCreated)); InsertBugInDB(bug, ID); return ID; } else { UpdateIssueInDB(issue, GetUserID(issue.UserClosed)); UpdateBugInDB(bug); return issue.IssueID; } } }
public TabBugViewModel(Messenger messenger, DialogCoordinator dialogCoordinator, IDataAccess dataAccess, Bug bug, Issue issue) : base(issue) { this.messenger = messenger; this.dialogCoordinator = dialogCoordinator; this.dataAccess = dataAccess; this.Bug = bug; this.ID = bug.ID; ShowCloseButton = true; TabHeader = "Bug #" + IssueID.ToString(); }