Пример #1
0
        public object GetSearchConfiguration([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
            var entryPoint = (from configs in db.Configurations
                              join wkitems in db.WorkItems on configs.work_item_id equals wkitems.work_item_id
                              join status in db.Statuses on configs.config_status_id equals status.status_id
                              join application in db.Applications on configs.application_id equals application.application_id
                              join scope in db.Scopes on wkitems.scope_id equals scope.scope_id
                              join sprint in db.Sprints on wkitems.sprint_id equals sprint.sprint_id
                              join config_type in db.Config_Types on configs.config_type_id equals config_type.config_type_id
                              where (String.IsNullOrEmpty(commfilters.work_item_nm) || commfilters.work_item_nm.Contains(wkitems.work_item_ext_id)) &&
                              (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(configs.modified_usr_id)) &&
                              ((commfilters.startdate == null || configs.modified_dtm == null) || configs.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || configs.modified_dtm == null) || configs.modified_dtm <= commfilters.enddate)
                              select new
            {
                configs.config_id,
                configs.config_nm,
                configs.config_key,
                configs.config_dev_int_value,
                configs.config_qa_value,
                configs.config_prod_value,
                configs.config_status_id,
                configs.config_type_id,
                configs.application_id,
                wkitems.sprint_id,
                wkitems.work_item_ext_id,
                wkitems.scope_id,
                configs.is_pdf,
                configs.pdfaction,
                configs.comments,
                application.application_nm,
                scope.scope_nm,
                sprint.sprint_nm,
                status.status_nm,
                config_type.config_type_nm
            }).ToList();

            //return db.Configurations.AsEnumerable();
            db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);

            // Apply filters
            var filtereddata = (from dbdata in entryPoint
                                where ((commfilters.applications == null || commfilters.applications.Count == 0) || commfilters.applications.Any(cp => cp.application_id.Equals(dbdata.application_id))) &&
                                ((commfilters.scopes == null || commfilters.scopes.Count == 0) || commfilters.scopes.Any(cp => cp.scope_id.Equals(dbdata.scope_id))) &&
                                ((commfilters.sprints == null || commfilters.sprints.Count == 0) || commfilters.sprints.Any(cp => cp.sprint_id.Equals(dbdata.sprint_id)))
                                select dbdata);


            return(filtereddata.ToArray());
        }
        public Array GetCheckListItemSummary([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            var entryPoint = (from checklist in db.CheckListActions
                              join chklistactionxref in db.CheckListActionsXref on checklist.checklist_action_id equals chklistactionxref.checklist_action_id
                              join refsubtype in db.SubTypes on checklist.sub_type_id equals refsubtype.sub_type_id into grefsubtype
                              from agrefsubtype in grefsubtype.DefaultIfEmpty()
                              where
                              (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(checklist.modified_usr_id)) &&
                              ((commfilters.startdate == null || checklist.modified_dtm == null) || checklist.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || checklist.modified_dtm == null) || checklist.modified_dtm <= commfilters.enddate)

                              group chklistactionxref by new { agrefsubtype.sub_type_nm, checklist.created_usr_id, checklist.created_dtm, checklist.checklist_action_nm, chklistactionxref.checklist_action_id } into g
                              select new
            {
                NOTSTARTED = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.NOTSTARTED)),
                COMPLETED = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.COMPLETED)),
                INPROGRESS = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.INPROGRESS)),
                NOTAPPLICABLE = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.NOTAPPLICABLE)),
                g.Key.sub_type_nm,
                g.Key.created_usr_id,
                g.Key.created_dtm,
                g.Key.checklist_action_nm,
                g.Key.checklist_action_id,
            }
                              ).ToList();


            // Apply filters

            var filtereddata = (from dbdata in entryPoint
                                where (
                                    (commfilters.search_for_options == null)
                                    ||
                                    ((commfilters.search_for_options["value"].ToString() == "COMPLETED" && (dbdata.INPROGRESS + dbdata.NOTSTARTED) == 0) ||
                                     (commfilters.search_for_options["value"].ToString() == "INCOMPLETE" && (dbdata.INPROGRESS + dbdata.NOTSTARTED) > 0) ||
                                     (commfilters.search_for_options["value"].ToString() == "ALL"))
                                    )
                                select dbdata).ToList();


            return(filtereddata.ToArray());
        }
        public object GetSearchWorkItem([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            var entryPoint = (from wkitems in db.WorkItems
                              join scope in db.Scopes on wkitems.scope_id equals scope.scope_id
                              join sprint in db.Sprints on wkitems.sprint_id equals sprint.sprint_id
                              where ((commfilters.startdate == null || wkitems.modified_dtm == null) || wkitems.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || wkitems.modified_dtm == null) || wkitems.modified_dtm <= commfilters.enddate)

                              //where (String.IsNullOrEmpty(commfilters.work_item_nm) || commfilters.work_item_nm.Contains(wkitems.work_item_ext_id))
                              //&& (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(wkitems.modified_usr_id))
                              ////&& (commfilters.startdate == null || wkitems.modified_dtm >= commfilters.startdate)
                              //&& (commfilters.enddate == null || wkitems.modified_dtm <= commfilters.enddate)
                              select new
            {
                wkitems.work_item_id,
                wkitems.sprint_id,
                wkitems.work_item_ext_id,
                wkitems.scope_id,
                scope.scope_nm,
                sprint.sprint_nm,
                wkitems.work_item_title
            }).ToList();

            // Apply filters
            var filtereddata = (from dbdata in entryPoint
                                where ((commfilters.scopes == null || commfilters.scopes.Count == 0) || commfilters.scopes.Any(cp => cp.scope_id.Equals(dbdata.scope_id))) &&
                                ((commfilters.sprints == null || commfilters.sprints.Count == 0) || commfilters.sprints.Any(cp => cp.sprint_id.Equals(dbdata.sprint_id)))
                                select dbdata);


            return(filtereddata.ToArray());
        }