Ejemplo n.º 1
0
        void buttonSave_Click(object sender, EventArgs e)
        {
            _bug.ExpectedBehavior = FindViewById <EditText>(Resource.Id.expectedBehavior).Text;
            _bug.ObservedBehavior = FindViewById <EditText>(Resource.Id.observedBehavior).Text;
            _bug.Steps2Reproduce  = FindViewById <EditText>(Resource.Id.steps2Reproduce).Text;
            _bug.Assigned2        = FindViewById <EditText>(Resource.Id.assigned2).Text;

            if (string.IsNullOrEmpty(_bug.ExpectedBehavior) || string.IsNullOrEmpty(_bug.ObservedBehavior) || string.IsNullOrEmpty(_bug.Steps2Reproduce) || string.IsNullOrEmpty(_bug.Assigned2))
            {
                // abort save
                ShowDialog(ALERT_SAVE_DIALOG);
                return;
            }

            _bug.Priority = _prioritySpinner.GetItemAtPosition(_prioritySpinner.SelectedItemPosition).ToString();

            try
            {
                BugRepository.Save(_bug);
                Toast.MakeText(this, Resource.String.bugSaved, ToastLength.Long).Show();
            }
            catch (Exception exception)
            {
                Toast.MakeText(this, exception.Message, ToastLength.Long).Show();
            }

            Finish();
        }
Ejemplo n.º 2
0
        public IList <Bug> SearchAllProjectBugsAttributes(Project project, string searchText)
        {
            searchText = searchText.Trim();

            // if (searchText == null || searchText == "")
            //   return GetBugsByProject(project);

            IList <int> associatedUserIds = new UserRepository().GetAll().FullTextSearch(searchText, true).Select(p => p.Id).ToList();
            IList <int> fullTextSearch    = new BugRepository().GetAll().FullTextSearch(searchText, true).Select(p => p.Id).ToList();

            if (associatedUserIds.Count == 0 && fullTextSearch.Count == 0)
            {
                return(new List <Bug>());
            }

            int      id   = 0;
            DateTime date = DateTime.MinValue;

            try { id = Int32.Parse(searchText); }
            catch (Exception e) { Console.WriteLine(e.Message); }

            try { date = DateTime.Parse(searchText); }
            catch (Exception e) { Console.WriteLine(e.Message); }


            return(new BugRepository().GetAll()
                   .Where(p => associatedUserIds.Contains(p.AssignedUser.Id) ||
                          associatedUserIds.Contains(p.CreatedBy.Id) ||
                          p.Id == id ||
                          (p.DateFound.Year == date.Year && p.DateFound.Month == date.Month && p.DateFound.Day == date.Day) ||
                          (p.LastModified.Year == date.Year && p.LastModified.Month == date.Month && p.LastModified.Day == date.Day) ||
                          fullTextSearch.Contains(p.Id)).Where(p => p.Project.Id == project.Id).ToList());
        }
        public IActionResult EditBug(int BugId)
        {
            MyBugEditViewModel myBugEditViewModel = new MyBugEditViewModel();

            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));
        }
Ejemplo n.º 4
0
    protected void btnCheckIn_Click(object sender, EventArgs e)
    {
        using (CrackerEntities myEntity = new CrackerEntities())
        {
            ITransactionRepository transactionRepo = new TransactionRepository();
            IBugRepository bugRepo = new BugRepository();

            string bugName = Request.QueryString.Get("BugID");

            var bugId = bugRepo.GetBugIdByTitle(bugName);

            Transaction myTransaction = new Transaction
            {
                BugId = (int)bugId,
                ChangedBy = HttpContext.Current.User.Identity.Name,
                ChangedOn = DateTime.Now,
                StatusId = Int32.Parse(((DropDownList)LoginView1.FindControl("ddlResolution")).SelectedValue),
                TimeSpent = Int32.Parse(((TextBox)LoginView1.FindControl("txtTime")).Text),
                LanguageId = Int32.Parse(((DropDownList)LoginView1.FindControl("ddlLanguages")).SelectedValue),
                Note = HttpUtility.HtmlEncode(((TextBox)LoginView1.FindControl("txtNote")).Text)
            };

            transactionRepo.InsertTransaction(myTransaction);
            transactionRepo.Save();

        }
        Response.Redirect("~/Default.aspx");
    }
