Beispiel #1
0
        public List <Project> GetAllDetailTaskProject()
        {
            try
            {
                var obj = HttpContext.Session.GetString("SelectedProject");

                var _personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;


                using (var context = new ProjectManagementEntities())
                {
                    if (obj == null)
                    {
                        var list = ProjectDB.GetInstance().GetAllProject(_personId);
                        return(list);
                    }
                    else
                    {
                        var _projectId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id;
                        var list       = new List <Project>();
                        var item       = ProjectDB.GetInstance().GetProjeById(_projectId);
                        list.Add(item);
                        return(list);
                    }
                }
            }
            catch (System.Exception exc)
            {
                throw exc;
            }
        }
        public JsonResult DeleteProje(int _projeId)
        {
            try
            {
                var result = ProjectDB.GetInstance().DeleteProje(_projeId);

                if (result)
                {
                    if (HttpContext.Session.GetString("SelectedProject") != null)
                    {
                        if (_projeId == JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id)
                        {
                            HttpContext.Session.SetString("SelectedProject", "");
                        }
                    }
                }


                return(Json(result));
            }
            catch (System.Exception exc)
            {
                throw exc;
            }
        }
Beispiel #3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (HttpContext.Session.GetString("ActivePerson") == null)
            {
                filterContext.Result = new RedirectResult("/Login");
                return;
            }

            ViewBag.ActivePerson = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson"));
            var personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;

            ViewBag.Projects = ProjectDB.GetInstance().GetAllProject(personId);

            if (HttpContext.Session.GetString("SelectedProject") != null)
            {
                ViewBag.SelectedProjectId   = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id;
                ViewBag.SelectedProjectName = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Name;
            }
            else
            {
                ViewBag.SelectedProjectId = 0;
            }
            //Session.Timeout = 520000;

            //      var user = Session["ActiveUser"] as Kullanici;

            //      if (user == null)
            //      {

            //          filterContext.Result = new RedirectResult("/Login");
            //          return;
            //      }

            base.OnActionExecuting(filterContext);
        }
Beispiel #4
0
        public IActionResult Index()
        {
            var returnList = new List <HomeViewModel>();
            var personId   = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;
            var list       = ProjectDB.GetInstance().GetAllProject(personId);

            list.ForEach(item =>
            {
                var assignedPerson = PersonDB.GetInstance().GetPersonById(item.ProjectLeader);
                var step           = StepDB.GetInstance().GetAllNotificationByProjectId(item.Id);
                returnList.Add(new HomeViewModel()
                {
                    AssigneeUserName = $"{assignedPerson.Name} {assignedPerson.Surname}",
                    Code             = item.Code,
                    Description      = item.Description,
                    Id            = item.Id,
                    Name          = item.Name,
                    ProjectLeader = item.ProjectLeader,
                    ShortName     = item.ShortName,
                    Status        = item.Status,
                    Kalan         = step
                });
            });

            return(View(returnList));
        }
Beispiel #5
0
        public void ChangeSelectedProject(int _projectId)
        {
            var project = ProjectDB.GetInstance().GetProjeById(_projectId);

            if (project != null)
            {
                HttpContext.Session.SetString("SelectedProject", JsonConvert.SerializeObject(project));
            }
        }
 public JsonResult GetProjectPersonsByProjectId(int _projectId)
 {
     try
     {
         var list = ProjectDB.GetInstance().GetAllProjectPersonsByProjectId(_projectId);
         return(Json(list));
     }
     catch (Exception exc)
     {
         throw exc;
     }
 }
        public JsonResult GetProjeById(int _projeId)
        {
            try
            {
                var proje = ProjectDB.GetInstance().GetProjeById(_projeId);

                return(Json(proje));
            }
            catch (System.Exception exc)
            {
                throw exc;
            }
        }
        public JsonResult GetAllProjeler()
        {
            try
            {
                var personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;
                var projeler = ProjectDB.GetInstance().GetAllProject(personId);

                return(Json(projeler));
            }
            catch (System.Exception exc)
            {
                throw exc;
            }
        }
