Ejemplo n.º 1
0
        [System.Web.Http.Route("swi/PM_Tasks"), System.Web.Http.HttpPost]  //Filters:ByTaskTypeId,ByTaskTypeKeyCode,ByPTaskId,ByTaskId,ByProjectId
        public HttpResponseMessage PM_Tasks(string filter, string pType, string pId, bool Resources = false, Int64 ProjectId = 0, Int64 TaskId = 0)
        {
            PM_TaskBL tb     = new PM_TaskBL();
            var       result = tb.ToList(filter, pType, pId, ProjectId, TaskId);

            if (Resources)
            {
                PM_ProjectResourceBL prb = new PM_ProjectResourceBL();
                foreach (var item in result)
                {
                    item.ProjectResources = prb.ToList("byTaskId", item.TaskId.ToString(), ProjectId, TaskId);
                }
            }
            //return Json(rec, JsonRequestBehavior.AllowGet);

            if (result != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound,
                                                   "Record for Id " + TaskId.ToString() + " not found"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult ToSingle(string filter, string value = "0", string value2 = "0")
        {
            PM_TaskBL tb  = new PM_TaskBL();
            var       rec = tb.ToList(filter, value, value2).FirstOrDefault();

            if (rec != null)
            {
                PM_ProjectResourceBL prb = new PM_ProjectResourceBL();
                rec.ProjectResources = prb.ToList("byTaskId", rec.TaskId.ToString());
            }
            return(Json(rec, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public Response _Tasks(string filter = "", string value = "", string value2 = "", bool Resources = false, Int64 ProjectId = 0, Int64 TaskId = 0)
        {
            Response _res = new Response();

            try
            {
                PM_TaskBL tb  = new PM_TaskBL();
                var       rec = tb.ToList(filter, value, ProjectId.ToString(), ProjectId, TaskId);
                if (Resources)
                {
                    PM_ProjectResourceBL prb = new PM_ProjectResourceBL();

                    foreach (var item in rec)
                    {
                        item.ProjectResources = prb.ToList("byTaskId", item.TaskId.ToString(), ProjectId, TaskId);
                    }
                }
                if (filter == "ByTaskTypeKeyCode")
                {
                    AD_DefinationBL      db            = new AD_DefinationBL();
                    List <AD_Defination> ProjectStatus = db.ToList("byDefinationType", "Project Task Status");
                    foreach (var item in rec)
                    {
                        var Splited = ProjectStatus.Where(x => x.DefinationId == item.StatusId).FirstOrDefault();
                        if (Splited != null)
                        {
                            var CurrentStatus = Splited.DefinationName.ToLower();
                            switch (CurrentStatus)
                            {
                            case "active":
                                item.Status = "STATUS_ACTIVE";
                                break;

                            case "suspended":
                                item.Status = "STATUS_SUSPENDED";
                                break;

                            case "completed":
                                item.Status = "STATUS_DONE";
                                break;

                            case "cancelled":
                                item.Status = "STATUS_FAILED";
                                break;

                            case "undefined":
                                item.Status = "STATUS_UNDEFINED";
                                break;

                            case "planned":
                                item.Status = "STATUS_PLANNED";
                                break;
                                //default :
                                //   item.StatusId = 0;
                            }

                            //   item.Status = GanttStatusses.Where(x=>x.Split('_')[1].ToLower() == Splited.DefinationName.ToLower()).FirstOrDefault();
                        }
                        if (item.Status == null || item.Status == "")
                        {
                            item.Status   = "STATUS_PLANNED";
                            item.StatusId = ProjectStatus.Where(x => x.DefinationName == "Planned").FirstOrDefault().PDefinationId;
                        }
                    }
                }
                _res.Value   = rec;
                _res.Message = "Ok";
                _res.Status  = "true";
                return(_res);
            }

            catch (Exception _ex)
            {
                _res.Message = _ex.Message;
                _res.Status  = "false";
                return(_res);
            }
        }
Ejemplo n.º 4
0
        public ActionResult ToList(string filter, string value, string value2, bool Resources = false, Int64 ProjectId = 0, Int64 TaskId = 0)
        {
            PM_TaskBL tb  = new PM_TaskBL();
            var       rec = tb.ToList(filter, value, value2, ProjectId, TaskId);

            if (Resources)
            {
                PM_ProjectResourceBL prb = new PM_ProjectResourceBL();

                foreach (var item in rec)
                {
                    item.ProjectResources = prb.ToList("byTaskId", item.TaskId.ToString(), ProjectId, TaskId);
                }
            }
            if (filter == "ByTaskTypeKeyCode")
            {
                AD_DefinationBL      db            = new AD_DefinationBL();
                List <AD_Defination> ProjectStatus = db.ToList("byDefinationType", "Project Task Status");
                foreach (var item in rec)
                {
                    var Splited = ProjectStatus.Where(x => x.DefinationId == item.StatusId).FirstOrDefault();
                    if (Splited != null)
                    {
                        var CurrentStatus = Splited.DefinationName.ToLower();
                        switch (CurrentStatus)
                        {
                        case "active":
                            item.Status = "STATUS_ACTIVE";
                            break;

                        case "suspended":
                            item.Status = "STATUS_SUSPENDED";
                            break;

                        case "completed":
                            item.Status = "STATUS_DONE";
                            break;

                        case "cancelled":
                            item.Status = "STATUS_FAILED";
                            break;

                        case "undefined":
                            item.Status = "STATUS_UNDEFINED";
                            break;

                        case "planned":
                            item.Status = "STATUS_PLANNED";
                            break;
                            //default :
                            //   item.StatusId = 0;
                        }

                        //   item.Status = GanttStatusses.Where(x=>x.Split('_')[1].ToLower() == Splited.DefinationName.ToLower()).FirstOrDefault();
                    }
                    if (item.Status == null || item.Status == "")
                    {
                        item.Status   = "STATUS_PLANNED";
                        item.StatusId = ProjectStatus.Where(x => x.DefinationName == "Planned").FirstOrDefault().PDefinationId;
                    }
                }
            }

            return(Json(rec, JsonRequestBehavior.AllowGet));
        }