Ejemplo n.º 5
0
        // PUT: api/Bug/5
        public IHttpActionResult Put(int id, [FromBody] BugApi model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                using (var context = new DataContext())
                {
                    BugRepository bugRepository = new BugRepository(context);
                    var           entity        = MapperHelper.Map <Bug>(model);
                    entity.ModifiedAt   = DateTime.Now;
                    entity.ModifiedById = CurrentUserId;
                    bugRepository.Update(entity);
                    context.SaveChanges();
                    var bugApi = MapperHelper.Map <BugApi>(entity);
                    return(Ok(bugApi));
                }
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Conflict, new { Message = "El registro ha sido modificado" })));
            }
        }
Ejemplo n.º 6
0
 public ProjectRepositoryTest() : base()
 {
     _projectRepository = new ProjectRepository(_db);
     _companyRepository = new CompanyRepository(_db);
     _userRepository    = new UserRepository(_db);
     _bugRepository     = new BugRepository(_db);
 }
Ejemplo n.º 7
0
        private void PopulateList()
        {
            var bugs    = BugRepository.GetAllBugs(_projectId);
            var adapter = new BugAdapter(this, this, Resource.Layout.ProjectListRow, bugs.ToArray());

            ListAdapter = adapter;
        }
Ejemplo n.º 8
0
        public List <Bug> GetAllBugs()
        {
            BugRepository repo    = new BugRepository();
            List <Bug>    bugList = repo.GetAll().ToList();

            return(bugList);
        }
 public void BugRepositoryTest()
 {
     var bugRepository = new BugRepository();
     bugRepository.SetDefaultBugPriorities();
     bugRepository.SetDefaultBugSeverities();
     bugRepository.SetDefaultBugStatuses();
 }
Ejemplo n.º 10
0
        public void SetDefaultBugInformationTest()
        {
            var bugRepository = new BugRepository();

            bugRepository.SetDefaultBugPriorities();
            bugRepository.SetDefaultBugSeverities();
            bugRepository.SetDefaultBugStatuses();
        }
Ejemplo n.º 11
0
        /*[PrincipalPermission(SecurityAction.Demand, Role = "ADMIN")]*/


        public void DeleteBug(Bug bug)
        {
            BugRepository repo = new BugRepository();

            repo.Delete(bug);

            BugActionLogger.LogEvent(bug.Project, GetMyUser(), BugActionLogger.Delete_Action, bug);
        }
Ejemplo n.º 12
0
        public List <Bug> GetBugsByProject(Project project)
        {
            BugRepository bugRepo = new BugRepository();

            List <Bug> bugList = bugRepo.GetAll().Where(x => x.Project.Id == project.Id).ToList();

            return(bugList);
        }
Ejemplo n.º 13
0
 public IHttpActionResult Get()
 {
     using (var context = new DataContext()) {
         BugRepository bugRepository = new BugRepository(context);
         var           bugs          = bugRepository.GetAll();
         var           models        = MapperHelper.Map <ICollection <BugApi> >(bugs);
         return(Ok(models));
     }
 }
Ejemplo n.º 14
0
 public BugCommandHandler(BugRepository bugRepository, IIssueFactory issueFactory, ILabelsSearcher labelsSearcher, IMembershipService authorizationService, UserRepository userRepository, ISprintSearcher sprintSearcher, CallContext callContext)
 {
     this.bugRepository        = bugRepository;
     this.issueFactory         = issueFactory;
     this.labelsSearcher       = labelsSearcher;
     this.authorizationService = authorizationService;
     this.userRepository       = userRepository;
     this.sprintSearcher       = sprintSearcher;
     this.callContext          = callContext;
 }
