Example #1
0
        public virtual List <Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine> GetResponsibilitiesReportData(IEmployee employee)
        {
            // HACK: Получаем отображаемое имя модуля.
            var moduleGuid     = new MeetingsModule().Id;
            var moduleName     = Sungero.Metadata.Services.MetadataSearcher.FindModuleMetadata(moduleGuid).GetDisplayName();
            var modulePriority = Company.PublicConstants.ResponsibilitiesReport.MeetingsPriority;
            var result         = new List <Company.Structures.ResponsibilitiesReport.ResponsibilitiesReportTableLine>();

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

            var emplIsPresident = Meetings.GetAll(x => Equals(x.President, employee))
                                  .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
                                  .Where(d => d.DateTime >= Calendar.Now);

            result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, emplIsPresident, moduleName, modulePriority,
                                                                                       Resources.MeetingsPresident, null);

            var emplIsSecretary = Meetings.GetAll(x => Equals(x.Secretary, employee))
                                  .Where(d => d.Status == Sungero.CoreEntities.DatabookEntry.Status.Active)
                                  .Where(d => d.DateTime >= Calendar.Now);

            result = Company.PublicFunctions.Module.AppendResponsibilitiesReportResult(result, emplIsSecretary, moduleName, modulePriority,
                                                                                       Resources.MeetingsSecretary, null);

            return(result);
        }
Example #2
0
 public static IMeeting GetContextMeeting()
 {
     if (CallContext.CalledFrom(Meetings.Info))
     {
         var meetingId = CallContext.GetCallerEntityId(Meetings.Info);
         return(Meetings.GetAll(m => Equals(m.Id, meetingId)).SingleOrDefault());
     }
     return(null);
 }
Example #3
0
        public static string GetMeetingNameIgnoreAccessRights(int id)
        {
            var name = string.Empty;

            AccessRights.AllowRead(
                () =>
            {
                var meeting = Meetings.GetAll(m => Equals(m.Id, id)).FirstOrDefault();
                if (!string.IsNullOrWhiteSpace(meeting.Name))
                {
                    name += string.Format(" {0} \"{1}\"", Agendas.Resources.For, meeting.Name);
                }
            });
            return(name);
        }
Example #4
0
        public static string GetMeetingNameWithDateIgnoreAccessRights(int id)
        {
            var name = string.Empty;

            AccessRights.AllowRead(
                () =>
            {
                var meeting = Meetings.GetAll(m => Equals(m.Id, id)).FirstOrDefault();
                if (meeting.DateTime != null)
                {
                    name += Docflow.OfficialDocuments.Resources.DateFrom + meeting.DateTime.Value.ToString("d");
                }
                name += GetMeetingNameIgnoreAccessRights(id);
            });
            return(name);
        }