Exemplo n.º 1
0
 private void BindBugs()
 {
     if (ddlProjects.SelectedValue != "")
     {
         lvBugs.DataSource = BugsDBManager.GetBugsByProjectId(
             Int32.Parse(ddlProjects.SelectedValue), CurrentPage - 1,
             itemsPerPage, Asc, SortExpression, true, out itemsCount);
         lvBugs.DataBind();
     }
 }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                Data.Tester tester = TestersDBManager.GetTesterByUsername(Membership.GetUser().UserName);
                // insert new bug in database
                if (OldBug == null)
                {
                    tester.LastAction = "Създаване на грешка №" + BugsDBManager.Insert(NewBug);
                }
                // update existing one
                else
                {
                    BugsDBManager.Update(NewBug);
                    tester.LastAction = "Редакция на грешка №" + NewBug.BugId;
                }
                TestersDBManager.Update(tester);

                Response.Redirect("ProjectsBugs.aspx?projectId=" + NewBug.ProjectId);
            }
        }
Exemplo n.º 3
0
        protected void lvBugs_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "EditBug":
                int bugId = -1;
                if (Int32.TryParse(e.CommandArgument.ToString(), out bugId))
                {
                    Response.Redirect("Bug.aspx?bugId=" + bugId.ToString());
                }
                break;

            case "DeleteBug":
                bugId = -1;
                if (Int32.TryParse(e.CommandArgument.ToString(), out bugId))
                {
                    BugsDBManager.Delete(bugId);
                    Data.Tester tester = TestersDBManager.GetTesterByUsername(Membership.GetUser().UserName);
                    tester.LastAction = "Изтриване на грешка №" + bugId;
                    TestersDBManager.Update(tester);
                    BindBugs();
                    BuildPager();
                }
                break;

            case "SortId":
                BindColumsNames();
                if (e.CommandArgument.ToString() == "ASC")
                {
                    Asc            = true;
                    SortExpression = "SortId";
                    BindBugs();
                    LinkButton btnId = (LinkButton)lvBugs.FindControl("btnId");
                    if (btnId != null)
                    {
                        btnId.CommandArgument = "DESC";
                        btnId.Text           += " <img src='../style/arrow_order_down.gif'/>";
                    }
                }
                else
                {
                    Asc            = false;
                    SortExpression = "SortId";
                    BindBugs();
                    LinkButton btnId = (LinkButton)lvBugs.FindControl("btnId");
                    if (btnId != null)
                    {
                        btnId.CommandArgument = "ASC";
                        btnId.Text           += " <img src='../style/arrow_order_up.gif'/>";
                    }
                }
                break;

            case "SortOwner":
                BindColumsNames();
                if (e.CommandArgument.ToString() == "ASC")
                {
                    Asc            = true;
                    SortExpression = "SortOwner";
                    BindBugs();
                    LinkButton btnOwner = (LinkButton)lvBugs.FindControl("btnOwner");
                    if (btnOwner != null)
                    {
                        btnOwner.CommandArgument = "DESC";
                        btnOwner.Text           += " <img src='../style/arrow_order_down.gif'/>";
                    }
                }
                else
                {
                    Asc            = false;
                    SortExpression = "SortOwner";
                    BindBugs();
                    LinkButton btnOwner = (LinkButton)lvBugs.FindControl("btnOwner");
                    if (btnOwner != null)
                    {
                        btnOwner.CommandArgument = "ASC";
                        btnOwner.Text           += " <img src='../style/arrow_order_up.gif'/>";
                    }
                }
                break;

            case "SortPriority":
                BindColumsNames();
                if (e.CommandArgument.ToString() == "ASC")
                {
                    Asc            = true;
                    SortExpression = "SortPriority";
                    BindBugs();
                    LinkButton btnPriority = (LinkButton)lvBugs.FindControl("btnPriority");
                    if (btnPriority != null)
                    {
                        btnPriority.CommandArgument = "DESC";
                        btnPriority.Text           += " <img src='../style/arrow_order_down.gif'/>";
                    }
                }
                else
                {
                    Asc            = false;
                    SortExpression = "SortPriority";
                    BindBugs();
                    LinkButton btnPriority = (LinkButton)lvBugs.FindControl("btnPriority");
                    if (btnPriority != null)
                    {
                        btnPriority.CommandArgument = "ASC";
                        btnPriority.Text           += " <img src='../style/arrow_order_up.gif'/>";
                    }
                }
                break;

            case "SortDate":
                BindColumsNames();
                if (e.CommandArgument.ToString() == "ASC")
                {
                    Asc            = true;
                    SortExpression = "SortDate";
                    BindBugs();
                    LinkButton btnDate = (LinkButton)lvBugs.FindControl("btnDate");
                    if (btnDate != null)
                    {
                        btnDate.CommandArgument = "DESC";
                        btnDate.Text           += " <img src='../style/arrow_order_down.gif'/>";
                    }
                }
                else
                {
                    Asc            = false;
                    SortExpression = "SortDate";
                    BindBugs();
                    LinkButton btnDate = (LinkButton)lvBugs.FindControl("btnDate");
                    if (btnDate != null)
                    {
                        btnDate.CommandArgument = "ASC";
                        btnDate.Text           += " <img src='../style/arrow_order_up.gif'/>";
                    }
                }
                break;
            }
        }
Exemplo n.º 4
0
 private void BindBugs()
 {
     lvBugs.DataSource = BugsDBManager.GetBugs(CurrentPage - 1, itemsPerPage, Asc, SortExpression, out itemsCount);
     lvBugs.DataBind();
     BuildPager();
 }