Ejemplo n.º 15
0
        public Bug AddBug(Bug bug)
        {
            bug.DateFound    = DateTime.Now;
            bug.LastModified = DateTime.Now;

            var savedbug = new BugRepository().Create(bug);

            BugActionLogger.LogEvent(bug.Project, GetMyUser(), BugActionLogger.Create_Action, savedbug);

            return(savedbug);
        }
Ejemplo n.º 16
0
        public Bug SaveBug(Bug bug)
        {
            bug.LastModified = DateTime.Now;

            BugRepository bugRepo = new BugRepository();

            var savedbug = bugRepo.Update(bug);

            BugActionLogger.LogEvent(bug.Project, GetMyUser(), BugActionLogger.Update_Action, savedbug);

            return(bug);
        }
Ejemplo n.º 17
0
 public IHttpActionResult Get(int id)
 {
     using (var context = new DataContext())
     {
         BugRepository  bugRepository = new BugRepository(context);
         var            bug           = bugRepository.Find(id);
         UserRepository userRepo      = new UserRepository(context);
         bug.CreatedBy = userRepo.Find(CurrentUserId);
         var models = MapperHelper.Map <BugApi>(bug);
         return(Ok(models));
     }
 }
Ejemplo n.º 18
0
        public UnitOfWork()
        {
            context = new BugTrackingEntities();

            RoleRepository              = new RoleRepository(context);
            UserRepository              = new UserRepository(context);
            BugStatusRepository         = new BugStatusRepository(context);
            BugPriorityRepository       = new BugPriorityRepository(context);
            BugRepository               = new BugRepository(context);
            ProjectTechnologyRepository = new ProjectTechnologyRepository(context);
            ProjectStatusReporitory     = new ProjectStatusRepository(context);
            ProjectRepository           = new ProjectRepository(context);
            projectDevelopersRepository = new ProjectDevelopersRepository(context);
        }
Ejemplo n.º 19
0
        private void PopulateDetails(long bugId)
        {
            var bug = BugRepository.GetBug(bugId);

            if (bug != null)
            {
                FindViewById <TextView>(Resource.Id.expectedBehaviorDetails).Text = bug.ExpectedBehavior;
                FindViewById <TextView>(Resource.Id.observedBehaviorDetails).Text = bug.ObservedBehavior;
                FindViewById <TextView>(Resource.Id.assigned2Details).Text        = bug.Assigned2;
                FindViewById <TextView>(Resource.Id.steps2ReproduceDetails).Text  = bug.Steps2Reproduce;
                FindViewById <TextView>(Resource.Id.priorityDetails).Text         = bug.Priority;
                FindViewById <TextView>(Resource.Id.managerDetails).Text          = bug.FoundBy;
                FindViewById <TextView>(Resource.Id.foundDetails).Text            = bug.Found.ToLongDateString();
            }
        }
Ejemplo n.º 20
0
 public IHttpActionResult Get(int id)
 {
     using (var context = new DataContext())
     {
         BugRepository  bugRepository  = new BugRepository(context);
         var            bugs           = bugRepository.Find(id);
         UserRepository userRepository = new UserRepository(context);
         bugs.createdby = userRepository.Find(bugs.createdByid);
         if (bugs.modifiedById != null)
         {
             bugs.modifiedBy = userRepository.Find(bugs.modifiedById);
         }
         var models = MapperHelp.Map <BugApi>(bugs);
         return(Ok(models));
     }
 }
Ejemplo n.º 21
0
        // GET: api/Bug/5
        public IHttpActionResult Get(int id)
        {
            using (var ctx = new DataContext())
            {
                BugRepository  bugRepository  = new BugRepository(ctx);
                var            bug            = bugRepository.Find(id);
                UserRepository userRepository = new UserRepository(ctx);
                bug.CreatedBy = userRepository.Find(bug.CreatedById);
                if (bug.ModfiedById != null)
                {
                    bug.ModifiedBy = userRepository.Find(bug.ModfiedById);
                }

                var model = MapperHelper.Map <BugApi>(bug);
                return(Ok(model));
            }
        }
