예제 #1
0
        public bool CreateTask(TaskVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new TaskRepository(db);

                var task = new DBModels.Task
                {
                    Title         = model.Title,
                    Description   = model.Description,
                    DueDate       = DateTime.Parse(model.DueDate),
                    Status        = model.Status.ToString(),
                    ProjectId     = model.ProjectId,
                    ExpendedHours = model.TaskHours,
                    Category      = model.Category,
                    AssignedTo    = model.Developer
                };

                resp.Insert(task);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #2
0
        public bool RegisterUser(RegisterVM reg)
        {
            var success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new UsersRepository(db);

                bool emailExist = resp.AccountExist(reg.Email);

                if (!emailExist)
                {
                    var regUser = new User
                    {
                        Email     = reg.Email.Trim().ToLower(),
                        FirstName = reg.FirstName,
                        LastName  = reg.LastName,
                        Password  = reg.Password,
                        CompanyId = reg.CompanyId,
                        Role      = Roles.Employee.ToString()
                    };
                    resp.Insert(regUser);
                    success = db.SaveChanges() > 0;
                }
            }

            return(success);
        }
예제 #3
0
        public bool UpdateRisk(RiskVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new RiskRepository(db);

                var risk = resp.GetFirstOrDefault(r => r.RiskId == model.Id);

                risk.Status      = model.Status.ToString();
                risk.Description = model.Description;
                risk.Title       = model.Title;

                resp.Update(risk);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #4
0
        public bool UpdateRequirement(RequirementVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new RequirementRepository(db);

                var requirement = resp.GetFirstOrDefault(r => r.RequirementId == model.Id);

                requirement.Type        = model.Type.ToString();
                requirement.Category    = model.Category.ToString();
                requirement.Description = model.Description;
                requirement.Title       = model.Title;

                resp.Update(requirement);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #5
0
        public bool UpdateProject(ProjectVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var     resp      = new ProjectRepository(db);
                Project dbProject = resp.GetFirstOrDefault(p => p.ProjectID == model.Id);

                dbProject.Description    = model.Description;
                dbProject.DueDate        = DateTime.Parse(model.DueDate);
                dbProject.ProjectManager = model.Manager;
                dbProject.Status         = model.Status.ToString();
                dbProject.Title          = model.Title;

                resp.Update(dbProject);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #6
0
        public bool CreateRisk(RiskVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new RiskRepository(db);

                var risk = new Risk
                {
                    Title       = model.Title,
                    Description = model.Description,
                    ProjectId   = model.ProjectId,
                    Status      = model.Status.ToString()
                };

                resp.Insert(risk);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #7
0
        public bool UpdateTask(TaskVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var           resp   = new TaskRepository(db);
                DBModels.Task dbTask = resp.GetFirstOrDefault(t => t.TaskID == model.Id);

                dbTask.Category      = model.Category;
                dbTask.Description   = model.Description;
                dbTask.DueDate       = DateTime.Parse(model.DueDate);
                dbTask.ExpendedHours = model.TaskHours;
                dbTask.Status        = model.Status.ToString();
                dbTask.Title         = model.Title;
                dbTask.AssignedTo    = model.Developer;

                resp.Update(dbTask);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #8
0
        public bool CreateRequirement(RequirementVM model)
        {
            bool success = false;

            using (var db = new ManagementToolEntities())
            {
                var resp = new RequirementRepository(db);

                var requirement = new Requirement
                {
                    Title       = model.Title,
                    Description = model.Description,
                    ProjectId   = model.ProjectId,
                    Type        = model.Type.ToString(),
                    Category    = model.Category.ToString()
                };

                resp.Insert(requirement);
                success = db.SaveChanges() > 0;
            }

            return(success);
        }
예제 #9
0
        public bool CreateProject(ProjectVM model)
        {
            using (var db = new ManagementToolEntities())
            {
                var resp = new ProjectRepository(db);

                var project = new Project
                {
                    Title          = model.Title,
                    Description    = model.Description,
                    ProjectManager = model.Manager,
                    Status         = model.Status.ToString(),
                    DueDate        = DateTime.Parse(model.DueDate),
                    CompanyId      = model.CompanyId,
                    TeamMembers    = string.Join(";", model.ProjectEmployees)
                };

                resp.Insert(project);
                var success = db.SaveChanges() > 0;

                return(success);
            }
        }