private void Initialize(ProjectSection obj, List <ProjectSection> objects)
        {
            var items = objects.ChangedGuid(_currentObject.Id, obj.Id).DeleteAccesses();

            items.Add(obj);
            Storage.CreateAsync(obj.ParentId, items.ToArray());
        }
Пример #2
0
 public PilotStorageBase()
 {
     Storage       = NinjectCommon.Kernel.Get <IBaseObjectStorage>();
     _folderRemark = NinjectCommon.Kernel.Get <List <ProjectSection> >().FirstOrDefault(x => x.Name == _currentObject.Name &&
                                                                                        x.Attributes.ContainsKey(Storage.Settings?.RemarkFolder?.AttributeCipher) &&
                                                                                        x.Attributes[Storage.Settings.RemarkFolder.AttributeCipher].Equals(_currentObject.Id.ToString()));
 }
Пример #3
0
 public void CreateObject(ProjectSection obj)
 {
     if (Create(obj) != null)
     {
         _modifer?.Apply();
     }
 }
Пример #4
0
        public Result <ProjectSection> Save(ProjectSection userinfo)
        {
            var result = new Result <ProjectSection>();

            try
            {
                var objtosave = _context.projectSections.FirstOrDefault(u => u.ProjectSectionId == userinfo.ProjectSectionId);
                if (objtosave == null)
                {
                    objtosave = new ProjectSection();
                    _context.projectSections.Add(objtosave);
                }
                objtosave.PostId      = userinfo.PostId;
                objtosave.SectionName = userinfo.SectionName;
                objtosave.Percentage  = userinfo.Percentage;
                objtosave.Price       = userinfo.Price;


                if (!IsValid(objtosave, result))
                {
                    return(result);
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                result.HasError = true;
                result.Message  = ex.Message;
            }
            return(result);
        }
Пример #5
0
    protected virtual async Task Write(IEnumerable <PluginRecord> data, IFileOutputFormatterOptions options)
    {
        if (options is null)
        {
            throw new ArgumentNullException(nameof(options));
        }

        if (string.IsNullOrWhiteSpace(options.Path))
        {
            throw new ArgumentException(nameof(options.Path));
        }

        var document = Document.Create("List of VSTs");

        var detailsList = data.ToList();

        var projectSection = new ProjectSection();

        projectSection.Add(detailsList);

        var pluginSection = new PluginSection();

        pluginSection.Add(detailsList);

        var mainIndex = new MainIndex("main-index", "Main index");

        mainIndex.Add(new ISection[] { projectSection, pluginSection });

        document.AddMainIndex(mainIndex);
        document.AddSection(projectSection);
        document.AddSection(pluginSection);

        document.Save(options.Path);
        await Task.CompletedTask;
    }
Пример #6
0
        private List <ProjectWorkerGeneralDto> GenerateProjectGeneral(List <ProjectWorkerDto> getProjectWorkers)
        {
            List <ProjectWorkerGeneralDto> projectWorkerGeneralDtos = new List <ProjectWorkerGeneralDto>();
            var              sectionID         = 0;
            ProjectSection   getProjectSection = null;
            ProjectDetailDto getProject        = null;

            foreach (var getProjectWorker in getProjectWorkers)
            {
                var getProjectSectionDepartment = _projectSectionDepartmentService.GetByID(getProjectWorker.ProjectSectionDepartmentID).Data;

                if (sectionID != getProjectSectionDepartment.ProjectSectionID)
                {
                    sectionID         = getProjectSectionDepartment.ProjectSectionID;
                    getProjectSection = _projectSectionService.GetBySectionID(getProjectSectionDepartment.ProjectSectionID).Data;
                    getProject        = _projectService.GetByID(getProjectSection.ProjectID).Data;
                }

                ProjectWorkerGeneralDto projectWorkerGeneralDto = new ProjectWorkerGeneralDto()
                {
                    projectDetail             = getProject,
                    projectSection            = getProjectSection,
                    projectSectionDepartments = getProjectSectionDepartment,
                    projectWorkerDto          = getProjectWorker
                };
                projectWorkerGeneralDtos.Add(projectWorkerGeneralDto);
            }

            return(projectWorkerGeneralDtos);
        }
Пример #7
0
        public bool IsValid(ProjectSection obj, Result <ProjectSection> result)
        {
            if (!ValidationHelper.IsStringValid(obj.PostId.ToString()))
            {
                result.HasError = true;
                result.Message  = "Invalid PostId";
                return(false);
            }


            if (!ValidationHelper.IsStringValid(obj.SectionName))
            {
                result.HasError = true;
                result.Message  = "Invalid SectionName";
                return(false);
            }
            if (!ValidationHelper.IsStringValid(obj.Percentage.ToString()))
            {
                result.HasError = true;
                result.Message  = "Invalid Percentage";
                return(false);
            }
            if (!ValidationHelper.IsStringValid(obj.Price.ToString()))
            {
                result.HasError = true;
                result.Message  = "Invalid Price";
                return(false);
            }

            return(true);
        }
Пример #8
0
 public User()
 {
     Education = new EducationSection();
     Jobs = new JobSection();
     Projects = new ProjectSection();
     DateOfBirth = DateTime.Today;
 }
Пример #9
0
        public ProjectSection CreateNewRedaction(ProjectSection currentObject, string cipherName, string cipherValue)
        {
            try
            {
                List <IAccessRecord> accessRecord = new List <IAccessRecord>();

                var obj = currentObject.Clone() as ProjectSection;

                //даем новый id
                obj.Id = Guid.NewGuid();

                //отчищаем атрибуты
                obj.Attributes.Clear();

                //добавляем новый атрибут
                obj.Attributes[cipherName] = cipherValue;

                //добавление прав
                var groups = Storage.Settings.Subdivisions.Distinct().ToList();
                for (int i = 0; i < groups.Count; i++)
                {
                    accessRecord.Add(GetAccessRecord(groups[i], AccessLevel.View));
                }
                obj.Access = accessRecord;

                //Storage.CreateAsync(obj.ParentId, obj).Wait();

                return(obj);
            }
            catch (Exception) { return(null); }
        }
        public bool ExistsRemark(ProjectSection currentObject)
        {
            var folderRemark = _folderRemark.FirstOrDefault(x => x.Name == currentObject.Name &&
                                                            x.Attributes.ContainsKey(_settings?.RemarkFolder?.AttributeCipher) &&
                                                            x.Attributes[_settings.RemarkFolder.AttributeCipher].Equals(currentObject.Id.ToString()));

            return(folderRemark?.Children != null?folderRemark.Children.Any() : false);
        }
Пример #11
0
        public static DocumentModel MapToDocumentModel(this ProjectSection source, ObservableCollection <DocumentModel> objects)
        {
            var doc = new Document {
                Id = source.Id, Title = source.Name, Link = new Uri($@"piloturi://{source.Id}")
            };

            return(new DocumentModel(doc, objects));
        }
Пример #12
0
        private static ProjectSection CreateProjectSectionFromMatch(Match sectionMatch)
        {
            var projectType = (sectionMatch.Groups["type"].Value == "preProject")
                                  ? ProjectSectionType.PreProject
                                  : ProjectSectionType.PostProject;
            var section = new ProjectSection(sectionMatch.Groups["name"].Value, projectType);

            return(section);
        }
Пример #13
0
 protected void SectionsList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.ToLower().CompareTo("delete") == 0)
     {
         int            ProjectSectionID = Micajah.Common.Helper.Convert.o2i(e.CommandArgument);
         ProjectSection oProjectSection  = new ProjectSection();
         oProjectSection.LoadByPrimaryKey(ProjectSectionID);
         m_Name = oProjectSection.Name;
     }
 }
        public ActionResult Update(ProjectSection projectSection)
        {
            var result = _projectSectionService.Update(projectSection);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Пример #15
0
        public IResult Update(ProjectSection projectSections)
        {
            IResult result = BusinessRules.Run(CheckIfSectionNameAlreadyExistInProject(projectSections));

            if (result != null)
            {
                return(result);
            }
            _projectSectionDal.Update(projectSections);
            return(new SuccessResult(Messages.ProjectSectionUpdated));
        }
Пример #16
0
        public void EditObj(ProjectSection obj)
        {
            var builder = _modifer?.EditById(obj.Id);

            if (builder != null)
            {
                SetAttribute(builder, obj.Attributes);
                SetFiles(builder, obj.Files);
                SetAccess(builder, obj.Access);
            }
            _modifer?.Apply();
        }
Пример #17
0
        private static void ParseSectionEntries(Match sectionMatch, ProjectSection section)
        {
            var entries    = sectionMatch.Groups["entries"].Value;
            var entryMatch = EntryPattern.Match(entries);

            while (entryMatch.Success)
            {
                var entryKey   = entryMatch.Groups["key"].Value.Trim();
                var entryValue = entryMatch.Groups["value"].Value.Trim();
                section.Entries[entryKey] = entryValue;
                entryMatch = entryMatch.NextMatch();
            }
        }
Пример #18
0
        public bool CreateObject(ProjectSection obj)
        {
            var builder = _modifer?.CreateById(obj.Id, obj.ParentId, _repository.GetType(obj.Type.Id));

            if (builder != null)
            {
                SetAttribute(builder, obj.Attributes);
                SetFiles(builder, obj.Files);
                SetAccess(builder, obj.Access);
            }

            return(builder != null);
        }
Пример #19
0
        //public IDataResult<List<ProjectSectionDto>> GetByUserID(int userID)
        //{
        //    return new SuccessDataResult<List<ProjectSectionDto>>(_projectSectionDal.GetByUserID(userID));
        //}

        private IResult CheckIfSectionNameAlreadyExistInProject(ProjectSection projectSections)
        {
            var result = _projectSectionDal.GetAll(p => p.ProjectID == projectSections.ProjectID).Find(p => p.ProjectSectionName == projectSections.ProjectSectionName);

            if (result != null)
            {
                if (projectSections.ProjectSectionID != result.ProjectSectionID)
                {
                    return(new ErrorResult(Messages.DepartmentAlreadyExistInSection));
                }
            }
            return(new SuccessResult());
        }
        public ActionResult CreateProject(PostProjectModel PostProjectModel, string Selectskills)
        {
            try
            {
                string[] tokens = Selectskills.Split(',');

                PostProjectModel p = new PostProjectModel();

                var result = _postservice.Save(p.Insert(PostProjectModel));

                var last = _postservice.GetLastId();

                foreach (var x in PostProjectModel.SectionName)
                {
                    var projectsection = new ProjectSection();

                    projectsection.SectionName = x;
                    projectsection.PostId      = last.Data.PostId;
                    var result1 = _sectionservice.Save(projectsection);
                }

                //foreach (var skillid in PostProjectModel.SkillName)
                //{
                //    var projectskill = new ProjectSkills();
                //    projectskill.SkillName = skillid;
                //    projectskill.PostId = last.Data.PostId;
                //    var result2 = _proskillservice.Save(projectskill);
                //}


                PostProjectModel.PostId = last.Data.PostId;
                foreach (var str in tokens)
                {
                    var objToSave = new ProjectSkills();
                    objToSave.SkillName = str;
                    objToSave.PostId    = PostProjectModel.PostId;
                    _projectSkillService.Save(objToSave);
                }

                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(View("CreateProject"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(RedirectToAction("ProjectDetails", "Owner", new { id = PostProjectModel.PostId }));
        }
Пример #21
0
        public void LockAccess(ProjectSection currentObject)
        {
            var settings = NinjectCommon.Kernel.Get <Settings.Settings>();

            //ограничение прав
            List <IAccessRecord> accessRecord;

            accessRecord = currentObject.Access.Where(x => x.Access.IsInherited).ToList();

            for (int i = 0; i < accessRecord.Count; i++)
            {
                if (accessRecord[i].InheritanceSource != SystemObjectIds.RootObjectId)
                {
                    _modifer.EditById(accessRecord[i].InheritanceSource).RemoveAccessRights(accessRecord[i].OrgUnitId);
                    var access = GetAccessRecord(accessRecord[i], accessRecord[i].Access.AccessLevel);
                    ChangedAccess(accessRecord[i].InheritanceSource, access);
                }
            }


            accessRecord = currentObject.Access.Where(x => !x.Access.IsInherited &&
                                                      !_repository.GetCurrentPerson()
                                                      .Positions
                                                      .Select(p => p.Position)
                                                      .Contains(x.OrgUnitId)).ToList();

            //удаляем лишнее
            for (int i = 0; i < accessRecord.Count; i++)
            {
                _modifer.EditById(currentObject.Id).RemoveAccessRights(accessRecord[i].OrgUnitId);
            }

            //добавление прав
            var types = settings.Subdivisions.Distinct().ToList();

            for (int i = 0; i < types.Count; i++)
            {
                var access = GetAccessRecord(types[i], AccessLevel.View);
                ChangedAccess(currentObject.Id, access);
            }

            accessRecord = currentObject.Access.Where(x => _repository.GetCurrentPerson()
                                                      .Positions
                                                      .Select(p => p.Position)
                                                      .Contains(x.OrgUnitId)).ToList();
            //удаляем у текущего
            for (int i = 0; i < accessRecord.Count; i++)
            {
                _modifer.EditById(currentObject.Id).RemoveAccessRights(accessRecord[i].OrgUnitId);
            }
        }
Пример #22
0
        public IResult Add(ProjectSection projectSection)
        {
            IResult result = BusinessRules.Run(CheckIfSectionNameAlreadyExistInProject(projectSection));

            if (result != null)
            {
                return(result);
            }
            projectSection.RemainingSectionTime = projectSection.SectionProjectTime;
            projectSection.WorkerCount          = 0;
            projectSection.Status = true;
            _projectSectionDal.Add(projectSection);
            return(new SuccessResult(Messages.ProjectSectionAdded));
        }
Пример #23
0
        private static async Task _WriteProjectSection(TextWriter writer, ProjectSection section)
        {
            if (section == null)
            {
                return;
            }

            await writer.WriteLineAsync($"\tProjectSection({section.Name}) = {_Format(section.Type)}");

            foreach (var entry in section.Entries)
            {
                await writer.WriteLineAsync($"\t\t{entry.Key} = {entry.Value}");
            }

            await writer.WriteLineAsync("\tEndProjectSection");
        }
Пример #24
0
        public ActionResult CreateProject(PostProjectModel PostProjectModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("CreateProject", PostProjectModel));
            }

            try
            {
                var postAProject = new PostAProject();
                postAProject.ProjectName = PostProjectModel.ProjectName;
                postAProject.Description = PostProjectModel.Description;
                postAProject.Price       = PostProjectModel.Price;
                postAProject.StartTime   = PostProjectModel.StartTime;
                postAProject.EndTime     = PostProjectModel.EndTime;
                postAProject.Members     = PostProjectModel.Members;
                var result = postProjectDao.Save(postAProject);

                foreach (var x in PostProjectModel.SectionName)
                {
                    var projectsection = new ProjectSection();
                    projectsection.SectionName = x;
                    var result1 = projectSectionDao.Save(projectsection);
                }

                foreach (var skillid in PostProjectModel.SkillId)
                {
                    var projectskill = new ProjectSkills();
                    projectskill.SkillID = skillid;
                    var result2 = projectSkillDao.Save(projectskill);
                }



                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(View("CreateProject", PostProjectModel));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(RedirectToAction("CreateProject"));
        }
Пример #25
0
 public ActionResult WorkProgress(ProjectSection projectSection)
 {
     try
     {
         var result = projectSectionDao.Save(projectSection);
         if (result.HasError)
         {
             ViewBag.Message = result.Message;
             return(View("WorkProgress"));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(RedirectToAction("WorkProgress"));
 }
Пример #26
0
        public void Build(IMenuBuilder builder, ObjectsViewContext context)
        {
            var settings = NinjectCommon.Kernel.Get <Settings.Settings>();

            _currentObject = context?.SelectedObjects
                             .FirstOrDefault(x => settings.StartTypes.Any(t => x.Type.Name.Equals(t.Type)))?.MapToProjectSection();
            if (_currentObject != null)
            {
                var menu = builder.AddItem(commands[0], 4).WithHeader(commandsName[0]);
                for (int i = 1; i < 4; i++)
                {
                    menu.WithSubmenu().AddItem(commands[i], i - 1).WithHeader(commandsName[i]);
                }
                NinjectCommon.Kernel.Rebind <ProjectSection>().ToMethod(c => _currentObject).InSingletonScope();
                InitializeFolderRemark();
            }
        }
Пример #27
0
        private bool BelongsToProjectSection(ArtifactVersion artifactVersion, ProjectSection projectSection)
        {
            var itp = artifactVersion.ItemTypePredefined.GetValueOrDefault();

            switch (projectSection)
            {
            case ProjectSection.Artifacts:
                return(itp.IsRegularArtifactType());

            case ProjectSection.Collections:
                return(itp.IsCollectionsGroupType());

            case ProjectSection.BaselinesAndReviews:
                return(itp.IsBaselinesAndReviewsGroupType());

            default:
                return(false);
            }
        }
Пример #28
0
        private static string MakeProjectSection(ProjectSection section)
        {
            if (section == null)
            {
                return("");
            }

            var result = new StringBuilder();

            result.AppendLine(
                $"\tProjectSection({section.Name}) = {GetAsCamelCase(section.Type.ToString())}");

            foreach (var entry in section.Entries)
            {
                result.AppendLine($"\t\t{entry.Key} = {entry.Value}");
            }

            result.AppendLine("\tEndProjectSection");

            return(result.ToString());
        }
Пример #29
0
        /// <summary>
        /// This extracts the dependent assembly and project references from
        /// the project section.
        /// </summary>
        /// <param name="section">
        /// The project section from which the dependent information are extracted.
        /// </param>
        /// <param name="dependencyDirs">
        /// A set of the extracted dependent reference directories.
        /// </param>
        /// <param name="referencedAssemblies">
        /// A set of the reference assemblies.
        /// </param>
        private static void CreateDependencies(ProjectSection section,
                                               HashSet <string> dependencyDirs, HashSet <string> referencedAssemblies)
        {
            string outputPath = section.OutputPath;

            if (!String.IsNullOrEmpty(outputPath) && !outputPath.EndsWith("\\"))
            {
                outputPath += "\\";
            }
            dependencyDirs.Add(outputPath);

            IList <string> assemblies = section.ReferencedAssemblies;

            if (assemblies != null && assemblies.Count != 0)
            {
                for (int i = 0; i < assemblies.Count; i++)
                {
                    string assembly = assemblies[i];
                    if (!String.IsNullOrEmpty(assembly) &&
                        File.Exists(assembly))
                    {
                        referencedAssemblies.Add(assembly);
                    }
                }
            }

            ICollection <ProjectSection> children = section.Sections;

            if (children == null || children.Count == 0)
            {
                return;
            }

            foreach (ProjectSection child in children)
            {
                CreateDependencies(child, dependencyDirs, referencedAssemblies);
            }
        }
        private ProjectSection ParseProjectSection(string sectionline)
        {
            var matches = Regex.Match(sectionline, SolutionConstants.ProjectSectionRegEx);

            var projectSection = new ProjectSection
            {
                Name        = matches.Groups["sectionName"].Value,
                SectionType = matches.Groups["sectionValue"].Value
            };

            string str;

            while ((str = ReadLine()) != null)
            {
                if (str.Equals("EndProjectSection"))
                {
                    return(projectSection);
                }

                projectSection.Items.Add(ParseProjectSectionItem(str));
            }

            return(projectSection);
        }
        public IResult Add(ProjectCreationDto projectCreationDto)
        {
            var project = _mapper.Map <ProjectCreationDto, Project>(projectCreationDto);

            project.ActiveWorkerCount    = 0;
            project.RemainingProjectTime = project.TotalDeclaredTime;
            project.Status = true;

            _projectService.Add(project);


            foreach (var projectSection in projectCreationDto.ProjectSections)
            {
                var psection = new ProjectSection
                {
                    ProjectID          = project.ProjectID,
                    ProjectSectionName = projectSection.ProjectSectionName,
                    SectionProjectTime = projectSection.SectionProjectTime,
                };
                _projectSectionService.Add(psection);

                foreach (var projectSectionDepartment in projectSection.ProjectSectionDepartment)
                {
                    var psDepartment = new ProjectSectionDepartment
                    {
                        ProjectSectionID = psection.ProjectSectionID,
                        DepartmentTypeID = projectSectionDepartment.DepartmentTypeID,
                        Status           = true
                    };

                    _projectSectionDepartmentService.Add(psDepartment);
                }
            }

            return(new SuccessResult(Messages.ProjectAdded));
        }