Ejemplo n.º 22
0
        public void AddBugWithoutBothDescriptionAndLogDateShouldThrowsValidationException()
        {
            // Arrange -> Prepare the objects
            var bug = new Bug();

            // Act -> Test the objects
            var bugRepository = new BugRepository(new BugLoggerDbContext());

            bugRepository.Add(bug);
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            var bugFromDb = bugRepository.Find(bug.BugId);

            Assert.IsNotNull(bugFromDb);
            Assert.AreEqual(bug.Description, bugFromDb.Description);
        }
        public IActionResult Index()
        {
            MyBugAddViewModel myBugAddViewModel = new MyBugAddViewModel();
            var id = userManager.GetUserId(User);
            IEnumerable <Bug> bugs       = BugRepository.GetAllBugsOfUser(id);
            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;
            myBugAddViewModel.bugs = bugs;

            return(View(myBugAddViewModel));
        }
Ejemplo n.º 24
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            var info = (AdapterView.AdapterContextMenuInfo)item.MenuInfo;
            var bug  = (BugModel)ListAdapter.GetItem(info.Position);

            switch (item.ItemId)
            {
            case Resource.Id.markFixedBug:
                BugRepository.MarkAsFixed(bug.Id);

                Toast.MakeText(this, Resource.String.bugSaved, ToastLength.Short).Show();

                PopulateList();
                break;
            }

            return(base.OnContextItemSelected(item));
        }
Ejemplo n.º 25
0
        public IHttpActionResult Post([FromBody] CreateBugApi model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            using (DataContext dataContext = new DataContext()) {
                BugRepository bugRepository = new BugRepository(dataContext);
                var           bug           = MapperHelper.Map <Bug>(model);
                bug.CreatedAt   = DateTime.Now;
                bug.CreatedById = CurrentUserId;
                bugRepository.Insert(bug);
                dataContext.SaveChanges();
                var bugApi = MapperHelper.Map <BugApi>(bug);
                return(Ok(bugApi));
            }
        }
Ejemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string bugName = Request.QueryString.Get("BugID");
        ((Label)LoginView1.FindControl("lblBugID")).Text = bugName;

        string checkedOutBy;
        DateTime changedOn;
        string status;

        ITransactionRepository transactionRepo = new TransactionRepository();
        IBugRepository bugRepo = new BugRepository();

        //Verify that the bug we are going to check in can be checked in
        //Get bug ID
        var result = bugRepo.GetBugIdByTitle(bugName);

        if (result != null)
        {
            //check if the bug is checked out & if it's checked by current user
            var check = transactionRepo.GetLastTransactionForBug((int)result);

            status = Convert.ToString(check.Status.StatusName);
            changedOn = Convert.ToDateTime(check.ChangedOn);
            checkedOutBy = Convert.ToString(check.ChangedBy);

            if (checkedOutBy != HttpContext.Current.User.Identity.Name)
            {
                ((Label)LoginView1.FindControl("lblWarning")).ForeColor = System.Drawing.Color.Red;
                ((Label)LoginView1.FindControl("lblWarning")).Text = "You're about to undo a bug that was not checked out by you!";
            }

            //get how long has the bug been checked out
            ((TextBox)LoginView1.FindControl("txtTime")).Text = Math.Round(DateTime.Now.Subtract(changedOn).TotalMinutes, 0).ToString();

            ((Label)LoginView1.FindControl("lblBugID")).Text = bugName;
        }
        else
        {
            ((Label)LoginView1.FindControl("lblBugID")).ForeColor = System.Drawing.Color.Red;
            ((Label)LoginView1.FindControl("lblBugID")).Text = bugName + " does not exist!";
            ((Button)LoginView1.FindControl("btnUNdo")).Enabled = false;

        }
    }
