public override void FillName() { var documentKind = _obj.DocumentKind; if (documentKind != null && !documentKind.GenerateDocumentName.Value && _obj.Name == Docflow.Resources.DocumentNameAutotext) { _obj.Name = string.Empty; } if (documentKind == null || !documentKind.GenerateDocumentName.Value) { return; } /* * Имя в формате: <Имя проекта>. <Вид документа> №<номер> от <дата> <содержание>. * * Содержание специально без кавычек. */ using (TenantInfo.Culture.SwitchTo()) { var name = string.Empty; var project = Projects.As(_obj.Project); if (project != null) { name += project.ShortName + ". "; } if (!string.IsNullOrWhiteSpace(_obj.RegistrationNumber)) { name += Sungero.Docflow.OfficialDocuments.Resources.Number + _obj.RegistrationNumber; } if (_obj.RegistrationDate != null) { name += Sungero.Docflow.OfficialDocuments.Resources.DateFrom + _obj.RegistrationDate.Value.ToString("d"); } if (!string.IsNullOrWhiteSpace(_obj.Subject)) { name += " " + _obj.Subject; } if (string.IsNullOrWhiteSpace(name)) { name = Docflow.Resources.DocumentNameAutotext; } else if (documentKind != null) { name = documentKind.DisplayValue + " " + name; } name = Docflow.PublicFunctions.Module.TrimSpecialSymbols(name); _obj.Name = Docflow.PublicFunctions.OfficialDocument.AddClosingQuote(name, _obj); } }
private IEmployee GetProjectAdministrator(IApprovalTask task) { var document = task.DocumentGroup.OfficialDocuments.FirstOrDefault(); var project = Projects.As(document.Project); if (project != null) { return(project.Administrator ?? project.Manager); } return(null); }
/// <summary> /// Заполнить список прав на проект. /// </summary> /// <param name="document">Документ.</param> /// <param name="projectBase">Проект.</param> /// <param name="grantRightsToProject">True, если выдавать права участникам проектов. Иначе - false.</param> /// <param name="result">Список прав в виде реципиент-тип прав.</param> public virtual void AddRecipientRightsForProject(IOfficialDocument document, IProjectBase projectBase, bool grantRightsToProject, List <RecipientRights> result) { if (projectBase == null) { return; } if (!Projects.Is(projectBase)) { return; } var project = Projects.As(projectBase); var readType = Constants.Module.AccessRightsReadTypeName; var editType = Constants.Module.AccessRightsEditTypeName; if (Docflow.PublicFunctions.OfficialDocument.IsProjectDocument(document)) { result.Add(Structures.Module.RecipientRights.Create(project.Manager, editType)); } if (grantRightsToProject == true) { if (project.Administrator != null) { result.Add(Structures.Module.RecipientRights.Create(project.Administrator, editType)); } if (project.InternalCustomer != null) { result.Add(Structures.Module.RecipientRights.Create(project.InternalCustomer, readType)); } foreach (var teamMember in project.TeamMembers) { result.Add(teamMember.Group == Sungero.Projects.ProjectTeamMembers.Group.Management ? Structures.Module.RecipientRights.Create(teamMember.Member, editType) : Structures.Module.RecipientRights.Create(teamMember.Member, readType)); } } if (project.LeadingProject != null) { this.AddRecipientRightsForProject(document, project.LeadingProject, grantRightsToProject, result); } }