public virtual void GenerateDefaultSellerTitle(Sungero.Company.IEmployee signatory)
        {
            // Основание: Должностные обязанности.
            var powerBase = SignatureSettings.Info.Properties.Reason.GetLocalizedValue(Docflow.SignatureSetting.Reason.Duties);
            // Полномочия: Лицо, совершившее сделку и отв. за оформление.
            var power = Docflow.AccountingDocumentBases.Resources.PropertiesFillingDialog_HasAuthority_DealAndRegister;

            // Для УКД: Лицо, ответственное за оформление свершившегося события.
            if (_obj.FormalizedServiceType == Docflow.AccountingDocumentBase.FormalizedServiceType.GeneralTransfer && _obj.IsAdjustment == true)
            {
                power = Docflow.AccountingDocumentBases.Resources.PropertiesFillingDialog_HasAuthority_Register;
            }
            // Доверенность.
            IPowerOfAttorney signatoryPowerOfAttorney = null;
            // Другой документ.
            var signatoryOtherReason = string.Empty;

            var signaturesSettings                   = Functions.OfficialDocument.GetSignatureSettings(_obj, signatory);
            var signaturesSettingWithDuties          = signaturesSettings.Where(o => Equals(o.Reason, Docflow.SignatureSetting.Reason.Duties)).FirstOrDefault();
            var signaturesSettingWithPowerOfAttorney = signaturesSettings.Where(o => Equals(o.Reason, Docflow.SignatureSetting.Reason.PowerOfAttorney)).FirstOrDefault();
            var signaturesSettingWithOtherDocument   = signaturesSettings.Where(o => Equals(o.Reason, Docflow.SignatureSetting.Reason.Other)).FirstOrDefault();

            if (signaturesSettingWithDuties == null && _obj.FormalizedServiceType != FormalizedServiceType.Waybill)
            {
                if (signaturesSettingWithPowerOfAttorney != null)
                {
                    signatoryPowerOfAttorney = Docflow.PowerOfAttorneys.As(signaturesSettingWithPowerOfAttorney.Document);
                }
                else if (signaturesSettingWithOtherDocument != null)
                {
                    signatoryOtherReason = signaturesSettingWithOtherDocument.DocumentInfo;
                }
            }

            var errorlist = Functions.AccountingDocumentBase.TitleDialogValidationErrors(_obj, signatory, null,
                                                                                         signatoryPowerOfAttorney, null,
                                                                                         signatoryOtherReason, null);
            var validationText = string.Join(Environment.NewLine, errorlist.Select(l => l.Text));

            if (errorlist.Any())
            {
                throw AppliedCodeException.Create(validationText);
            }

            var sellerTitle = Docflow.Structures.AccountingDocumentBase.SellerTitle
                              .Create(signatory, powerBase, power, signatoryPowerOfAttorney, signatoryOtherReason);

            Functions.AccountingDocumentBase.GenerateSellerTitle(_obj, sellerTitle);
        }
Beispiel #2
0
        public virtual List <Sungero.Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(Sungero.Company.IEmployee employee)
        {
            var result = new List <Sungero.Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();

            // HACK: Получаем отображаемое имя модуля.
            var moduleGuid     = new PartiesModule().Id;
            var moduleName     = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(moduleGuid).GetDisplayName();
            var modulePriority = Sungero.Company.PublicConstants.ResponsibilitiesReport.CounterpartyPriority;

            if (!Companies.AccessRights.CanRead())
            {
                return(result);
            }

            var activeCompanies = Companies.GetAll(c => c.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);

            // Ответственный за контрагентов.
            var counterparties = activeCompanies.Where(c => Equals(c.Responsible, employee));

            result = Sungero.Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, counterparties, moduleName, modulePriority,
                                                                                               Resources.OrganizationResponsible, null);

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Показать диалог выбора исполнителя доработки с запросом выдачи прав на вложения.
        /// </summary>
        /// <param name="assignment">Задание.</param>
        /// <param name="attachments">Вложения.</param>
        /// <param name="additionalAssignees">Дополнительные согласующие.</param>
        /// <param name="reworkPerformer">Ответственный за доработку.</param>
        /// <param name="e">Аргументы.</param>
        /// <param name="dialogId">Ид диалога.</param>
        public virtual void ShowReworkConfirmationDialog(IAssignmentBase assignment, List <Domain.Shared.IEntity> attachments,
                                                         List <IRecipient> additionalAssignees, Sungero.Company.IEmployee reworkPerformer,
                                                         Sungero.Workflow.Client.ExecuteResultActionArgs e, string dialogId)
        {
            if (reworkPerformer != null)
            {
                additionalAssignees.Add(reworkPerformer);
            }

            // Диалог выдачи прав (отображается, если нет прав на вложения).
            if (Functions.Module.ShowDialogGrantAccessRightsWithConfirmationDialog(_obj, attachments, additionalAssignees, e.Action, dialogId) == false)
            {
                e.Cancel();
            }
        }
Beispiel #4
0
        public virtual List <Sungero.Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(Sungero.Company.IEmployee employee)
        {
            var result = new List <Sungero.Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();
            // HACK: Получаем отображаемое имя модуля.
            var moduleGuid     = new ProjectsModule().Id;
            var moduleName     = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(moduleGuid).GetDisplayName();
            var modulePriority = Sungero.Company.PublicConstants.ResponsibilitiesReport.ProjectsPriority;

            if (!Projects.AccessRights.CanRead())
            {
                return(result);
            }

            var activeProjects = Projects.GetAll().Where(p => p.Stage != Sungero.Projects.Project.Stage.Completed &&
                                                         p.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);

            // Руководитель проектов.
            var projects = activeProjects.Where(p => Equals(employee, p.Manager));

            result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, projects, moduleName, modulePriority,
                                                                                       Resources.ProjectManager, null);

            // Администратор проектов.
            projects = activeProjects.Where(p => Equals(employee, p.Administrator));
            result   = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, projects, moduleName, modulePriority,
                                                                                         Resources.ProjectAdmin, null);

            // Участник проектов.
            projects = activeProjects.Where(p => p.TeamMembers.Any(m => Equals(employee, m.Member)));
            result   = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, projects, moduleName, modulePriority,
                                                                                         Resources.ProjectMember, null);

            // Заказчик проектов.
            projects = activeProjects.Where(p => Equals(employee, p.InternalCustomer));
            result   = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, projects, moduleName, modulePriority,
                                                                                         Resources.ProjectCustomer, null);

            return(result);
        }