Ejemplo n.º 27
0
        public void GetAllBugsShouldReturnBugsCollection()
        {
            // Arrange -> Prepare the objects
            var bugs = this.GenerateBugsCollection();

            // Act -> Test the objects

            var bugRepository = new BugRepository(new BugLoggerDbContext());
            var bugsInDatabaseCountOld = bugRepository.All().Count();
            foreach (var bug in bugs)
            {
                bugRepository.Add(bug);
            }
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            Assert.AreEqual(bugsInDatabaseCountOld + bugs.Count, bugRepository.All().Count());
            CollectionAssert.AreEquivalent(bugs.ToList(), bugRepository.All().OrderBy(b => b.BugId).Skip(bugsInDatabaseCountOld).Take(bugs.Count).ToList());
        }
Ejemplo n.º 28
0
        public void GetAllBugsShouldReturnBugsCollection()
        {
            // Arrange -> Prepare the objects
            var bugs = this.GenerateBugsCollection();

            // Act -> Test the objects

            var bugRepository          = new BugRepository(new BugLoggerDbContext());
            var bugsInDatabaseCountOld = bugRepository.All().Count();

            foreach (var bug in bugs)
            {
                bugRepository.Add(bug);
            }
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            Assert.AreEqual(bugsInDatabaseCountOld + bugs.Count, bugRepository.All().Count());
            CollectionAssert.AreEquivalent(bugs.ToList(), bugRepository.All().OrderBy(b => b.BugId).Skip(bugsInDatabaseCountOld).Take(bugs.Count).ToList());
        }
Ejemplo n.º 29
0
        public void AddBugShouldBeAddedToDatabaseAndShouldBeReturnedFromRepository()
        {
            // Arrange -> Prepare the objects
            var bug = new Bug()
            {
                Description = "bug-1",
                LogDate = DateTime.Now
            };
   
            // Act -> Test the objects
            var bugRepository = new BugRepository(new BugLoggerDbContext());
            bugRepository.Add(bug);
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            var bugFromDb = bugRepository.Find(bug.BugId);

            Assert.IsNotNull(bugFromDb);
            Assert.AreEqual(bug.Description, bugFromDb.Description);
        }
Ejemplo n.º 30
0
        public void AddBugWithEmptyDescriptionShouldThrowsValidationException()
        {
            // Arrange -> Prepare the objects
            var bug = new Bug()
            {
                Description = string.Empty,
                LogDate = DateTime.Now
            };

            // Act -> Test the objects
            var bugRepository = new BugRepository(new BugLoggerDbContext());
            bugRepository.Add(bug);
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            var bugFromDb = bugRepository.Find(bug.BugId);

            Assert.IsNotNull(bugFromDb);
            Assert.AreEqual(bug.Description, bugFromDb.Description);
        }
Ejemplo n.º 31
0
 public BugRepositoryTest() : base()
 {
     _company = new Company {
         Name = "New Co."
     };
     _companyRepository = new CompanyRepository(_db);
     _companyRepository.Insert(_company);
     _projectRepository = new ProjectRepository(_db);
     _project           = new Project {
         Name = "new Project", IdCompany = _company.IdCompany
     };
     _projectRepository.Insert(_project);
     _bugRepository = new BugRepository(_db);
     _bug           = new Bug {
         Name       = "SimpleBug",
         IdPriority = new Guid("00000000-0000-0000-0000-000000000003"),
         IdStatus   = new Guid("00000000-0000-0000-0000-000000000001"),
         IdProject  = _project.IdProject,
         Days       = 23
     };
 }
