예제 #1
0
 ///////////////////////////////////////////////////////////////////////
 void LoadQuery()
 {
     using (Context context = new Context())
     {
         _selectedQuery = context.Queries.Find(Convert.ToInt32(query.SelectedValue));
     }
 }
예제 #2
0
 protected void Page_Load(Object sender, EventArgs e)
 {            
     Util.do_not_cache(Response);
     
     Master.Menu.SelectedItem = "admin";
     Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
         + "projects";
     using (Context context = new Context())
     {
         Projects = context.Projects.OrderBy(p => p.Name).ToArray();
     }           
 }
예제 #3
0
        ///////////////////////////////////////////////////////////////////////
        void Page_Load(Object sender, EventArgs e)
        {

            Util.do_not_cache(Response);


            titl.InnerText = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "print " + Util.get_setting("PluralBugLabel", "bugs");


            // are we doing the query to get the bugs or are we using the cached dataview?
            int queryId = Convert.ToInt32(Request["queryId"]);
            int start = Convert.ToInt32(Request["start"]);
            int length = Convert.ToInt32(Request["length"]);
            string sortBy = Request["sortBy"];
            string sortOrder = Request["sortOrder"];
            BugQueryFilter[] filters = print_bugs.BuildFilter(Request.Params);
            Query query;
            using (Context context = new Context())
            {
                query = context.Queries.Find(queryId);
            }

            BugQueryExecutor executor = new BugQueryExecutor(query);

            BugQueryResult result = executor.ExecuteQuery(User.Identity, start, length, sortBy, sortOrder, filters);


            dv = new DataView(result.Data);
       

            HttpCookie cookie = Request.Cookies["images_inline"];
            if (cookie == null || cookie.Value == "0")
            {
                images_inline = false;
            }
            else
            {
                images_inline = true;
            }

            cookie = Request.Cookies["history_inline"];
            if (cookie == null || cookie.Value == "0")
            {
                history_inline = false;
            }
            else
            {
                history_inline = true;
            }

        }
예제 #4
0
        protected void Page_Load(Object sender, EventArgs e)
        {

            Util.do_not_cache(Response);

            Master.Menu.SelectedItem = "admin";
            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                                + "queued notifications";

            using (Context context = new Context())
            {
                Notifications = context.QueuedNotification.OrderBy(n => n.Id).ToList();
            }
        }
예제 #5
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            Util.do_not_cache(Response);

            Master.Menu.SelectedItem = "admin";
            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "categories";

            using (var context = new Context())
            {
                _categories = context.Categories.OrderBy(x => x.Name).ToList();
            }

        }
예제 #6
0
        protected void Page_Load(Object sender, EventArgs e)
        {

            Util.do_not_cache(Response);

            Master.Menu.SelectedItem = "admin";
            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "organizations";

            using (Context context = new Context())
            {
                Organizations = context.Organizations.OrderBy(o => o.Name).ToList();
            }
            
        }
예제 #7
0
        protected void Page_Load(Object sender, EventArgs e)
        {

            Util.do_not_cache(Response);
            Master.Menu.SelectedItem = "admin";

            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "statuses";

            using (Context context = new Context())
            {
                Statuses = context.Statuses.OrderBy(s => s.SortOrder).ToList();
            }

        }