Beispiel #9
0
        public IActionResult Index()
        {
            var milestoneDetailList = new MilestoneViewModel();

            milestoneDetailList.MilestoneList = MilestoneDB.GetInstance().GetAllMilestone(JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id);
            milestoneDetailList.PersonList    = PersonDB.GetInstance().GetAllPerson();
            //milestoneDetailList.SprintList = SprintDB.GetInstance().GetAllSprint();
            var personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;

            milestoneDetailList.ProjectList = ProjectDB.GetInstance().GetAllProject(personId);



            return(View(milestoneDetailList));
        }
Beispiel #10
0
 public List <Project> GetAllToDoProject()
 {
     try
     {
         var _personId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("ActivePerson")).Id;
         using (var context = new ProjectManagementEntities())
         {
             var list = ProjectDB.GetInstance().GetAllProject(_personId);
             return(list);
         }
     }
     catch (System.Exception exc)
     {
         throw exc;
     }
 }
Beispiel #11
0
        public JsonResult SaveProject(string _titleProject, string _code, string _shortname, string _description, int _personID)

        {
            try
            {
                var project = new Project()
                {
                    Name          = _titleProject,
                    Code          = _code,
                    ShortName     = _shortname,
                    Description   = _description,
                    ProjectLeader = _personID
                };

                var result = ProjectDB.GetInstance().SaveProject(project);
                return(Json(result != null));
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
        public JsonResult SaveProject(string _titleProject, string _code, string _shortname, string _description, int _personId, int _projectId, List <int> _projeKisi)
        {
            try
            {
                if (_projectId == 0)
                {
                    var project = new Project()
                    {
                        Name          = _titleProject,
                        Code          = _code,
                        ShortName     = _shortname,
                        Description   = _description,
                        ProjectLeader = _personId,
                        Status        = 1
                    };


                    var result = ProjectDB.GetInstance().SaveProject(project);

                    var currentPersonId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;

                    if (!_projeKisi.Contains(currentPersonId))
                    {
                        _projeKisi.Add(currentPersonId);
                    }

                    for (int i = 0; i < _projeKisi.Count; i++)
                    {
                        var projeKisi = new ProjectPerson()
                        {
                            ProjectId = result.Id,
                            PersonId  = _projeKisi[i]
                        };

                        var ppResult = ProjectDB.GetInstance().SaveProjectPerson(projeKisi);
                    }

                    Board b = new Board()
                    {
                        Name      = "YAPILACAK",
                        ProjectId = result.Id,
                        Status    = 1
                    };

                    BoardDB.GetInstance().SavePano(b);

                    b = new Board()
                    {
                        Name      = "YAPILIYOR",
                        ProjectId = result.Id,
                        Status    = 1
                    };

                    BoardDB.GetInstance().SavePano(b);

                    b = new Board()
                    {
                        Name      = "TAMAMLANDI",
                        ProjectId = result.Id,
                        Status    = 1
                    };

                    BoardDB.GetInstance().SavePano(b);

                    return(Json(result != null));
                }
                else
                {
                    var project = new Project()
                    {
                        Name          = _titleProject,
                        Code          = _code,
                        ShortName     = _shortname,
                        Description   = _description,
                        ProjectLeader = _personId,
                        Id            = _projectId,
                        Status        = 1
                    };
                    var delete          = ProjectDB.GetInstance().DeleteProjectPersonByProjectId(_projectId);
                    var currentPersonId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id;

                    if (!_projeKisi.Contains(currentPersonId))
                    {
                        _projeKisi.Add(currentPersonId);
                    }

                    for (int i = 0; i < _projeKisi.Count; i++)
                    {
                        var projeKisi = new ProjectPerson()
                        {
                            ProjectId = _projectId,
                            PersonId  = _projeKisi[i]
                        };

                        var ppResult = ProjectDB.GetInstance().SaveProjectPerson(projeKisi);
                    }

                    var result = ProjectDB.GetInstance().UpdateProject(project);
                    return(Json(result != null));
                }
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }