Beispiel #1
0
        public HttpResponseMessage GetTaskList(Int64 projectId, string filterOption)
        {
            List <MilestoneModel> Mlist = new List <MilestoneModel>();
            List <MilestoneModel> Tlist = new List <MilestoneModel>();
            PM_DashboardDL        pd    = new PM_DashboardDL();
            DataTable             dt    = pd.GetMileStoneValues("Get_Project_Tasks", projectId, 0, filterOption);

            foreach (DataRow item in dt.Rows)
            {
                MilestoneModel mil = new MilestoneModel();
                MilestoneModel tsk = new MilestoneModel();

                tsk.TaskId      = Convert.ToInt64(item["TaskId"].ToString());
                tsk.PTaskId     = Convert.ToInt64(item["PTaskId"].ToString());
                tsk.Task        = item["Task"].ToString();
                tsk.Color       = item["Color"].ToString();
                tsk.ProjectId   = Convert.ToInt64(item["ProjectId"].ToString());
                tsk.ActualSites = Convert.ToInt32(item["ActualSites"].ToString());
                tsk.TotalSites  = Convert.ToInt32(item["TotalSites"].ToString());
                mil.TaskId      = Convert.ToInt64(item["TaskId"].ToString());
                mil.PTaskId     = Convert.ToInt64(item["PTaskId"].ToString());
                mil.Task        = item["Task"].ToString();
                mil.Color       = item["Color"].ToString();
                mil.ProjectId   = Convert.ToInt64(item["ProjectId"].ToString());
                mil.ActualSites = Convert.ToInt32(item["ActualSites"].ToString());
                mil.TotalSites  = Convert.ToInt32(item["TotalSites"].ToString());
                if (tsk.PTaskId == 0)
                {
                    Mlist.Add(mil);
                }
                else
                {
                    Tlist.Add(tsk);
                }
            }

            foreach (var mile in Mlist)
            {
                foreach (var task in Tlist)
                {
                    if (task.PTaskId == mile.TaskId)
                    {
                        mile.Tasks = Tlist;
                        break;
                    }
                }
            }

            if (Mlist != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, Mlist));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                   "Record with Id " + projectId.ToString() + " not found"));
            }
        }
Beispiel #2
0
        public HttpResponseMessage GetRegionIssue(Int64 ProjectId)
        {
            PM_DashboardDL pd = new PM_DashboardDL();
            DataTable      dt = pd.GetMileStoneValues("Get_Region_Issue", ProjectId, 0);
            IEnumerable <Dictionary <string, object> > result = dt.Select().Select(x => x.ItemArray.Select((a, i) => new { Name = dt.Columns[i].ColumnName, Value = a })
                                                                                   .ToDictionary(a => a.Name, a => a.Value));

            if (result != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                   "Record with Id " + ProjectId.ToString() + " not found"));
            }
        }