Ejemplo n.º 32
0
        public void AddBugShouldBeAddedToDatabaseAndShouldBeReturnedFromRepository()
        {
            // Arrange -> Prepare the objects
            var bug = new Bug()
            {
                Description = "bug-1",
                LogDate     = DateTime.Now
            };

            // Act -> Test the objects
            var bugRepository = new BugRepository(new BugLoggerDbContext());

            bugRepository.Add(bug);
            bugRepository.SaveChanges();

            // Assert -> Validate the result
            var bugFromDb = bugRepository.Find(bug.BugId);

            Assert.IsNotNull(bugFromDb);
            Assert.AreEqual(bug.Description, bugFromDb.Description);
        }
        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 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));
        }
Ejemplo n.º 35
0
    protected void btnUndo_Click(object sender, EventArgs e)
    {
        ITransactionRepository transactionRepo = new TransactionRepository();
        IBugRepository bugRepo = new BugRepository();

        string bugName = Request.QueryString.Get("BugID");
        var bugId = bugRepo.GetBugIdByTitle(bugName);

        Transaction myTransaction = new Transaction
        {
            ChangedBy = HttpContext.Current.User.Identity.Name,
            ChangedOn = DateTime.Now,
            BugId = (int)bugId,
            StatusId = 9,
            TimeSpent = Int32.Parse(((TextBox)LoginView1.FindControl("txtTime")).Text),
            LanguageId = 14
        };

        transactionRepo.InsertTransaction(myTransaction);
        transactionRepo.Save();

        Response.Redirect("~/Default.aspx");
    }
 static BugsController()
 {
     string connectionString = ConfigurationManager.AppSettings["RAVENHQ_CONNECTION_STRING"];
     Repository = new BugRepository(connectionString);
 }
Ejemplo n.º 37
0
    protected void btnCheckOut_Click(object sender, EventArgs e)
    {
        string bug = ((TextBox)LoginView1.FindControl("txtBugId")).Text;
        int bugId;

        try
        {
                ITransactionRepository transactionRepo = new TransactionRepository();
                IBugRepository bugRepo = new BugRepository();

                var result = bugRepo.GetBugIdByTitle(bug);

                if (result == 0)
                {
                    Bug newBug = new Bug()
                    {
                        Bug1 = bug

                    };

                    bugRepo.InsertBug(newBug);
                    bugRepo.Save();
                }

                bugId = (int)bugRepo.GetBugIdByTitle(bug);

                //check if bug was not checked out previously (check if there is any transaction for this bug)
                var testCheckout = transactionRepo.GetLastTransactionForBug(bugId);

                //if there is an transaction
                if (testCheckout != null)
                {
                    //check if bug is not checked out now
                    if (testCheckout.StatusId != 8)
                    {
                        //check out bug
                        CheckoutBug(bugId, transactionRepo);

                        ((Label)LoginView1.FindControl("lblAlreadyCheckedOut")).Visible = false;

                        setGridView(gridIdBugsMe, true);
                        setGridView(gridIdBugsOthers, false);
                    }
                    else
                    {
                        ((Label)LoginView1.FindControl("lblAlreadyCheckedOut")).Visible = true;
                    }
                }
                else
                {
                    CheckoutBug(bugId, transactionRepo);

                    ((Label)LoginView1.FindControl("lblAlreadyCheckedOut")).Visible = false;

                    setGridView(gridIdBugsMe, true);
                    setGridView(gridIdBugsOthers, false);
                }
        }
        catch (DataException ex)
        {
            ((Label)LoginView1.FindControl("lblException")).Visible = true;
            ((Label)LoginView1.FindControl("lblException")).Text = "Data not available, please try again later (" + ex.Message + ex.InnerException.Message + ").";
        }
    }
Ejemplo n.º 38
0
 public BugService(BugRepository bugRepo, UserRepository userRepo)
 {
     _bugRepo = bugRepo;
     _userRepo = userRepo;
 }
Ejemplo n.º 39
0
 public PrincipalsController(BugRepository bugRepository)
 {
     this.bugRepository = bugRepository;
 }
 public IActionResult DeleteBug(int BugId)
 {
     BugRepository.DeleteBug(BugId);
     return(RedirectToAction("Index"));
 }