예제 #8
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            Util.do_not_cache(Response);
            Master.Menu.SelectedItem = "admin";
            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "user defined attribute values";

            using (Context context = new Context())
            {
                Attributes = context.UserDefinedAttributes.OrderBy(u => u.udf_name).ToList();
            }
            ds = btnet.DbUtil.get_dataset(new SQLString(
                @"select udf_id [id],
		udf_name [user defined attribute value],
		udf_sort_seq [sort seq],
		case when udf_default = 1 then 'Y' else 'N' end [default],
		udf_id [hidden]
		from user_defined_attribute order by udf_name"));

        }
예제 #9
0
 public IHttpActionResult Get(int queryId, string sortBy, string sortOrder, int start, int length, bool idOnly, [FromUri] BugQueryFilter[] filters)
 {
     Query query;
     using (Context context = new Context())
     {
         query = context.Queries.Find(queryId);
     }
     if (query != null)
     {
         BugQueryExecutor queryExecutor = new BugQueryExecutor(query);
         var result = queryExecutor.ExecuteQuery(User.Identity, start, length, sortBy, sortOrder, idOnly, filters);
         return Ok(new
             {
                 recordsTotal = result.CountUnfiltered,
                 recordsFiltered = result.CountFiltered,
                 data = result.Data
             });
     }
     return NotFound();
 }
예제 #10
0
        ///////////////////////////////////////////////////////////////////////
        protected void Page_Load(Object sender, EventArgs e)
        {

            if (Request["format"] != "excel")
            {
                Util.do_not_cache(Response);
            }



            // fetch the sql
            int queryId = Convert.ToInt32(Request["queryId"]);
            int start = Convert.ToInt32(Request["start"]);
            int length = Convert.ToInt32(Request["length"]);
            string sortBy = Request["sortBy"];
            string sortOrder = Request["sortOrder"];
            BugQueryFilter[] filters = BuildFilter(Request.Params);
            Query query;
            using (Context context = new Context())
            {
                query = context.Queries.Find(queryId);
            }

            BugQueryExecutor executor = new BugQueryExecutor(query);

            BugQueryResult result = executor.ExecuteQuery(User.Identity, start, length, sortBy, sortOrder, filters);
            

            dv = new DataView(result.Data);
            
            string format = Request["format"];
            if (format != null && format == "excel")
            {
                Util.print_as_excel(Response, dv);
            }
            else
            {
                print_as_html();
            }

        }
예제 #11
0
        protected void Page_Load(Object sender, EventArgs e)
        {

            Util.do_not_cache(Response);
            Master.Menu.SelectedItem = "admin";
            
            Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - "
                + "priorities";
            using (Context context = new Context())
            {
                Priorities = context.Priorities.OrderBy(p => p.Name).ToArray();
            }      
            ds = btnet.DbUtil.get_dataset(new SQLString(
                @"select pr_id [id],
		pr_name [description],
		pr_sort_seq [sort seq],
		'<div style=''background:' + pr_background_color + ';''>' + pr_background_color + '</div>' [background<br>color],
		pr_style [css<br>class],
		case when pr_default = 1 then 'Y' else 'N' end [default],
		pr_id [hidden] from priorities"));

        }
예제 #12
0
        ///////////////////////////////////////////////////////////////////////
        private void LoadQueryDropdown()
        {
            IList<Query> queries;
            using (Context context = new Context())
            {
                queries = context.GetQueriesForUser(User.Identity);
            }
            var defaultQuery = queries.FirstOrDefault(q => q.Default == 1);

            query.DataSource = queries;

            query.DataTextField = "Description";
            query.DataValueField = "Id";
            string requestQueryId = Request["queryId"];
            if (!string.IsNullOrEmpty(requestQueryId))
            {
                query.SelectedValue = requestQueryId;
            }
            else
            {
                query.SelectedValue = defaultQuery != null ? defaultQuery.Id.ToString() : string.Empty;
            }
            query.DataBind();
        }
예제 #13
0
 public IEnumerable<SelectListItem> GetFilterValues(string columnName)
 {
     var result = new List<SelectListItem>();            
     result.Add(new SelectListItem{Value = "", Text = "[no filter]"});
     //TODO: Room for improvement here. This if statement is a bad code smell. 
     //      Consider creating a lookup provider that we can ask for specific lookup types from
     if (columnName == "$FLAG")
     {
         result.Add(new SelectListItem{Value = "0", Text = "None"});
         result.Add(new SelectListItem{Value = "1", Text = "Red"});
         result.Add(new SelectListItem{Value = "2", Text = "Green"});                
     }
     else if (columnName == "$SEEN")
     {
         result.Add(new SelectListItem{Value = "0", Text = "Yes"});
         result.Add(new SelectListItem{Value = "1", Text = "No"});
     }
     else if (columnName == "project")
     {
         using (Context context = new Context())
         {
             var projectItems = context.Projects.OrderBy(p => p.Name)
                 .Select(p => new SelectListItem
                 {
                     Value = p.Name,
                     Text = p.Name
                 });
             result.AddRange(projectItems);
         }
     }
     else if (columnName == "organization")
     {
         using (Context context = new Context())
         {
             var organizationItems = context.Organizations.OrderBy(p => p.Name)
                 .Select(p => new SelectListItem
                 {
                     Value = p.Name,
                     Text = p.Name
                 });
             result.AddRange(organizationItems);
         }
     }
     else if (columnName == "category")
     {
         using (Context context = new Context())
         {
             var categoryItems = context.Categories.OrderBy(p => p.Name)
                 .Select(p => new SelectListItem
                 {
                     Value = p.Name,
                     Text = p.Name
                 });
             result.AddRange(categoryItems);
         }
     }
     else if (columnName == "priority")
     {
         using (Context context = new Context())
         {
             var priorityItems = context.Priorities.OrderBy(p => p.Name)
                 .Select(p => new SelectListItem
                 {
                     Value = p.Name,
                     Text = p.Name
                 });
             result.AddRange(priorityItems);
         }
     }
     else if (columnName == "status")
     {
         using (Context context = new Context())
         {
             var statusItems = context.Statuses.OrderBy(p => p.Name)
                 .Select(p => new SelectListItem
                 {
                     Value = p.Name,
                     Text = p.Name
                 });
             result.AddRange(statusItems);
         }
     }
     else if (columnName == "assigned to" || columnName == "reported by")
     {
         using (Context context = new Context())
         {
             var userItems = context.Users.OrderBy(p => p.UserName)
                 .Select(p => new SelectListItem
                 {
                     Value = p.UserName,
                     Text = p.UserName
                 });
             result.AddRange(userItems);
         }
     }
     return result;
 }