示例#1
0
        public virtual List <Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(Company.IEmployee employee)
        {
            var result = new List <Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();
            // HACK: Получаем отображаемое имя модуля.
            // Dmitriev_IA: Данные из модуля ExchangeCode должны попасть в таблицу модуля Компания.
            var companyModuleMetadata = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(Company.PublicConstants.Module.ModuleGuid);
            var moduleName            = companyModuleMetadata.GetDisplayName();
            var modulePriority        = Company.PublicConstants.ResponsibilitiesReport.ExchangePriority;

            // Цифровые сертификаты.
            if (Certificates.AccessRights.CanRead())
            {
                var certificateResponsibility = Company.Reports.Resources.ResponsibilitiesReport.CertificateResponsibility;
                var certificates = Certificates.GetAll()
                                   .Where(x => Equals(x.Owner, employee))
                                   .Where(d => d.Enabled.HasValue && d.Enabled.Value)
                                   .Where(d => !d.NotAfter.HasValue || d.NotAfter.Value > Calendar.Now);
                result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, certificates, moduleName, modulePriority,
                                                                                           certificateResponsibility, null);
            }

            // Ответственный за абонентские ящики наших организаций.
            if (BoxBases.AccessRights.CanRead())
            {
                var boxResponsibility = Company.Reports.Resources.ResponsibilitiesReport.BoxResponsibility;
                var boxes             = BoxBases.GetAll()
                                        .Where(x => Equals(x.Responsible, employee))
                                        .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active);
                result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, boxes, moduleName, modulePriority,
                                                                                           boxResponsibility, null);
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// Получить дочерние ящики подразделения.
        /// </summary>
        /// <param name="status">Статус ящика подразделения.</param>
        /// <returns>Список дочерних ящиков подразделений.</returns>
        public List <IDepartmentBox> GetChildBoxes(Sungero.Core.Enumeration status)
        {
            var resultBoxes = new List <IDepartmentBox>();
            var boxes       = DepartmentBoxes.GetAll(b => b.Status == status).ToList();
            var childBoxes  = boxes.Where(b => Equals(b.ParentBox, _obj)).ToList();

            while (childBoxes.Any())
            {
                resultBoxes.AddRange(childBoxes);
                var newBoxes = boxes.Where(b => childBoxes.Any(x => Equals(BoxBases.As(x), b.ParentBox))).ToList();
                childBoxes = newBoxes;
            }

            return(resultBoxes);
        }