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()); }
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())); }
public void CreateObject(ProjectSection obj) { if (Create(obj) != null) { _modifer?.Apply(); } }
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); }
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; }
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); }
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); }
public User() { Education = new EducationSection(); Jobs = new JobSection(); Projects = new ProjectSection(); DateOfBirth = DateTime.Today; }
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); }
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)); }
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); }
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)); }
public IResult Update(ProjectSection projectSections) { IResult result = BusinessRules.Run(CheckIfSectionNameAlreadyExistInProject(projectSections)); if (result != null) { return(result); } _projectSectionDal.Update(projectSections); return(new SuccessResult(Messages.ProjectSectionUpdated)); }
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(); }
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(); } }
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); }
//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 })); }
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); } }
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)); }
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"); }
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")); }
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")); }
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(); } }
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); } }
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()); }
/// <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)); }