//Returns the tile where a bug is placed public BoardTile GetBugTile(Bug bug) { for (int i = 0; i < HeightInTiles; ++i) for (int j = 0; j < WidthInTiles; ++j) if (tiles[i][j].GetBug() == bug) return tiles[i][j]; return null; }
public IHttpActionResult PutBug(int id, Bug bug) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != bug.Id) { return BadRequest(); } //db.Entry(bug).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BugExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
GetDupe(int id) { Bugzilla bugz = new Bugzilla("http://bugzilla.gnome.org/"); BugDB.bugz = bugz; bug = new Bug(id,bugz); bug.getStacktrace(new Response(grabStacktrace,null,bug)); }
//Called when you want to create a bug in this tile public void CreateBug() { int rand = Random.Range(0, 4); string resPath = "Bugs/Bug" + rand.ToString(); //Create a random bug (Bug0||Bug1||Bug2||Bug3) GameObject go = GameObject.Instantiate(Resources.Load(resPath), worldPos, Quaternion.identity) as GameObject; bug = go.GetComponent<Bug>(); }
public void GeneralWorkItemTest() { Bug item = new Bug() { ID = 123, Title = "Bug A", Description = "Bug Description.", Type = BugType.Red, AssignedTo = "BigEgg", State = "Active", ChangedDate = DateTime.Today, CreatedBy = "BigEgg", Priority = "High", Severity = "1" }; Assert.AreEqual(123, item.ID); Assert.AreEqual("Bug A", item.Title); Assert.AreEqual("Bug Description.", item.Description); Assert.AreEqual(BugType.Red, item.Type); Assert.AreEqual("BigEgg", item.AssignedTo); Assert.AreEqual("Active", item.State); Assert.AreEqual(DateTime.Today, item.ChangedDate); Assert.AreEqual("BigEgg", item.CreatedBy); Assert.AreEqual("High", item.Priority); Assert.AreEqual("1", item.Severity); Bug item2 = new Bug(); Assert.AreEqual(BugType.Yellow, item2.Type); }
protected void btnSave_Click(object sender, EventArgs e) { Bug b = new Bug(); try { b.IItemID = Convert.ToInt32(ddlCRPRTDR.SelectedValue.ToString()); b.vcQAPhaseSumm = txtQAPhaseComment.Text; b.vcUATPhaseSumm = txtUATPhaseComment.Text; b.vcPostDepPhaseSumm = txtPostDepPhaseComment.Text; b.vcINTPhaseSumm = txtIntPhaseComment.Text; b.SiQACount = Convert.ToInt16(txtQACount.Text); b.SiUATCount = Convert.ToInt16(txtUATCount.Text); b.SiPDCount = Convert.ToInt16(txtPDCount.Text); b.SiINTCount = Convert.ToInt16(txtIntCount.Text); if (BugsDAL.AddBug(b) > 0) ErrorMessage = "Record inserted successfully."; else ErrorMessage = "No record inserted."; ClearFields(); FillData(); } catch (Exception exc) { ErrorMessage = exc.Message; } }
public Pheromone(PheromoneType type, Vector3 target, Bug dropper) { Type = type; Target = target; Dropper = dropper; m_InstanciationTime = Time.time; }
public IHttpActionResult PostNewBug(PostNewBugBindingModel model) { if (model == null) { return this.BadRequest("Model is null."); } if (!this.ModelState.IsValid) { return this.BadRequest(this.ModelState); } var newBug = new Bug { Title = model.Title, Description = model.Description, Status = Status.Open, DateCreated = DateTime.Now }; var loggedUserId = this.User.Identity.GetUserId(); if (loggedUserId != null) { var userInDb = this.Data.Users.All() .FirstOrDefault(u => u.Id == loggedUserId); if (userInDb == null) { return this.BadRequest("Invalid token"); } newBug.AuthorId = loggedUserId; this.Data.Bugs.Add(newBug); this.Data.SaveChanges(); return this.CreatedAtRoute( "DefaultApi", new { Id = newBug.Id }, new { Id = newBug.Id, Author = userInDb.UserName, Message = "User bug submitted." }); } this.Data.Bugs.Add(newBug); this.Data.SaveChanges(); return this.CreatedAtRoute( "DefaultApi", new { Id = newBug.Id }, new { Id = newBug.Id, Message = "Anonymous bug submitted." }); }
public Bug Post(Bug bug) { string uniqueName = GetUniqueName(); bug.Name = uniqueName; bug.PriorityIndex = 1; Repository.Add(bug); return bug; }
private void CreateMessageForContact (Bug bug) { var bugInstance = Instantiate (bugMessagePrefab); bugInstance.transform.SetParent (BugsContainer, false); bugInstance.Initialize (_app, bug); _messages [bug.GetName ()] = bugInstance; }
public BugModel(Bug bug) { this.BugId = bug.BugId; this.AppId = bug.AppId; this.Desc = bug.Desc; this.EnterDate = bug.EnterDate; this.ResolveDate = bug.ResolveDate; this.ResolutionNotes = bug.ResolutionNotes; this.ErrorSeverityCode = bug.ErrorSeverityCode; }
public IHttpActionResult PostBug(Bug bug) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Bugs.Add(bug); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = bug.Id }, bug); }
public IHttpActionResult Log(string bugDescription) { if (!this.ModelState.IsValid) { return this.BadRequest(this.ModelState); } var newBug = new Bug { Text = bugDescription, LogDate = DateTime.Now, Status = Status.Pending }; this.bugData.Bugs.Add(newBug); this.bugData.SaveChanges(); return this.Ok(newBug.Id); }
public BugViewModel(Bug bug) { this.BugId = bug.BugId; this.TesterId = ((bug.UserId == null) ? (0) : ((int) bug.UserId) ); this.TesterName = ((bug.UserId == null) ? ("No Author") : (bug.UserProfile.UserName)); this.ProjectId = bug.ProjectId; this.ProjectName = bug.Project.ProjectName; this.Priority = bug.Priority; this.PriorityId = GetPriorityId(this.Priority); this.Status = bug.Status; this.StatusId = GetStatusId(this.Status); this.DiscoverDate = bug.DiscoverDate; this.Description = bug.Description; }
public void AddShouldChangeData() { var testBug = new Bug { Id = Guid.NewGuid(), Text = "Test bug", LogDate = DateTime.Now }; var mockedBugsService = new Mock<IBugsService>(); mockedBugsService.Setup(s => s.Add(testBug)).Verifiable(); mockedBugsService.Object.Add(testBug); mockedBugsService.Verify(s => s.Add(testBug)); }
public IHttpActionResult AddNewBug(BugRequestModel bug) { if (bug == null) { return this.BadRequest(); } var bugToAdd = new Bug { Text = bug.Text, LogDate = DateTime.Now, }; Bug result = this.bugs.Add(bugToAdd); return this.Ok(result); }
public void EqualsTest() { Bug item1 = new Bug() { ID = 123, Title = "Bug A", Description = "Bug Description.", Type = BugType.Red, AssignedTo = "BigEgg", State = "Active", ChangedDate = DateTime.Today, CreatedBy = "BigEgg", Priority = "High", Severity = "1" }; Bug item2 = new Bug() { ID = 124, Title = "Bug A", Description = "Bug Description.", Type = BugType.Red, AssignedTo = "BigEgg", State = "Active", ChangedDate = DateTime.Today, CreatedBy = "BigEgg", Priority = "High", Severity = "1" }; Bug item3 = new Bug() { ID = 124, Title = "Bug A", Description = "Bug Description.", Type = BugType.Red, AssignedTo = "BigEgg", State = "Active", ChangedDate = DateTime.Today, CreatedBy = "BigEgg", Priority = "High", Severity = "1" }; Assert.IsFalse(item1.Equals(item2)); Assert.IsTrue(item2.Equals(item3)); }
private static void Seed() { var context = new BugTrackerDbContext(); var comment =new Comment() { Text = "First comment", CreatedOn = DateTime.Now }; context.Comments.Add(comment); var bug = new Bug() { Title = "First bug", Description = "Bug 1", SubmitDate = DateTime.Now }; bug.Comments.Add(comment); context.Bugs.Add(bug); context.SaveChanges(); }
public void MSUnit_TestBugDodges(bool didDodge, bool shouldBeDead) { Bug bug = new Bug(); PlassGun gun = new PlassGun(); if (didDodge) { bug.Dodge(); } gun.FireAt(bug); if (shouldBeDead) { Assert.IsTrue(bug.IsDead()); } else { Assert.IsFalse(bug.IsDead()); } }
public void TestBugDodges(bool didDodge, bool shouldBeDead) { Bug bug = new Bug(); Raygun gun = new Raygun(); if (didDodge) { bug.Dodge(); } gun.FireAt(bug); if (shouldBeDead) { Assert.True(bug.IsDead()); } else { Assert.False(bug.IsDead()); } }
public Bug getBugById(int id) { String sql = "SELECT b.id,b.name,b.package_name,b.class,b.method,b.line_start,b.line_end,b.status,b.date,b.image,b.code,u.username,p.title FROM tbl_bug AS b,tbl_project AS p,tbl_user AS u WHERE b.project_id=p.id AND b.user_id=u.id AND b.id=@id"; try { conn.Open(); MySqlCommand sqlCommand = new MySqlCommand(sql, conn); sqlCommand.Parameters.AddWithValue("@id", id); MySqlDataReader result = sqlCommand.ExecuteReader(); while (result.Read()) { bug = new Bug(); bug.Id = result.GetInt32(result.GetOrdinal("id")); bug.BugName = result.GetString(result.GetOrdinal("name")); bug.PackageName = result.GetString(result.GetOrdinal("package_name")); bug.ClassName = result.GetString(result.GetOrdinal("class")); bug.MethodName = result.GetString(result.GetOrdinal("method")); bug.LineStart = result.GetInt32(result.GetOrdinal("line_start")); bug.LineEnd = result.GetInt32(result.GetOrdinal("line_end")); bug.BugAddedDate = result.GetDateTime(result.GetOrdinal("date")); bug.Status = result.GetBoolean(result.GetOrdinal("status")); bug.BugAuthor = result.GetString(result.GetOrdinal("username")); bug.ProjectName = result.GetString(result.GetOrdinal("title")); bug.CodeBlock = result.GetString(result.GetOrdinal("code")); byte[] img = (byte[])(result[result.GetOrdinal("image")]); bug.Image = img; return(bug); // project.Id = result.GetInt32(result.GetOrdinal("id")); } } catch (Exception e) { MessageBox.Show(" project bug" + e.Message); } return(null); }
}//end box list /// <summary> /// this method will save the data into the method or update the data based on the passed in id /// </summary> /// <param name="sender">sender object</param> /// <param name="e"> arguments e</param> private void Save_Bug_Click(object sender, EventArgs e) { Bugs bugs = new Bugs(); Bug bug = (Bug)BugListBox.SelectedValue; try { int bugID = Int32.Parse(BugID.Text.ToString()); //int userID = DateTime bugSubmitDate = Convert.ToDateTime(DateTime.UtcNow.Date); string bugDesc = BugDesc.Text.ToString(); string bugDetails = bugDetail.Text.ToString(); string bugRepSteps = bugRepStep.Text.ToString(); // string bugUpdate = BugUpdateComment.Text.ToString(); if (bug.BugID == 0) { bugs.InsertBug(bugAppID, currentlyLoggedInUserId, bugSubmitDate, bugDesc, bugDetails, bugRepSteps); LoadBugList(); //inserting and loading bug } else { bugs.UpdateBug(currentlyLoggedInUserId, bugDesc, bugDetails, bugRepSteps, bugFixDate, bugID, currentSatusID); LoadBugList(); //updating and loading bug } } catch (SqlException sqlex) { DisplayErrorMessage(sqlex.Message); } catch (Exception sqlex) { DisplayErrorMessage(sqlex.Message); } }//end save bug_click
public async Task <IActionResult> Create(IFormCollection collection, Bug bug) { if (ModelState.IsValid) { if (_context.User.Any(u => u.Name == bug.User.Name) & bug.User.Name != null) { UsersModel user = await _context.User.FirstAsync(u => u.Name == bug.User.Name); //add new bug to existing users Bug newbug = new Bug { Description = bug.Description, Title = bug.Title, IsOpen = bug.IsOpen, Opened = bug.Opened, User = user }; _context.Bugs.Add(bug); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { Bug newbug = new Bug { Description = bug.Description, Title = bug.Title, IsOpen = bug.IsOpen, Opened = bug.Opened, User = null }; _context.Bugs.Add(bug); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(bug)); }
public IHttpActionResult PostBug([FromBody] BugBindingModel bugModel) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } var userId = this.User.Identity.GetUserId(); User user = null; if (userId != null) { user = this.Data.Users.Find(userId); } var bug = new Bug() { Title = bugModel.Title, Description = bugModel.Description, Author = user, Status = BugStatus.Open, PublishDate = DateTime.Now }; this.Data.Bugs.Add(bug); this.Data.SaveChanges(); if (user == null) { return(this.CreatedAtRoute( "DefaultApi", new { id = bug.Id, controller = "bugs" }, new { bug.Id, Message = "Anonymous bug submitted." })); } return(this.CreatedAtRoute( "DefaultApi", new { id = bug.Id, controller = "bugs" }, new { bug.Id, Author = User.Identity.GetUserName(), Message = "User bug submitted." })); }
public IHttpActionResult CreateBug([FromBody] NewBugBindingModel bugsData) { if (bugsData == null) { return BadRequest(); } if (!ModelState.IsValid) { return BadRequest(ModelState); } var currentUserId = User.Identity.GetUserId(); var currentUser = this.db.Users.Find(currentUserId); var bug = new Bug { Title = bugsData.Title, Author = currentUser, SubmitDate = DateTime.Now, Description = bugsData.Description, Status = BugStatus.Open }; db.Bugs.Add(bug); db.SaveChanges(); if (bug.Author == null) { return this.CreatedAtRoute( "DefaultApi", new { controller = "bugs", id = bug.Id }, new { bug.Id, Message = "Anonymous bug submitted." } ); } return this.CreatedAtRoute( "DefaultApi", new { controller = "bugs", id = bug.Id }, new { bug.Id, Author = bug.Author.UserName, Message = "User bug submitted." } ); }
void ProcessPheromone(Pheromone pheromone) { // Flee for your life if (m_Behaviour == BugBehaviour.Fleeing) { return; } switch (pheromone.Type) { case (Pheromone.PheromoneType.Ennemy): m_Behaviour = BugBehaviour.Fleeing; break; case (Pheromone.PheromoneType.Mating): if (pheromone.Dropper != this) { if (Time.time - TimeTilReadyForMating.value < m_InstanciationTime) { return; } m_Behaviour = BugBehaviour.SeekingMate; m_TargetPosition = pheromone.Target; m_Mate = pheromone.Dropper; } break; case (Pheromone.PheromoneType.Food): m_Behaviour = BugBehaviour.Gathering; m_TargetPosition = pheromone.Target; break; case (Pheromone.PheromoneType.Home): if (m_Behaviour == BugBehaviour.Gathering) { m_TargetPosition = pheromone.Target; } break; } }
private void BuildBugs() { var yourBug = new Bug(); var myBug = new Bug(); while (true) { var partAdded = TryBuild(yourBug, m => m.You); Thread.Sleep(500); _io.WriteLine(); partAdded |= TryBuild(myBug, m => m.I); if (partAdded) { if (yourBug.IsComplete) { _io.WriteLine("Your bug is finished."); } if (myBug.IsComplete) { _io.WriteLine("My bug is finished."); } if (!_io.ReadString("Do you want the picture").Equals("no", InvariantCultureIgnoreCase)) { _io.Write(yourBug.ToString("Your", 'A')); _io.WriteLine(); _io.WriteLine(); _io.WriteLine(); _io.WriteLine(); _io.Write(myBug.ToString("My", 'F')); } } if (yourBug.IsComplete || myBug.IsComplete) { break; } } }
// TODO Add Exceptions when no prefabs are assigned in Editor void Awake() { Assert.IsNotNull(BugPrefab, "[Manager Awake] BugPrefab is NULL"); Assert.IsNotNull(AttractorPrefab, "[Manager Awake] AttractorPrefab is NULL"); // Create the Attractor GameObject attractor = Instantiate(AttractorPrefab, Vector3.zero, Quaternion.identity); attractor.name = "Attractor"; attractor.tag = "Attractor"; // Create the Bugs empty parent object GameObject bugsRoot = new GameObject(); bugsRoot.name = "Bugs"; // Create the Bugs object pool bugsPool = new List <GameObject> (); for (int i = 0; i < Setup.maxBugs; i++) { // TODO make OBJ & BC reference the same thing, it's confusing here GameObject obj = Instantiate(BugPrefab, Vector3.zero, Quaternion.identity); Bug bc = obj.GetComponent <Bug> (); // obj.name = "Bug " + i + " (" + bc.gender + ")"; obj.name = "Bug " + i; obj.transform.parent = bugsRoot.transform; bc.AddAttractor(attractor); obj.SetActive(false); bugsPool.Add(obj); } // Setup the population slider min, max and default sliderBugsCount = GameObject.Find("SliderBugsCount").GetComponent <Slider> (); sliderBugsCount.maxValue = (float)Setup.maxBugs; sliderBugsCount.minValue = 0f; sliderBugsCount.value = Setup.startBugs; requestedBugs = (int)sliderBugsCount.value; Debug.Log("-- END MAIN AWAKE --"); Debug.Log("Requested bugs = " + requestedBugs); }
///<summary>Inserts one Bug into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(Bug bug, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO bug ("; if (!useExistingPK && isRandomKeys) { bug.BugId = ReplicationServers.GetKeyNoCache("bug", "BugId"); } if (isRandomKeys || useExistingPK) { command += "BugId,"; } command += "CreationDate,Status_,Type_,PriorityLevel,VersionsFound,VersionsFixed,Description,LongDesc,PrivateDesc,Discussion,Submitter) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(bug.BugId) + ","; } command += POut.DateT(bug.CreationDate) + "," + "'" + POut.String(bug.Status_.ToString()) + "', " + "'" + POut.String(bug.Type_.ToString()) + "', " + POut.Int(bug.PriorityLevel) + "," + "'" + POut.String(bug.VersionsFound) + "'," + "'" + POut.String(bug.VersionsFixed) + "'," + "'" + POut.String(bug.Description) + "'," + "'" + POut.String(bug.LongDesc) + "'," + "'" + POut.String(bug.PrivateDesc) + "'," + "'" + POut.String(bug.Discussion) + "'," + POut.Long(bug.Submitter) + ")"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { bug.BugId = Db.NonQ(command, true, "BugId", "bug"); } return(bug.BugId); }
/// <summary> /// /// </summary> /// <param name="bug"></param> /// <returns></returns> public bool UpdateBug(BBug bug) { if (bug.Modified_By == null) { throw new KMJXCException("更新Bug时必须有更新人"); } bool result = false; using (KuanMaiEntities db = new KuanMaiEntities()) { Bug existed = (from b in db.Bug where b.ID == bug.ID select b).FirstOrDefault <Bug>(); if (existed == null) { throw new KMJXCException("所需更新的Bug信息不存在"); } if (bug.Status != null) { existed.Status = bug.Status.ID; } if (bug.Modified_By != null) { existed.Modified_By = bug.Modified_By.ID; existed.Modified = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now); } if (!string.IsNullOrEmpty(bug.Title)) { existed.Title = bug.Title; } if (!string.IsNullOrEmpty(bug.Description)) { existed.Description = bug.Description; } db.SaveChanges(); result = true; } return(result); }
public IHttpActionResult Get(BugModel model) { if (!ModelState.IsValid) { return(BadRequest()); } var bug = new Bug() { Text = model.Text, LogDate = DateTime.Now.Date, Status = model.Status, }; this.data.Bugs.Add(bug); this.data.SaveChanges(); model.id = bug.Id; model.LogDate = bug.LogDate; return(Ok(model)); }
//Public method for a bug to call once it has been clicked public void BugClicked(GameObject bug) { bugsClicked++; //Zooms camera in on bug Camera.main.orthographic = true; Camera.main.transform.position = Camera.main.ScreenToWorldPoint( new Vector3(Input.mousePosition.x, Input.mousePosition.y - Mathf.Floor(Screen.height / 20), Input.mousePosition.z)); zoomingIn = true; levelSubmitButton.gameObject.SetActive(false); bugSelectionUI.SetActive(true); bugButtons.SetActive(true); bugSelectionText.SetActive(true); //Hide the ruler when bug has been clicked //ruler.SetActive(false); //GameObject ruler = GameObject.Find("Ruler"); /* * Image rulerImage = ruler.GetComponent<Image>(); * var tempColor = rulerImage.color; * tempColor.a = 0f; * rulerImage.color = tempColor; */ //InputField measurementInput = lengthUI.GetComponentInChildren<InputField>(); //measurementInput.onEndEdit.AddListener(delegate {EvaluateMeasurement(measurementInput); }); //bugUISubmitButton = GameObject.Find("BugUISubmit").GetComponent<Button>();//bugSelectionUI.GetComponentInChildren<Button>(); //lengthSubmit.GetComponent<Button>().onClick.AddListener(delegate {BugUISubmit(); }); Utilities.PauseBugs(); TimerScript.PauseTime(); //MagnifyGlass.DisableZoom(); currentBugScript = bug.GetComponent <Bug>(); selectedBug = currentBugScript.classification; }
public void EditExistingBug_NoDataSend_ShouldReturn400BadRequest() { // Arrange -> create a new bug var data = new BugTrackerDataMock(); var bug = new Bug() { Id = 1, Title = "test", Status = Status.Open }; data.Bugs.Add(bug); var controller = new BugsController(data); this.SetupControllerForTesting(controller, "bugs"); // Act -> edit the above created bug var httpResponse = controller.PatchEditBug(1, null) .ExecuteAsync(new CancellationToken()).Result; // Assert -> 404 Not found Assert.AreEqual(HttpStatusCode.BadRequest, httpResponse.StatusCode); }
// GET: Bugs/Delete/5 public async Task <ActionResult> Delete(int?id, string prevPage) { string ustp = helper.CheckCk(); if (!ustp.Equals("admin")) { return(RedirectToAction("Index", "Home")); } ViewBag.urlPrev = prevPage; ViewBag.msg = ustp; if (id == null) { return(RedirectToAction("BadReq", "Error")); } Bug bug = await _db.Bug.FindAsync(id); if (bug == null) { return(RedirectToAction("NotFound", "Error")); } return(View(bug)); }
public void InputBugNameIsNULL_Should() { string bugName = null; string description = "MegaBadBug"; Priority priority = Priority.High; List <string> stepsToProduce = new List <string> { "steps" }; var bug = new Bug(bugName, description, stepsToProduce); database.Bugs.Add(bug); List <string> parameters = new List <string> { bugName, priority.ToString() }; ChangeBugSeverityCommand command = new ChangeBugSeverityCommand(parameters); command.Execute(); }
internal List <Bug> GetBugsFromDb() { var bugs = new List <Bug>(); var connection = new MySqlConnection(_connectionString); var command = new MySqlCommand("SELECT * from tblbug", connection); connection.Open(); var dataReader = command.ExecuteReader(); while (dataReader.Read()) { var _bug = new Bug( Convert.ToInt32(dataReader["id"]), Convert.ToString(dataReader["description"]) ); bugs.Add(_bug); } connection.Close(); return(bugs); }
public Bug Save(Bug bug, Guid?modifiedById = null) { try { if (bug.Id != 0) { //var oldBug = _context.Bugs.All().Single(b => b.Id == bug.Id); var oldBug = new Bug(); var history = new BugHistory { Id = Guid.NewGuid(), ModifiedBy = null, ModifiedDate = DateTime.Now, ModifiedById = modifiedById.Value }; if (oldBug.Name != bug.Name) { history.Name = oldBug.Name; } if (bug.History == null) { bug.History = new List <BugHistory>(); } bug.History.Add(history); _context.Bugs.Update(bug); } else { bug = _context.Bugs.Create(bug); } } catch (Exception ex) { _logger.ErrorFormat("Exception: {0}", ex.ToString()); return(null); } return(bug); }
private void FormBugSubmission_Load(object sender, EventArgs e) { textStack.Text = _sub.ExceptionMessageText + "\r\n" + _sub.ExceptionStackTrace; labelRegKey.Text = _sub.RegKey; labelDateTime.Text = POut.DateT(_sub.SubmissionDateTime); labelVersion.Text = _sub.Info.DictPrefValues[PrefName.ProgramVersion]; if (_sub.BugId != 0) //Already associated to a bug { _bug = Bugs.GetOne(_sub.BugId); butAddViewBug.Text = "View Bug"; } if (_bug != null) { _listLinks = JobLinks.GetForType(JobLinkType.Bug, _bug.BugId); if (_listLinks.Count == 1) { butAddViewJob.Text = "View Job"; } } FillOfficeInfoGrid(_sub); SetCustomerInfo(_sub); }
/// <summary> /// Just as ants can see various types of food, they can /// also visually detect other game elements. This method /// is called if the ant sees a bug. /// Read more: "http://wiki.antme.net/en/API1:SpotsEnemy(Bug)" /// </summary> /// <param name="bug">spotted bug</param> public override void SpotsEnemy(Bug bug) { // Radius of 150 is optimal: // a) not to small (we need friends to help us) // b) not to big (if too big our friend might be too late for the fight) MakeOtherAntsAwareOfBug(150); // Apples are besides bugs the main source for gathering points. // Therefore only attack bugs if not currently carrying an apple. if (!IsCarryingApple) { Drop(); // Sugar is less important if (FriendlyAntsInViewrange >= 3) // Not alone! { Attack(bug); } else // Follow as long there aren't enough friendly ants. { GoToDestination(bug); } } }
private void btn_aceptar_Click(object sender, EventArgs e) { try { if (validarCampos()) { //Creamos una instancia de Bug Bug nuevoBug = new Bug(); nuevoBug.titulo = txtTitulo.Text; nuevoBug.descripcion = txtDescripcion.Text; nuevoBug.id_estado = 1; // Estado "Nuevo" nuevoBug.id_prioridad = (int)cboPrioridad.SelectedValue; nuevoBug.id_criticidad = (int)cboCriticidad.SelectedValue; nuevoBug.id_producto = (int)cboProducto.SelectedValue; HistorialBug historial = new HistorialBug(); historial.responsable = frmPrincipal.obtenerUsuarioLogin().id_usuario; historial.fecha = DateTime.Now; nuevoBug.addHistorial(historial); if (bugService.crearBug(nuevoBug)) { MessageBox.Show("El bug se creó correctamente", "Nuevo Bug", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("No pudo crear el Bug", "Nuevo Bug", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { MessageBox.Show("Se produjo el siguiente error al crear un bug: " + ex.Message, "Error creando Bug", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IActionResult Index(MyBugAddViewModel myBugAddViewModel) { if (ModelState.IsValid) { if (myBugAddViewModel.category.CatID == 0) { ModelState.AddModelError("", "Select Category"); return(View(myBugAddViewModel)); } var SubCategoryID = HttpContext.Request.Form["SubCatId"].ToString(); if (SubCategoryID == "0") { ModelState.AddModelError("", "Select SubCategory"); return(View(myBugAddViewModel)); } Bug bug = myBugAddViewModel.bug; bug.SubCategoryId = Int32.Parse(SubCategoryID); bug.ApplicationUserId = userManager.GetUserId(User); bug.IssueDate = DateTime.Now; BugRepository.AddBug(bug); return(RedirectToAction("Index")); } var id = userManager.GetUserId(User); IEnumerable <Bug> bugs = BugRepository.GetAllBugsOfUser(id); myBugAddViewModel.bugs = bugs; List <Category> categories = CategoryRepository.GetAllCategory().ToList(); categories = (from category in categories select category).ToList(); categories.Insert(0, new Category { CatID = 0, CatName = "Select Category", }); ViewBag.ListOfCategory = categories; return(View(myBugAddViewModel)); }
public static void DoMorph(List <Bug> bugs, Bug bug, AnimationService animationService, Ship ship) { bug.MorphCount++; if (bug.MorphCount == 1) { SetSpriteType(bug); bug.preMorphedSpriteDownFlap = bug.SpriteBank[0]; bug.preMorphedSprite = bug.Sprite; bug.SpriteBank.Clear(); bug.SpriteBank.Add(new Sprite(Sprite.SpriteTypes.RedGreenBug_DownFlap)); } else if (bug.MorphCount == 10) { bug.Sprite = new Sprite(Sprite.SpriteTypes.RedGreenBug); } else if (bug.MorphCount == 15) { var morphedbug = CreateMorphedBug(animationService, bug, true); EnemyDiveManager.DoEnemyDive(bugs, animationService, ship, Constants.BugDiveSpeed, morphedbug, false, false); } else if (bug.MorphCount == 17) { var morphedbug = CreateMorphedBug(animationService, bug, false); EnemyDiveManager.DoEnemyDive(bugs, animationService, ship, Constants.BugDiveSpeed, morphedbug, false, false); } else if (bug.MorphCount == 19) { var morphedbug = CreateMorphedBug(animationService, bug, false); EnemyDiveManager.DoEnemyDive(bugs, animationService, ship, Constants.BugDiveSpeed, morphedbug, false, false); } else if (bug.MorphCount == 20) { bug.DestroyImmediately = true; bug.MorphCount = 0; bug.preMorphedSprite = null; bug.preMorphedSpriteDownFlap = null; } }
/// <summary> /// Adding Bug to current project or to Epic. /// </summary> /// <param name="place"> Epic or Project that Bug is adding to.</param> private void MakeNewBug(object place) { Bug newBug = new Bug(nameTextBox.Text); if (usersCheckedListBox.CheckedItems.Count != 0) { newBug.users = new User(usersCheckedListBox.CheckedItems[0].ToString()); } if (place is Project project) { if (project.Tasks.Select(x => x.Name).Contains(nameTextBox.Text)) { MessageBox.Show("У задач должны быть уникальные имена"); return; } CurProject.AddTask(newBug); } else { ((Epic)place).AddTask(newBug); } }
public void BugCreation_Execute_SameTitleAlreadyExists_ThrowEx() { //Arrange CommonInstances.CreateTestInstances(); var fakeProvider = new FakeWorkItemProvider(); var fakeCurrBoard = Commons.currentBoard; var listParams = new List <string>() { "WorkItemTitle", "WorkItemDescription", "High", "Critical" }; var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical); fakeProvider.Add(workItem); var sut = new CreateBugCommand(listParams, fakeProvider); //Act & Assert Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Bug already exists!"); }
private Bug mapBug(DataRow row) { Bug oBug = new Bug(); string sql; HistorialBug oHistorial_bug; oBug.id_bug = Convert.ToInt32(row["id_bug"].ToString()); oBug.titulo = row["titulo"].ToString(); oBug.descripcion = row["descripcion"].ToString(); oBug.fecha_alta = Convert.ToDateTime(row["fecha_alta"].ToString()); oBug.id_producto = Convert.ToInt32(row["id_producto"].ToString()); oBug.id_prioridad = Convert.ToInt32(row["id_prioridad"].ToString()); oBug.id_criticidad = Convert.ToInt32(row["id_criticidad"].ToString()); oBug.n_producto = row["nombre"].ToString(); oBug.n_criticidad = row["n_criticidad"].ToString(); oBug.estado = row["estado"].ToString(); sql = "SELECT h.*, e.n_estado, u.n_usuario n_responsable, (SELECT TOP 1 n_usuario FROM Users t1 LEFT JOIN Historiales_Bug t2 ON t1.id_usuario = t2.asignado_a WHERE t2.id_bug = h.id_bug) as n_asignado_a FROM Historiales_Bug h, estados e, users u WHERE(h.id_estado = e.id_estado) AND h.responsable = u.id_usuario AND h.id_bug =" + oBug.id_bug.ToString(); foreach (DataRow detail in BDHelper.getBDHelper().ConsultaSQL(sql).Rows) { oHistorial_bug = new HistorialBug(); oHistorial_bug.id_detalle = Convert.ToInt32(detail["id_detalle"].ToString()); oHistorial_bug.responsable = Convert.ToInt32(detail["responsable"].ToString()); if (!Convert.IsDBNull(detail["asignado_a"])) { oHistorial_bug.asignado_a = Convert.ToInt32(detail["asignado_a"].ToString()); oHistorial_bug.n_asignado_a = detail["n_asignado_a"].ToString(); } oHistorial_bug.estado = Convert.ToInt32(detail["id_estado"].ToString()); oHistorial_bug.fecha = Convert.ToDateTime(detail["fecha"].ToString()); oHistorial_bug.n_responsable = detail["n_responsable"].ToString(); oHistorial_bug.n_estado = detail["n_estado"].ToString(); oBug.addHistorial(oHistorial_bug); } return(oBug); }
partial void CreateNewBug_InitializeDataWorkspace(global::System.Collections.Generic.List<global::Microsoft.LightSwitch.IDataService> saveChangesTo) { var bug = new Bug(); var applicationData = DataWorkspace.ApplicationData; var tester = (from testers in applicationData.Testers where testers.UserName == Application.Current.User.Name select testers).SingleOrDefault(); if (tester == null) { tester = applicationData.Testers.AddNew(); tester.UserName = Application.Current.User.Name; } bug.Tester = tester; bug.Status = "New"; this.BugProperty = bug; }
public IHttpActionResult SubmitBug(SubmitBugInputModel bugData) { if (bugData == null) { return(BadRequest("Missing bug data.")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var currentUserId = User.Identity.GetUserId(); var bug = new Bug() { Title = bugData.Title, Description = bugData.Description, Status = BugStatus.Open, AuthorId = currentUserId, DateCreated = DateTime.Now }; db.Bugs.Add(bug); db.SaveChanges(); if (currentUserId != null) { return(this.CreatedAtRoute( "DefaultApi", new { id = bug.Id }, new { bug.Id, Author = User.Identity.GetUserName(), Message = "User bug submitted." })); } return(this.CreatedAtRoute( "DefaultApi", new { id = bug.Id }, new { bug.Id, Message = "Anonymous bug submitted." })); }
public static void Main(string[] args) { Bugzilla bugz = new Bugzilla("http://bugzilla.gnome.org/"); BugDB.bugz = bugz; DirectoryInfo di = new DirectoryInfo(cachepath); foreach (int i in BugDB.DB.allBugs()) { if (!File.Exists("cache/"+String.Concat(i))) { BugDB.DB.remove(i); Console.WriteLine("removing {0}",i); } } //throw new Exception(); foreach(FileInfo f in di.GetFiles()) { if (f.Name.IndexOf("-")!=-1) continue; try { Console.WriteLine("bug? {0}",f.Name); int id = Int32.Parse(f.Name); if (BugDB.DB.getExisting(id)!=null) continue; Console.WriteLine("Added bug {0}",id); Bug b = new Bug(id,bugz); todo.Enqueue(b); if (todo.Count>5) break; } catch (FormatException) {} // ignore. non-id files } //throw new Exception(); nextBug(null,null,null); Application.Init(); Application.Run(); }
void Start() { foreach (var p in playerPrefabs) { if (p.GetComponent(typeof(PlayerBehaviour))) { ClientScene.RegisterPrefab(p); } else { Debug.LogError("Player prefab required to have PlayerBehaviour"); Bug.Splat(); } } foreach (var s in spawnablePrefabs) { ClientScene.RegisterPrefab(s); } ClientScene.AddPlayer(connectionToServer, 0); }
public IActionResult EditBug(int BugId, MyBugEditViewModel myBugEditViewModel) { if (ModelState.IsValid) { var SubCategoryID = HttpContext.Request.Form["SubCatId"].ToString(); if (SubCategoryID == "0") { ModelState.AddModelError("", "Select SubCategory"); return(View(myBugEditViewModel)); } Bug newBug = myBugEditViewModel.bug; newBug.SubCategoryId = Int32.Parse(SubCategoryID); BugRepository.UpdateBug(newBug); return(RedirectToAction("Index")); } IEnumerable <Bug> bugs = BugRepository.GetBug(BugId); var bug = bugs.First(); myBugEditViewModel.bug = bug; List <Category> categories = CategoryRepository.GetAllCategory().ToList(); ViewBag.ListOfCategory = categories; myBugEditViewModel.category = bug.SubCat.Cat; List <SubCategory> subCategories = SubCategoryRepository.GetAllSubCategory().ToList(); subCategories = (from subCategory in subCategories where subCategory.CategoryId == bug.SubCat.Cat.CatID select subCategory).ToList(); ViewBag.ListOfSubCategory = subCategories; myBugEditViewModel.subCategory = bug.SubCat; var id = userManager.GetUserId(User); IEnumerable <Bug> bugsList = BugRepository.GetAllBugsOfUser(id); myBugEditViewModel.bugs = bugsList; return(View(myBugEditViewModel)); }
private void butAdd_Click(object sender, EventArgs e) { if (_isLoading) { return; } FormBugEdit FormBE = new FormBugEdit(); FormBE.IsNew = true; FormBE.BugCur = Bugs.GetNewBugForUser(); if (_jobCur.Category == JobCategory.Enhancement) { FormBE.BugCur.Description = "(Enhancement)"; } FormBE.BugCur.Description += _jobCur.Title; FormBE.ShowDialog(); if (FormBE.DialogResult == DialogResult.OK) { BugCur = FormBE.BugCur; DialogResult = DialogResult.OK; } }
public void DeleteEntityShouldRemoveData() { var repository = new BugLoggingSystemRepository<Bug>(new BugLoggingSystemDbContext()); int previousBugsCount = repository.All().Count(); var bug = new Bug { Id = Guid.NewGuid(), Text = "pesho", LogDate = DateTime.Now }; repository.Add(bug); repository.SaveChanges(); int bugsCount = repository.All().Count(); Assert.AreEqual(previousBugsCount + 1, bugsCount); repository.Delete(bug); repository.SaveChanges(); bugsCount = repository.All().Count(); Assert.AreEqual(previousBugsCount, bugsCount); }
public void BugAdded(Bug bug) { Clients.All.addBug(bug); }
public void BugRemoved(Bug bug) { Clients.All.removeBug(bug); }
public void BugUpdated(Bug bug, int priorityIndex) { Clients.All.updateBug(bug, priorityIndex); }
public void ReportBug(Bug bug) { //TODO: Add code to report bugs }
/// <summary> /// A bug object is required to initialise an object of the view /// model. Attributes are mapped from the bug object to view model. /// </summary> /// <param name="bug">Bug object data structure.</param> public BugViewModel(Bug bug) { _Bug = bug; _IsSelected = false; }
public override void UnderAttack(Bug bug) { BeingAttacked(this, new ItemEventArgs(Items.Bug.Track(bug))); }
public override void SpotsEnemy(Bug bug) { Spotted(this, new ItemEventArgs(Items.Bug.Track(bug))); }
public void SetBug(Bug bug) { this.bug = bug; }