Пример #1
0
        //For updating project details
        public static bool UpdateProject(ProjectsModel _ProjectsModel)
        {
            bool      result    = false;
            Database  db        = DatabaseFactory.CreateDatabase("Helios_V2_DB");
            DbCommand dbCommand = db.GetStoredProcCommand("sp_Projects_upd");

            db.AddInParameter(dbCommand, "@Project_parent_id", DbType.String, _ProjectsModel.Project_parent_id);
            db.AddInParameter(dbCommand, "@Project_name", DbType.String, _ProjectsModel.Project_name);
            db.AddInParameter(dbCommand, "@Project_description", DbType.String, _ProjectsModel.Project_description);
            db.AddInParameter(dbCommand, "@Project_start_date", DbType.String, _ProjectsModel.Project_start_date);
            db.AddInParameter(dbCommand, "@Project_end_date", DbType.String, _ProjectsModel.Project_end_date);
            db.AddInParameter(dbCommand, "@Created_by", DbType.String, _ProjectsModel.Created_by);
            db.AddInParameter(dbCommand, "@Created_date", DbType.String, _ProjectsModel.Created_date);
            db.AddInParameter(dbCommand, "@Client_name", DbType.String, _ProjectsModel.Client_name);
            int ret = db.ExecuteNonQuery(dbCommand);

            if (ret > 0)
            {
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
 public bool Update(ProjectsModel project)
 {
     if (project is null)
     {
         return(false);
     }
     try
     {
         string dateStart = String.Format("{0}/{1}/{2}", project.DateStart.Year, project.DateStart.Month, project.DateStart.Day);
         string dateDue   = String.Format("{0}/{1}/{2}", project.DateDue.Year, project.DateDue.Month, project.DateDue.Day);
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             string queryString = $"UPDATE {ProjectsTable} " +
                                  $"SET Name = '{project.Name}', " +
                                  $"ProjectManager_Id = {project.ProjectManager_Id}, " +
                                  $"DateStart = CAST('{dateStart}' as DATETIME), " +
                                  $"DateDue = CAST('{dateDue}' as DATETIME) " +
                                  $"WHERE {ProjectsTable}.Id = {project.Id}";
             connection.Open();
             SqlCommand command = new SqlCommand(queryString, connection);
             command.Prepare();
             int number = command.ExecuteNonQuery();
             return(number > 0 ? true : false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #3
0
        //For creating new project details
        public static int NewProjects(ProjectsModel _ProjectsModel)
        {
            int Project_id = 0;

            try
            {
                if (_ProjectsModel != null)
                {
                    Database  db        = DatabaseFactory.CreateDatabase("Helios_V2_DB");
                    DbCommand dbCommand = db.GetStoredProcCommand("sp_Projects_ins");
                    db.AddInParameter(dbCommand, "@Project_parent_id", DbType.String, _ProjectsModel.Project_parent_id);
                    db.AddInParameter(dbCommand, "@Project_name", DbType.String, _ProjectsModel.Project_name);
                    db.AddInParameter(dbCommand, "@Project_description", DbType.String, _ProjectsModel.Project_description);
                    db.AddInParameter(dbCommand, "@Project_start_date", DbType.String, _ProjectsModel.Project_start_date);
                    db.AddInParameter(dbCommand, "@Project_end_date", DbType.String, _ProjectsModel.Project_end_date);
                    db.AddInParameter(dbCommand, "@Created_by", DbType.String, _ProjectsModel.Created_by);
                    db.AddInParameter(dbCommand, "@Created_date", DbType.String, _ProjectsModel.Created_date);
                    db.AddInParameter(dbCommand, "@Client_name", DbType.String, _ProjectsModel.Client_name);
                    db.AddInParameter(dbCommand, "@Active_flag", DbType.String, _ProjectsModel.Active_flag);
                    Project_id = (int)db.ExecuteScalar(dbCommand);
                }
            }
            catch (Exception ex)
            {
                string var = ex.Message;
            }
            return(Project_id);
        }
Пример #4
0
        public void TestProjectController_UpdateProjectsDeleteItem(string httpMethod)
        {
            SetUpProjectControllerForTesting(httpMethod);
            projectController.CurrentUser = user;

            ProjectsModel model = new ProjectsModel();

            model.ProjectId = projectId;
            FormCollection   form             = new FormCollection();
            ProjectListModel projectListModel = new ProjectListModel();

            long _projectId = this.db.Context.Projects.Where(p => p.OwnerId == user.UserId && p.ProjectStatusTypeId == ProjectStatusTypeEnum.Inactive).OrderByDescending(p => p.ProjectId).Select(p => p.ProjectId).FirstOrDefault();

            projectListModel.ProjectId = _projectId;
            model.Items.Add(projectListModel);

            System.Collections.Specialized.NameValueCollection nameValueCollection = new System.Collections.Specialized.NameValueCollection();
            nameValueCollection.Add(_projectId.ToString(), _projectId.ToString());
            form.Add(nameValueCollection);

            ViewResult result = projectController.UpdateProjectsDeleteItem(model, form) as ViewResult;

            Assert.That(result, Is.Not.EqualTo(null));
            Assert.That(result.ViewName, Is.EqualTo("Projects"));
            Assert.That(result.Model, Is.Not.EqualTo(null));
            Assert.That((result.Model as ProjectsModel).DeleteProjects.First().ProjectId, Is.EqualTo(_projectId));
        }
Пример #5
0
 public ActionResult LogOut(string id)
 {
     //ProjectsModel pmd = new ProjectsModel();
     if (string.IsNullOrWhiteSpace(id))
     {
         return(RedirectToAction("Fault", "Error"));
     }
     if (id != null)
     {
         try
         {
             Guid _Id = new Guid(id);
             if (_Id == Guid.Empty)
             {
                 return(RedirectToAction("Fault", "Error"));
             }
             ProjectsModel pmod = new ProjectsModel();
             pmod.UserId = Guid.Empty;
             //FormsAuthentication.SignOut();
             return(RedirectToAction("LogIn", "Account"));
         }
         catch (FormatException ex)
         {
             return(RedirectToAction("Fault", "Error"));
         }
     }
     return(View("LogIn"));
     //}
     //return RedirectToAction("SignOut", "Account");
 }
        public ActionResult Edit(int project_id)
        {
            string errorMsg = String.Empty;

            if (TempData.ContainsKey("error"))
            {
                errorMsg = TempData["error"].ToString();
            }
            ProjectsModel         project      = new ProjectsModel();
            List <SelectListItem> employeeList = new List <SelectListItem>();

            try
            {
                employeeList = Utils.Helper.GetEmployeeList();
                project      = _projectService.GetProject(project_id);
            }
            catch (Exception e)
            {
                TempData["error"] = $"Problems with getting information from database (services). {e.Message}";
                return(RedirectToAction("Index", "Home"));
            }
            ProjectsVm model = new ProjectsVm();

            model.Id   = project.Id;
            model.Name = project.Name;
            model.ProjectManager_Id = project.ProjectManager_Id;
            model.DateStart         = project.DateStart;
            model.DateDue           = project.DateDue;
            model.EmployeeList      = employeeList;
            model.ErrorMsg          = errorMsg;
            return(View("Edit", model));
        }
        public ActionResult SaveEdititngProject(ProjectsVm model)
        {
            if (model is null || String.IsNullOrWhiteSpace(model.Name) ||
                model.ProjectManager_Id == 0 || model.ProjectManager_Id == null ||
                model.DateStart == DateTime.MinValue || model.DateDue == DateTime.MinValue ||
                DateTime.Compare(model.DateStart, model.DateDue) > 0)
            {
                TempData["error"] = "You did not enter dates correctly or you did not fill in some fields. All fields are required.. Check the dates and try again.";
                return(RedirectToAction("Edit", new { project_id = model.Id }));
            }
            ProjectsModel project = new ProjectsModel()
            {
                Id   = model.Id,
                Name = model.Name,
                ProjectManager_Id = model.ProjectManager_Id,
                DateStart         = model.DateStart,
                DateDue           = model.DateDue
            };

            try
            {
                if (!_projectService.Update(project))
                {
                    TempData["error"] = $"Problems with updating project info (Service error \"Update/Edit\").";
                    return(RedirectToAction("Edit", new { project_id = model.Id }));
                }
            }
            catch (Exception e)
            {
                TempData["error"] = $"Problems with getting information from database (services). {e.Message}";
                return(RedirectToAction("Edit", model));
            }
            return(RedirectToAction("Index"));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,TeamId")] ProjectsModel projectsModel)
        {
            if (id != projectsModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(projectsModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectsModelExists(projectsModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(projectsModel));
        }
        public bool Create(ProjectsModel project)
        {
            {
                if (project == null)
                {
                    return(false);
                }
                try
                {
                    using (SqlConnection connection = new SqlConnection(ConnectionString))
                    {
                        string dateStart   = String.Format("{0}/{1}/{2}", project.DateStart.Year, project.DateStart.Month, project.DateStart.Day);
                        string dateDue     = String.Format("{0}/{1}/{2}", project.DateDue.Year, project.DateDue.Month, project.DateDue.Day);
                        string queryString = $"INSERT INTO {ProjectsTable} (Name, ProjectManager_Id, DateStart, DateDue) " +
                                             $"VALUES (" +
                                             $"'{project.Name}', " +
                                             $"{project.ProjectManager_Id}, " +
                                             $"'{dateStart}', '{dateDue}')";


                        connection.Open();
                        SqlCommand command = new SqlCommand(queryString, connection);
                        command.Prepare();
                        int number = command.ExecuteNonQuery();
                        return(number > 0 ? true : false);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
Пример #10
0
        private void GetModelDatas(ProjectsModel item)
        {
            if (!string.IsNullOrEmpty(item.ProjectTypeJson))
            {
                item.ProjectType     = JsonConvert.DeserializeObject <ProjectType>(item.ProjectTypeJson);
                item.ProjectTypeJson = "";
            }
            if (!string.IsNullOrEmpty(item.ReleaseManagerJson))
            {
                item.ReleaseManager     = JsonConvert.DeserializeObject <TeamMembersModel>(item.ReleaseManagerJson);
                item.ReleaseManagerJson = "";
            }

            try
            {
                // load the project history
                var tblObj = _MyCommand.Select_Table($"select * from projectdetails where projectdetails.ProjectId='{item.ProjectId}';", CommandType.Text);
                item.ProjectDetails = ConvertDataTableToList <ProjectDetailModel>(tblObj);

                // load the project Team Member
                _MyCommand.Clear_CommandParameter();
                _MyCommand.Add_Parameter_WithValue("par_ProjectId", item.ProjectId.ToString());
                var _projectTeamMembers = _MyCommand.Select_Table($"getProjectTeamMembers", CommandType.StoredProcedure);
                item.ProjectTeamMembers = ConvertDataTableToList <ProjectTeamMembers>(_projectTeamMembers);
                item.ProjectTeamMembers.ForEach(pt => GetTeamMembers(pt));
            }
            catch (Exception ex)
            {
                throw new System.Exception(
                          Common.Utilities.ErrorCodes.ProcessException(ex, "BAL", "bProjects", "GetModelDatas(ProjectId)"));
            }
        }
        public ActionResult Create(ProjectsVm model)
        {
            if (model is null || String.IsNullOrWhiteSpace(model.Name) ||
                model.ProjectManager_Id == 0 || model.ProjectManager_Id == null ||
                model.DateStart == DateTime.MinValue || model.DateDue == DateTime.MinValue ||
                DateTime.Compare(model.DateStart, model.DateDue) > 0)
            {
                TempData["error"] = "You did not enter dates correctly or you did not fill in some fields. All fields are required.. Check the dates and try again.";
                return(RedirectToAction("Create"));
            }
            ProjectsModel project = new ProjectsModel()
            {
                Name = model.Name,
                ProjectManager_Id = model.ProjectManager_Id,
                DateStart         = model.DateStart.Date,
                DateDue           = model.DateDue.Date
            };

            try
            {
                if (!_projectService.Create(project))
                {
                    TempData["error"] = $"Problems with create project (Service error \"Create\").";
                    return(RedirectToAction("Create"));
                }
            }
            catch (Exception e)
            {
                TempData["error"] = $"Problems with saving information to database (services). {e.Message}";
                return(RedirectToAction("Create"));
            }
            return(RedirectToAction("Index"));
        }
Пример #12
0
        //For get project list
        public static List <ProjectsModel> GetProject(int id)
        {
            ProjectsModel        _ProjectsModel    = null;
            List <ProjectsModel> ProjectsModelList = new List <ProjectsModel>();
            Database             db        = DatabaseFactory.CreateDatabase("Helios_V2_DB");
            DbCommand            dbCommand = db.GetStoredProcCommand("sp_Project_get");

            if (id > 0)
            {
                db.AddInParameter(dbCommand, "@Employee_profile_id", DbType.Int32, id);
            }
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader != null && dataReader.Read())
                {
                    _ProjectsModel                     = new ProjectsModel();
                    _ProjectsModel.Project_id          = DataParser.GetSafeInt(dataReader, "Project_id", 0);
                    _ProjectsModel.Project_parent_id   = DataParser.GetSafeInt(dataReader, "Project_parent_id", 0);
                    _ProjectsModel.Project_name        = DataParser.GetSafeString(dataReader, "Project_name", string.Empty);
                    _ProjectsModel.Project_description = DataParser.GetSafeString(dataReader, "Project_description", string.Empty);
                    _ProjectsModel.Project_start_date  = DataParser.GetSafeDateTime(dataReader, "Project_start_date", DateTime.Now);
                    _ProjectsModel.Project_end_date    = DataParser.GetSafeDateTime(dataReader, "Project_end_date", DateTime.Now);
                    _ProjectsModel.Created_by          = DataParser.GetSafeInt(dataReader, "Created_by", 0);
                    _ProjectsModel.Created_date        = DataParser.GetSafeDateTime(dataReader, "Created_date", DateTime.Now);
                    _ProjectsModel.Client_name         = DataParser.GetSafeString(dataReader, "Client_name", string.Empty);
                    _ProjectsModel.Active_flag         = DataParser.GetSafeBool(dataReader, "Active_flag", true);
                    ProjectsModelList.Add(_ProjectsModel);
                }
            }
            return(ProjectsModelList);
        }
        public async Task <JsonResult <ProjectsModel> > GetProjectAsync(int id)
        {
            //EntityMapper<Projects, ProjectsModel> mapObj = new EntityMapper<Projects, ProjectsModel>();
            //ProjectService projService = new ProjectService(dbContext);
            projService = new ProjectService(dbContext);
            Projects dalProject = await projService.GetProject(id);

            ProjectsModel Projects = new ProjectsModel();

            if (dalProject != null)
            {
                Projects.Project_ID = dalProject.Project_ID;
                Projects.Project    = dalProject.Project;
                Projects.StartDate  = dalProject.StartDate;
                Projects.EndDate    = dalProject.EndDate;
                Projects.Priority   = dalProject.Priority;
                Projects.User_ID    = dalProject.User_ID;
                Projects.Name       = dalProject.Users1 != null ? dalProject.Users1.FirstName + " " + dalProject.Users1.LastName : "";
            }
            else
            {
                throw new Exception("Project not available");
            }
            //Projects = mapObj.Translate(dalProject);
            //AutoMapper.Mapper.Map(dalProject, Projects);

            return(Json <ProjectsModel>(Projects));
        }
Пример #14
0
        public ActionResult AddProject(Guid UserId, string btnAddProject, string btnCancel, string pName, string pClient, string pManager, string pDeveloper, string pDesigner, string pType, string pStatus, string pUrl, string pDb, string pServer, string pBPlan, double pCost)
        {
            //Sending new values to a model
            string ProjectName    = pName;
            string ClientName     = pClient;
            string ProjectManager = pManager;
            string Developer      = pDeveloper;
            string Designer       = pDesigner;
            string ProjectType    = pType;
            string Status         = pStatus;
            string URL            = pUrl;
            string ProjectDB      = pDb;
            string ProjectServer  = pServer;
            string BackUp         = pBPlan;
            double Cost           = pCost;

            if (!string.IsNullOrEmpty(btnAddProject))
            {
                string _checkMessage = "";

                //storing in DB
                _checkMessage   = _manager.AddProject(UserId, ProjectName, ClientName, ProjectManager, Developer, Designer, ProjectType, Status, URL, ProjectDB, ProjectServer, BackUp, Cost);
                ViewBag.Message = _checkMessage;
            }

            ProjectsModel pmd = Refresh(UserId);

            return(PartialView("_tablePartial", pmd));
        }
        public ActionResult Searche(String query, int?pageIndex)
        {
            var countElementPage       = 10;
            ProjetRepositery projetRep = new ProjetRepositery();
            var projets = projetRep.getSerachingProjects(query);
            List <ProjectsModel> projetsModel = new List <ProjectsModel>();
            CustomersModel       customer     = new CustomersModel();

            foreach (var prjt in projets)
            {
                ProjectsModel prjtModel = new ProjectsModel();
                prjtModel.Project_ID  = prjt.Project_ID;
                prjtModel.Pole_ID     = prjt.Pole_ID;
                prjtModel.Description = prjt.Description;
                prjtModel.Budget      = prjt.Budget;
                prjtModel.Name        = prjt.Name;
                customer.Name         = projetRep.GetByIdCutomer(prjt.Customer_ID).Name;
                prjtModel.Customers   = customer;
                projetsModel.Add(prjtModel);
            }
            IQueryable <ProjectsModel>    listProjets = projetsModel.AsQueryable();
            PaginatedList <ProjectsModel> lst         = new PaginatedList <ProjectsModel>(listProjets, pageIndex, countElementPage);

            return(View("AllProjects", lst));
        }
Пример #16
0
        public ActionResult UpdateType(string _SelectedValue, Guid _SelectedIndex, Guid userId)
        {
            ProjectsModel pmd           = new ProjectsModel();
            string        _projectCheck = "";

            using (PureSurveyProjectTrackerEntities ptdb = new PureSurveyProjectTrackerEntities())
            {
                Project pjct = ptdb.Projects.Where(x => x.Project_ID == _SelectedIndex).FirstOrDefault();
                if (pjct != null)
                {
                    pjct.ProjectTypeDescription = _SelectedValue;
                    ptdb.Projects.AddOrUpdate(pjct);
                    ptdb.SaveChanges();

                    _projectCheck = pjct.ProjectName.ToString() + "Updated Succesfully";
                }
                else
                {
                    _projectCheck = pjct.Status.ToString() + "There is no such !";
                }
            }

            pmd = Refresh(userId);
            return(PartialView("_tablePartial", pmd));
        }
        public ActionResult AllProjets(int?pageIndex)
        {
            ProjetRepositery prtRep = new ProjetRepositery();
            int countElementPage    = 10;
            var projets             = prtRep.allProjects();

            if (projets.Count() == 0)
            {
                ViewData["erreurMessage"] = "Aucun Projet!";
                ViewData["element"]       = "Projet";
                ViewData["create"]        = "true";
                return(View("ErrorEmptyList"));
            }
            List <ProjectsModel> projetsModel = new List <ProjectsModel>();

            foreach (var prjt in projets)
            {
                ProjectsModel  prjtModel = new ProjectsModel();
                CustomersModel Customer  = new CustomersModel();
                prjtModel.Project_ID  = prjt.Project_ID;
                prjtModel.Pole_ID     = prjt.Pole_ID;
                prjtModel.Description = prjt.Description;
                prjtModel.Budget      = prjt.Budget;
                prjtModel.Name        = prjt.Name;
                Customer.Name         = prtRep.GetByIdCutomer(prjt.Customer_ID).Name;
                prjtModel.Customers   = Customer;
                projetsModel.Add(prjtModel);
            }
            IQueryable <ProjectsModel>    listProjets = projetsModel.AsQueryable();
            PaginatedList <ProjectsModel> lst         = new PaginatedList <ProjectsModel>(listProjets, pageIndex, countElementPage);

            return(View("AllProjects", lst));
        }
        public ActionResult Searche(String query, int?pageIndex, Guid id)
        {
            var countElementPage      = 10;
            ExpanseRepositery expRepo = new ExpanseRepositery();
            var expanses = expRepo.getSerachingExpanses(query, id);
            List <ExpansesModel> expanseModel = new List <ExpansesModel>();

            ViewData["idExpanseReport"] = id;
            foreach (var exp in expanses)
            {
                ExpansesModel       expanse        = new ExpansesModel();
                CustomersModel      customer       = new CustomersModel();
                ExpanseTypesModel   expType        = new ExpanseTypesModel();
                ExpanseReportsModel expanseRapport = new ExpanseReportsModel();
                ProjectsModel       projet         = new ProjectsModel();
                expanse.Expanse_ID     = exp.Expanse_ID;
                expanse.Amount_HT      = exp.Amount_HT;
                expanse.Amount_TTC     = exp.Amount_TTC;
                expanse.Amount_TVA     = exp.Amount_TVA;
                customer.Name          = expRepo.GetByIdCutomer(exp.Customer_ID).Name;
                projet.Name            = expRepo.GetByIdProjects(exp.Project_ID).Name;
                expType.Name           = expRepo.GetByIdExpanseTypes(exp.ExpanseType_ID).Name;
                expanseRapport.Year    = expRepo.GetByIdExpansesRepport(exp.ExpanseReport_ID).Year;
                expanse.Customers      = customer;
                expanse.Projects       = projet;
                expanse.ExpanseReports = expanseRapport;
                expanse.ExpanseTypes   = expType;
                expanseModel.Add(expanse);
            }
            IQueryable <ExpansesModel>    listCust = expanseModel.AsQueryable();
            PaginatedList <ExpansesModel> lst      = new PaginatedList <ExpansesModel>(listCust, pageIndex, countElementPage);

            return(View("AllExpanses", lst));
        }
        public PartialViewResult ListProject(Guid customerId)
        {
            ProjetRepositery      prjtRepo          = new ProjetRepositery();
            IQueryable <Projects> projectsList      = prjtRepo.GetProjectsByIdCutomer(customerId);
            List <ProjectsModel>  projectsListModel = new List <ProjectsModel>();

            foreach (var prjt in projectsList)
            {
                ProjectsModel  prjtModel = new ProjectsModel();
                CustomersModel Customer  = new CustomersModel();
                prjtModel.Project_ID  = prjt.Project_ID;
                prjtModel.Pole_ID     = prjt.Pole_ID;
                prjtModel.Description = prjt.Description;
                prjtModel.Budget      = prjt.Budget;
                prjtModel.Name        = prjt.Name;
                Customer.Name         = prjtRepo.GetByIdCutomer(prjt.Customer_ID).Name;
                prjtModel.Customers   = Customer;
                projectsListModel.Add(prjtModel);
            }
            var expanseViewModel = new ExpansesModel
            {
                ProjectsList = projectsListModel
            };

            return(PartialView("_ProjectItem", expanseViewModel));
        }
Пример #20
0
        public HttpResponseMessage GetAllProjects()
        {
            HttpResponseMessage resp;
            var uriMaker = Request.TryGetUriMakerFor<ProjectsController>();
            try
            {
                List<ProjectModel> projects = DB_Gets.GetAllProjects();
                foreach(ProjectModel p in projects)
                {
                    p.Links.Add(new Link(p.proj_name, uriMaker.UriFor(c=>c.GetProjectByName(p.proj_name,DEFAULT_PAGESIZE,1)).AbsolutePath));
                    p.Rel = "projects";
                }

                ProjectsModel projects_hal = new ProjectsModel(projects);
                projects_hal.Href = uriMaker.UriFor(c => c.GetAllProjects()).AbsolutePath;
                projects_hal.Links.Add(new Link("create_project", uriMaker.UriFor(c=>c.PostProject(null)).AbsolutePath));
                projects_hal.Links.Add(new Link("search_project", uriMaker.UriFor(c =>c.GetProjectsByNameSearch("")).AbsolutePath));

                resp = Request.CreateResponse<ProjectsModel>(HttpStatusCode.OK, projects_hal);
            }
            catch (MyException e)
            {
                ErrorModel error = e.GetError();
                error.instance = uriMaker.UriFor(c => c.GetAllProjects()).AbsoluteUri;
                resp = Request.CreateResponse<ErrorModel>(
                    error.status, error,
                    new JsonMediaTypeFormatter(),
                    new MediaTypeHeaderValue("application/problem+json"));
            }
            return resp;
        }
Пример #21
0
        public ActionResult SaveEditProject(EditModalView viewModel)
        {
            ProjectsManager pm = new ProjectsManager();

            if (!ModelState.IsValid)
            {
                viewModel.Types         = pm.getProjectTypesOptions();
                viewModel.Statuses      = pm.getProjectStatusOptions();
                viewModel.BackUpOptions = pm.getBackUpPlanOptions();
                viewModel.PMs           = pm.getPMOptions();
                viewModel.Devs          = pm.getDevsOptions();
                viewModel.Desgns        = pm.getDesgnsOptions();

                return(Json(new { isValid = false, view = RenderViewAsString("_EditPartial", viewModel) }));
            }

            string _checkMessage = "";

            //storing in DB
            _checkMessage   = pm.SaveEditProject(viewModel);
            ViewBag.Message = _checkMessage;

            ProjectsModel pmd = Refresh(viewModel.userId);

            return(Json(new { isValid = true, view = RenderViewAsString("_tablePartial", pmd) }));
        }
Пример #22
0
        private void LoadArchivedProjects()
        {
            var model = new ProjectsModel();

            model.Projects = this.Model.Projects.Where(project => project.IsArchived);

            this.ArchivedProjectsControl.DataContext = model;
        }
Пример #23
0
        private void LoadInactiveProjects()
        {
            var model = new ProjectsModel();

            model.Projects = this.Model.Projects.Where(project => !project.IsActive && !project.IsArchived);

            this.InactiveProjectsControl.DataContext = model;
        }
Пример #24
0
        public ActionResult DeleteConfirmed(int id)
        {
            ProjectsModel projectsModel = db.ProjectsModels.Find(id);

            db.ProjectsModels.Remove(projectsModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #25
0
        public IActionResult Update(int id, ProjectsModel updateModel)
        {
            var projectsFromRepo = _services.GetByID(id);

            _mapper.Map(updateModel, projectsFromRepo);
            _services.Update(projectsFromRepo);
            _services.SaveChange();
            return(Ok(updateModel));
        }
Пример #26
0
        public int NewProjects(ProjectsModel _ProjectsModel)
        {
            int result = 0;

            if (_ProjectsModel != null)
            {
                result = EmployeeProfileDAL.NewProjects(_ProjectsModel);
            }
            return(result);
        }
Пример #27
0
 public ActionResult Edit([Bind(Include = "ProjectId,ProjectName,DescripProject,Image,GitAddress")] ProjectsModel projectsModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(projectsModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(projectsModel));
 }
 private void NotifyOnProjectSelectionChanged(bool isSelected, IExtensibleProject project)
 {
     if (isSelected)
     {
         ProjectsModel.Add(project);
     }
     else
     {
         ProjectsModel.Remove(project);
     }
 }
Пример #29
0
        public ActionResult Create([Bind(Include = "ProjectId,ProjectName,DescripProject,Image,GitAddress")] ProjectsModel projectsModel)
        {
            if (ModelState.IsValid)
            {
                db.ProjectsModels.Add(projectsModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(projectsModel));
        }
Пример #30
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,TeamId")] ProjectsModel projectsModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(projectsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(projectsModel));
        }
Пример #31
0
        public void TestProjectController_ProjectExport(string httpMethod)
        {
            SetUpProjectControllerForTesting(httpMethod);
            projectController.CurrentUser = user;
            ProjectsModel model = new ProjectsModel();

            model = projectService.GetProjectsModel(user, model).Model as ProjectsModel;
            ViewResult result = projectController.ProjectExport(model) as ViewResult;

            Assert.That(result, Is.EqualTo(null));
        }