Esempio n. 1
0
        /// <summary>
        /// Returns true if ComDayCqDamCoreImplReportsReportPurgeServiceProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqDamCoreImplReportsReportPurgeServiceProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqDamCoreImplReportsReportPurgeServiceProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     SchedulerExpression == other.SchedulerExpression ||
                     SchedulerExpression != null &&
                     SchedulerExpression.Equals(other.SchedulerExpression)
                     ) &&
                 (
                     MaxSavedReports == other.MaxSavedReports ||
                     MaxSavedReports != null &&
                     MaxSavedReports.Equals(other.MaxSavedReports)
                 ) &&
                 (
                     TimeDuration == other.TimeDuration ||
                     TimeDuration != null &&
                     TimeDuration.Equals(other.TimeDuration)
                 ) &&
                 (
                     EnableReportPurge == other.EnableReportPurge ||
                     EnableReportPurge != null &&
                     EnableReportPurge.Equals(other.EnableReportPurge)
                 ));
        }
        //Default Constructor
        public EditResourceModel()
        {
            ResourceStructures = new List <ResourceStructureModel>();

            ResourceStructureAttributeValues = new List <ResourceStructureAttributeValueModel>();
            TextValues = new List <Models.ResourceStructure.TextValueModel>();
            FileValues = new List <Models.ResourceStructure.FileValueModel>();

            using (ResourceStructureManager manager = new ResourceStructureManager()){
                Parent = new ResourceModel();
                foreach (RS.ResourceStructure rs in manager.GetAllResourceStructures().ToList())
                {
                    ResourceStructures.Add(new ResourceStructureModel(rs));
                }

                //BookingTimeGranularity
                Duration       = new TimeDuration();
                Duration.Value = 1;
                TimeUnits      = Enum.GetValues(typeof(SystemDefinedUnit)).Cast <SystemDefinedUnit>().ToList();


                ResourceConstraintModel = new ResourceConstraintModel();
                ResourceConstraints     = new List <ResourceConstraintModel>();
                DependencyConstraints   = new List <DependencyConstraintModel>();
                BlockingConstraints     = new List <BlockingConstraintModel>();
                QuantityConstraints     = new List <QuantityConstraintModel>();
            }
        }
Esempio n. 3
0
        //Set time
        //when combobox drop down closed
        private void ds(object sender, object e)
        {
            //select certain time duration
            if (combobox.SelectedItem != null)
            {
                int          s = 0; int m = 0;
                TimeDuration duration = combobox.SelectedItem as TimeDuration;
                if (duration.Unit == "自定义")
                {
                    //go to time picker page
                }
                else
                {
                    if (duration.Unit == "秒")
                    {
                        s = duration.Num;
                    }

                    if (duration.Unit == "分钟")
                    {
                        m = duration.Num;
                    }

                    countdown(s, m);
                }
            }
            // textblock2.Text = ".000";
        }
        /// <inheritdoc />
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            // if it's different from the prefab, go ahead and bold it
            if (property.isInstantiatedPrefab)
            {
                EditorUtils.SetBoldDefaultFont(property.prefabOverride);
            }

            // get the current value of the field
            SerializedProperty ticks1 = property.FindPropertyRelative("ticks1");
            SerializedProperty ticks2 = property.FindPropertyRelative("ticks2");

            // get the name of the property
            var niceName = ObjectNames.NicifyVariableName(property.name) + " (in ms)";

            // we always edit in ms
            var timeDuration = new TimeDuration(ticks1.intValue, ticks2.intValue);
            int milliseconds = (int)((TimeSpan)timeDuration).TotalMilliseconds;

            milliseconds = EditorGUI.IntField(position, niceName, milliseconds);

            // convert back into the structure
            int fakeTicks1, fakeTicks2;

            TimeDuration.Convert(TimeSpan.FromMilliseconds(milliseconds), out fakeTicks1, out fakeTicks2);

            // and save the values
            ticks1.intValue = fakeTicks1;
            ticks2.intValue = fakeTicks2;
        }
Esempio n. 5
0
        public Guid StartSearch(Item item, DateTime beginTime, DateTime endTime, int sensitivity, TimeSpan duration, String maskString, int maskHeight, int maskWidth)
        {
            Item   recorderItem    = item.GetParent();
            String recorderAddress = recorderItem.FQID.ServerId.Uri.ToString();

            String serverUri = String.Format("{0}RecorderCommandService/RecorderCommandService.asmx", recorderAddress);

            rcs.Url = serverUri;

            LoginSettings ls           = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite.ServerId.Id);
            TimeDuration  timeDuration = new TimeDuration()
            {
                MicroSeconds = Convert.ToInt64(duration.TotalMilliseconds * 1000)
            };
            Size size = new Size()
            {
                Height = maskHeight, Width = maskWidth
            };
            ImageMask imageMask = new ImageMask()
            {
                Mask = maskString, Size = size
            };

            return(rcs.SmartSearchStart(ls.Token, item.FQID.ObjectId, beginTime, endTime, sensitivity, timeDuration, imageMask, true, new Size()
            {
                Width = 320, Height = 200
            }));
        }
Esempio n. 6
0
        public async Task <IActionResult> PostDomain([FromBody] Domain domain, [FromBody] TimeDuration timeduration, [FromBody] int length)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (domain.Customer == null || domain.CustomerId == null)
            {
                return(BadRequest("Domain is not associated with a valid user"));
            }

            var customer = _customerRepository.GetCustomer(domain.CustomerId.Value).Result;

            if (customer == null)
            {
                return(BadRequest("customer is not valid for domain"));
            }

            if (string.IsNullOrEmpty(customer.ContactId) || string.IsNullOrEmpty(customer.ProviderName))
            {
                return(BadRequest("Customer is not verified yet"));
            }

            var today = DateTime.Today;

            domain.ExpiriationDate = timeduration == TimeDuration.YEAR ? today.AddYears(length) : today.AddMonths(length);

            await _domainRepository.AddDomain(domain);

            return(CreatedAtAction("GetDomain", new { id = domain.DomainId }, domain));
        }
Esempio n. 7
0
        public void GetTimeTest()
        {
            TimeDuration timeDuration = new TimeDuration();
            var          seconds      = timeDuration.GetTime();

            Console.WriteLine("Time:" + seconds);
        }
Esempio n. 8
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (SchedulerExpression != null)
         {
             hashCode = hashCode * 59 + SchedulerExpression.GetHashCode();
         }
         if (MaxSavedReports != null)
         {
             hashCode = hashCode * 59 + MaxSavedReports.GetHashCode();
         }
         if (TimeDuration != null)
         {
             hashCode = hashCode * 59 + TimeDuration.GetHashCode();
         }
         if (EnableReportPurge != null)
         {
             hashCode = hashCode * 59 + EnableReportPurge.GetHashCode();
         }
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            var hashCode = -281573630;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + TimeDuration.GetHashCode();
            hashCode = hashCode * -1521134295 + Rating.GetHashCode();
            return(hashCode);
        }
 internal static TreadmillExerciseStressTest Build(
     TreadmillProtocol protocol,
     TimeDuration time,
     TmstResult result,
     BloodPressure supineBloodPressure,
     int supineHeartRate,
     BloodPressure maximumBloodPressure,
     int maximumHeartRate)
 {
     return(new TreadmillExerciseStressTest(protocol, time, result, supineBloodPressure, supineHeartRate,
                                            maximumBloodPressure, maximumHeartRate));
 }
Esempio n. 11
0
        private static double ResultByProtocol(TreadmillProtocol protocol, TimeDuration time, Patient patient)
        {
            switch (protocol)
            {
            case TreadmillProtocol.Bruce:
                return(Bruce(time.FractionalMinutes, patient));

            case TreadmillProtocol.BruceLowLevel:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.BruceLowLevel));

            case TreadmillProtocol.Balke3Point0:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Balke3Point0));

            case TreadmillProtocol.Balke3Point4:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Balke3Point4));

            case TreadmillProtocol.Cornell:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Cornell));

            case TreadmillProtocol.Ellstad:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Ellstad));

            case TreadmillProtocol.Kattus:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Kattus));

            case TreadmillProtocol.ModifiedBruce:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.ModifiedBruce));

            case TreadmillProtocol.Naughton:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.Naughton));

            case TreadmillProtocol.UsAirforceSam20:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.UsAirforceSam20));

            case TreadmillProtocol.UsAirforceSam33:
                throw new NotImplementedException(NotImplementedMessage(
                                                      TreadmillProtocol.UsAirforceSam33));

            default:
                throw new ArgumentOutOfRangeException(nameof(FromTreadmillStressTest) + " in " +
                                                      nameof(CalculateVo2Max) +
                                                      $" does not accept that {protocol}.");
            }
        }
Esempio n. 12
0
 public TimeDuration UpdateTimeInterval(TimeDuration timeDuration)
 {
     Contract.Requires(timeDuration != null);
     using (IUnitOfWork uow = this.GetUnitOfWork())
     {
         IRepository <TimeDuration> repo = uow.GetRepository <TimeDuration>();
         repo.Merge(timeDuration);
         var merged = repo.Get(timeDuration.Id);
         repo.Put(merged);
         uow.Commit();
     }
     return(timeDuration);
 }
        public Vo2MaxCalculationTests()
        {
            _timeDuration        = TimeDuration.Build(11, 33);
            _protocol            = TreadmillProtocol.Bruce;
            _unsupportedProtocol = TreadmillProtocol.Balke3Point0;

            var dateOfBirth = DateTime.Now.AddYears(-45);

            _patient = PatientBuilder.Initialize()
                       .SetGender(GenderIdentity.Male)
                       .SetDateOfBirth(dateOfBirth.Year, dateOfBirth.Month, dateOfBirth.Day)
                       .BuildWithoutModelValidation();
        }
Esempio n. 14
0
        /// <summary>
        /// Sets an event definition for the timer with a time duration.
        /// </summary>
        /// <param name="timerDuration"> the time duration of the timer </param>
        /// <returns> the builder object </returns>
        public virtual B timerWithDuration(string timerDuration)
        {
            TimeDuration timeDuration = createInstance(typeof(TimeDuration));

            timeDuration.TextContent = timerDuration;

            TimerEventDefinition timerEventDefinition = createInstance(typeof(TimerEventDefinition));

            timerEventDefinition.TimeDuration = timeDuration;

            element.EventDefinitions.add(timerEventDefinition);

            return(myself);
        }
Esempio n. 15
0
        public bool DeleteTimeInstant(TimeDuration timeDuration)
        {
            Contract.Requires(timeDuration != null);
            Contract.Requires(timeDuration.Id >= 0);

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <TimeDuration> repo = uow.GetRepository <TimeDuration>();
                timeDuration = repo.Reload(timeDuration);
                repo.Delete(timeDuration);
                uow.Commit();
            }
            return(true);
        }
Esempio n. 16
0
        public TimeDuration CreateTimeInstant(SystemDefinedUnit unit, int value)
        {
            TimeDuration timeDuration = new TimeDuration()
            {
                TimeUnit = unit,
                Value    = value
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <TimeDuration> repo = uow.GetRepository <TimeDuration>();
                repo.Put(timeDuration);
                uow.Commit();
            }
            return(timeDuration);
        }
Esempio n. 17
0
 /// <summary>
 /// Called when the audio settings were changed.
 /// 音声設定が変更されたときに呼び出されます。
 /// </summary>
 /// <param name="deviceWasChanged">
 /// A flag that indicates the event was dispatched by device changing.
 /// このイベントの発火はデバイス変更によるものかを表すフラグです。
 /// </param>
 private static void OnAudioConfigurationChanged(bool deviceWasChanged)
 {
     if (deviceWasChanged)
     {
         Minimize();
     }
     else
     {
         var config      = AudioSettings.GetConfiguration();
         var newDuration = TimeDuration.OfSeconds((float)config.dspBufferSize / config.sampleRate);
         if (Duration <= TimeDuration.Zero || newDuration < Duration)
         {
             Duration = newDuration;
         }
     }
 }
Esempio n. 18
0
        //  public TimeDuration SandwichLeaves { get; set; }

        public EmployeeAttendanceSummaryModel()
        {
            TotalDays      = new TimeDuration();
            NonWorkingDays = new TimeDuration();
            PaidDays       = new TimeDuration();
            Present        = new TimeDuration();
            Absent         = new TimeDuration();
            Outdoor        = new TimeDuration();
            PLs            = new TimeDuration();
            CLs            = new TimeDuration();
            SLs            = new TimeDuration();
            CompOffs       = new TimeDuration();
            LateComings    = new TimeDuration();
            EarlyGoings    = new TimeDuration();
            SandwichLeaves = new TimeDuration();
        }
Esempio n. 19
0
        public String ConvertReserveText(ReserveData reserveInfo)
        {
            String view = new TimeDuration(true, reserveInfo.StartTime, true, reserveInfo.DurationSecond) + "\r\n";

            view += reserveInfo.StationName;
            view += " (" + ConvertNetworkNameText(reserveInfo.OriginalNetworkID) + ")" + "\r\n";

            view += reserveInfo.Title + "\r\n\r\n";
            view += ConvertRecSettingText(reserveInfo.RecSetting) + "\r\n" +
                    "予約状況 : " + reserveInfo.Comment +
                    "\r\n\r\n" +
                    "OriginalNetworkID : " + reserveInfo.OriginalNetworkID.ToString() + " (0x" + reserveInfo.OriginalNetworkID.ToString("X4") + ")\r\n" +
                    "TransportStreamID : " + reserveInfo.TransportStreamID.ToString() + " (0x" + reserveInfo.TransportStreamID.ToString("X4") + ")\r\n" +
                    "ServiceID : " + reserveInfo.ServiceID.ToString() + " (0x" + reserveInfo.ServiceID.ToString("X4") + ")\r\n" +
                    "EventID : " + reserveInfo.EventID.ToString() + " (0x" + reserveInfo.EventID.ToString("X4") + ")";
            return(view);
        }
 private TreadmillExerciseStressTest(
     TreadmillProtocol protocol,
     TimeDuration time,
     TmstResult result,
     BloodPressure supineBloodPressure,
     int supineHeartRate,
     BloodPressure maximumBloodPressure,
     int maximumHeartRate) : this()
 {
     Protocol             = protocol;
     Time                 = time;
     Result               = result;
     SupineBloodPressure  = supineBloodPressure;
     SupineHeartRate      = supineHeartRate;
     MaximumBloodPressure = maximumBloodPressure;
     MaximumHeartRate     = maximumHeartRate;
 }
Esempio n. 21
0
        public PeriodicTimeIntervalModel()
        {
            PeriodicTimeInstant = new PeriodicTimeInstant();
            Duration            = new TimeDuration();
            StartDate           = null;
            EndDate             = null;

            Days = new List <CheckModel>();
            Days = TimeHelper.GetDays();

            SelectedDays = new List <int>();

            ResetFrequencies = new List <ResetFrequency>();
            ResetFrequencies.Add(ResetFrequency.Daily);
            ResetFrequencies.Add(ResetFrequency.Weekly);
            ResetFrequencies.Add(ResetFrequency.Monthly);
        }
Esempio n. 22
0
        internal static string Serialize(TimeDuration timeDuration, ISO8601Options options)
        {
            if (options == null)
            {
                options = ISO8601Options.Default;
            }
            var numberOptions = new NumberFormatInfo { NumberDecimalSeparator = options.DecimalSeparator.ToString() };

            var output = new StringBuilder("PT");

            if (timeDuration.Minutes == null)
            {
                output.AppendFormat(timeDuration.Hours.ToString("F" + options.FractionLength, numberOptions));

                return output.ToString();
            }

            output.AppendFormat("{0:##}", timeDuration.Hours);

            if (options.UseComponentSeparators)
            {
                output.Append(':');
            }

            if (timeDuration.Seconds == null)
            {
                output.AppendFormat(timeDuration.Minutes.Value.ToString("F" + options.FractionLength, numberOptions));

                return output.ToString();
            }

            output.AppendFormat("{0:##}", timeDuration.Minutes);

            if (options.UseComponentSeparators)
            {
                output.Append(':');
            }

            output.AppendFormat(timeDuration.Seconds.Value.ToString("F" + options.FractionLength, numberOptions));

            return output.ToString();
        }
Esempio n. 23
0
        public async Task <IActionResult> PutDomain([FromRoute] string name, [FromBody] TimeDuration timeduration,
                                                    [FromBody] int length, [FromBody] Domain domain)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var originalDomain = _domainRepository.GetDomain(name).Result;

            if (originalDomain == null || originalDomain.DomainId != domain.DomainId)
            {
                return(BadRequest());
            }

            if (domain.Customer == null || domain.CustomerId == null)
            {
                return(BadRequest("Domain is not associated with a valid customer"));
            }

            var customer = await _customerRepository.GetCustomer(domain.CustomerId.GetValueOrDefault());

            if (customer == null)
            {
                return(BadRequest("Customer is not valid for domain"));
            }

            try
            {
                var originalExpiration = originalDomain.ExpiriationDate;
                domain.ExpiriationDate = timeduration == TimeDuration.YEAR ? originalExpiration.AddYears(length) : originalExpiration.AddMonths(length);
                await _domainRepository.UpdateDomain(domain);

                return(Ok(domain));
            }
            catch (DbUpdateConcurrencyException)
            {
                return(BadRequest());
            }
        }
Esempio n. 24
0
        public R.SingleResource CreateResource(string name, string description, int quantity, string color, bool withActivity, RS.ResourceStructure resourceStructure,
                                               TimeDuration duration)
        {
            //default status is created. In this status it is not visible.
            Status   status           = Status.created;
            DateTime statusChangeDate = DateTime.Now;

            R.SingleResource resource = new R.SingleResource(resourceStructure);

            //resource.BookingTimeGranularity = bookingTimeGranularity;


            resource.Name             = name;
            resource.Description      = description;
            resource.Quantity         = quantity;
            resource.ResourceStatus   = status;
            resource.Duration         = duration;
            resource.Color            = color;
            resource.WithActivity     = withActivity;
            resource.StatusChangeDate = statusChangeDate;
            resource.ResourceStatus   = status;

            //bookingTimeGranularity.Resource = resource;

            //bookingTimeGranularity.Resource = resource;

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <R.SingleResource> repo = uow.GetRepository <R.SingleResource>();
                //IRepository<R.BookingTimeGranularity> repoB = uow.GetRepository<R.BookingTimeGranularity>();
                //resource.BookingTimeGranularity = this.CreateBookingTimeGranularity(bookingTimeGranularity.Duration, bookingTimeGranularity.LargeUnitOfTime, bookingTimeGranularity.StartTime);
                //repoB.Put(bookingTimeGranularity);
                repo.Put(resource);
                uow.Commit();
            }

            return(resource);
        }
Esempio n. 25
0
    // Update is called once per frame
    void Update()
    {
        TimeDuration time = GetComponent <TimeDuration> ();

        if (Input.GetButtonDown("Fire2") && trigger == false && menuPause == false)
        {
            Time.timeScale = 0;
            pauseMenu.SetActive(true);
            menuPause = true;
        }
        else if (Input.GetButtonDown("Fire1") && trigger == false && menuPause == true)
        {
            PlayerPrefs.SetString("history", "Tingkat " + lev + "\n" + time.timetext);
            Time.timeScale = 1;
            SceneManager.LoadScene("menu");
        }

        else if (Input.GetButtonDown("Fire2") && trigger == false && menuPause == true)
        {
            Time.timeScale = 1;
            pauseMenu.SetActive(false);
            menuPause = false;
        }
    }
    void OnTriggerEnter(Collider other)
    {
        trigger = true;
        player  = GameObject.FindGameObjectWithTag("Player");


        terrain = GameObject.FindGameObjectWithTag("Terrain");
        AudioSource [] ter   = terrain.GetComponents <AudioSource> ();
        Walk           temp  = other.GetComponent <Walk> ();
        MapEnabler     mup   = player.GetComponent <MapEnabler> ();
        TimeDuration   time  = player.GetComponent <TimeDuration> ();
        PauseGame      pause = player.GetComponent <PauseGame> ();

        if (other.gameObject.tag == "Player")
        {
            PlayerPrefs.SetString("history", "Tingkat " + lev + "\n" + time.timetext);

            mup.trigger   = true;
            pause.trigger = true;
            //Destroy (map);
            for (int i = 0; i < ter.Length; i++)
            {
                ter [i].Stop();
            }


            temp.speed = 0;

            for (int i = 0; i < hide.Length; i++)
            {
                hide [i].SetActive(false);
            }
            show.SetActive(true);
            audi.Play();
        }
    }
Esempio n. 27
0
        static void Main(string[] args)
        {
            /************************************************************
            * Please change these accordingly to your own environment  *
            ************************************************************/
            String username = "";
            String password = "";
            String domain   = "";

            AuthenticationType authType    = AuthenticationType.WindowsDefault;
            String             hostAddress = "localhost";
            int port = 80;

            if (authType == AuthenticationType.Basic)
            {
                port = 443; //SSL
            }

            /************************************************************
            * Beginning of program                                     *
            ************************************************************/
            Console.WriteLine("Milestone SDK Bookmarks demo (XProtect Corporate only)");
            Console.WriteLine("Creates 2 new bookmarks and retrieves them using ");
            Console.WriteLine("  1) BookmarkSearchTime ");
            Console.WriteLine("  2) BookmarkSearchFromBookmark");
            Console.WriteLine("  3) BookmarkGet");
            Console.WriteLine("  4) BookmarkDelete");
            Console.WriteLine("");


            #region Connect to the Management Server, get configuration, and extract the cameras

            RecorderInfo[]             recorderInfo = new RecorderInfo[0];
            LoginInfo                  loginInfo    = null;
            ServerCommandServiceClient scs          = null;
            switch (authType)
            {
            case AuthenticationType.Basic:
                _basicConnection = new BasicConnection(username, password, hostAddress, port);
                loginInfo        = _basicConnection.Login(IntegrationId, Version, IntegrationName);
                _basicConnection.GetConfiguration(loginInfo.Token);

                ConfigurationInfo confInfoBasic =
                    _basicConnection.ConfigurationInfo;
                recorderInfo = confInfoBasic.Recorders;

                scs = _basicConnection.Server;

                break;

            case AuthenticationType.Windows:
            case AuthenticationType.WindowsDefault:
                _ntlmConnection = new NtlmConnection(domain, authType, username, password, hostAddress,
                                                     port);
                loginInfo = _ntlmConnection.Login(IntegrationId, Version, IntegrationName);
                _ntlmConnection.GetConfiguration(loginInfo.Token);

                ConfigurationInfo confInfoNtlm = _ntlmConnection.ConfigurationInfo;
                recorderInfo = confInfoNtlm.Recorders;

                scs = _ntlmConnection.Server;
                break;

            default:
                //Empty
                break;
            }

            #endregion

            #region Find recording servers attached to the management server

            //Get recording servers
            int recorders = recorderInfo.Length;
            Console.WriteLine("{0} Corporate Recording Server found", recorders);
            if (recorders == 0)
            {
                Console.WriteLine("");
                Console.WriteLine("Press any key");
                Console.ReadKey();
                return;
            }

            #endregion


            DateTime timeNow = DateTime.Now;

            // get cameras for the first recorder
            RecorderInfo recorder = recorderInfo[0];
            Console.WriteLine("");
            Console.WriteLine("Processing recording server {0}", recorder.Name);
            Console.WriteLine("");

            #region Find all cameras defined on the recording server

            // extract info about the recording server
            List <CameraInfo> cameras = recorder.Cameras.ToList();

            #endregion



            // now-5:10min:                                       BookmarkSearchTime start
            // now-5:00min: (beginTime)                                         |                                                  BookmarkGet
            // now-4:59min: start recording 1                                   |
            // now-4:55min: start bookmark 1                                    |
            // now-4:45min: end bookmark 1                                      |
            //                                                                  |                BookmarkSearchFromBookmark
            // now-2:00min:                                                     |                            |
            // now-1:59min: start recording 2                                   |                            |
            // now-1:55min: start bookmark 2 (trigger time)                     |                            |
            // now-1:45min: end bookmark 2                                      |                            |
            // now                                                              v                            V

            #region create first bookmark

            Guid cameraGuid = cameras.First().DeviceId;

            Console.WriteLine("Creating the first bookmark");
            MediaDeviceType[] mediaDeviceTypes = new MediaDeviceType[3];
            mediaDeviceTypes[0] = MediaDeviceType.Camera;
            mediaDeviceTypes[1] = MediaDeviceType.Microphone;
            mediaDeviceTypes[2] = MediaDeviceType.Speaker;



            DateTime     timeBegin = timeNow.AddMinutes(-5);
            TimeDuration td        = new TimeDuration()
            {
                MicroSeconds = (int)TimeSpan.FromMinutes(30).TotalMilliseconds * 1000
            };

            StringBuilder bookmarkRef    = new StringBuilder();
            StringBuilder bookmarkHeader = new StringBuilder();
            StringBuilder bookmarkDesc   = new StringBuilder();
            bookmarkRef.AppendFormat("MyBookmark-{0}", timeBegin.ToLongTimeString());
            bookmarkHeader.AppendFormat("AutoBookmark-{0}", timeBegin.ToLongTimeString());
            bookmarkDesc.AppendFormat("AutoBookmark-{0} set for a duration of {1} seconds",
                                      timeBegin.ToLongTimeString(), (timeBegin.AddSeconds(10) - timeBegin.AddSeconds(1)).Seconds);

            Bookmark newBookmark = null;
            try
            {
                newBookmark = scs.BookmarkCreate(loginInfo.Token, cameraGuid,
                                                 timeBegin.AddSeconds(1),
                                                 timeBegin.AddSeconds(5),
                                                 timeBegin.AddSeconds(10),
                                                 bookmarkRef.ToString(),
                                                 bookmarkHeader.ToString(),
                                                 bookmarkDesc.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine("BookmarkCreate: " + ex.Message);
                Console.WriteLine("Press any Key to exit...");
                Console.ReadKey();
                Environment.Exit(0);
            }

            if (newBookmark == null)
            {
                Console.WriteLine("New bookmark wasn't created.");
                Console.WriteLine("Press any key to exit.");
                Console.ReadKey();
                Environment.Exit(0);
            }

            Console.WriteLine("-> trigger time = {0}", newBookmark.TimeTrigged);
            Console.WriteLine("");


            #endregion

            Console.WriteLine("");
            Console.WriteLine("Waiting 20 sec ....");
            Console.WriteLine("");
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(20));

            #region Create a second bookmark

            Console.WriteLine("Creating a second bookmark - 2 minutes after the first bookmark");
            DateTime timeBegin2 = timeBegin.AddMinutes(2);
            bookmarkHeader.Length = 0;
            bookmarkDesc.Length   = 0;
            StringBuilder bookmarkRef2 = new StringBuilder();
            bookmarkRef2.AppendFormat("MyBookmark-{0}", timeBegin2.ToLongTimeString());
            bookmarkHeader.AppendFormat("AutoBookmark-{0}", timeBegin2.ToLongTimeString());
            bookmarkDesc.AppendFormat("AutoBookmark-{0} set for a duration of {1} seconds",
                                      timeBegin2.ToLongTimeString(), (timeBegin2.AddSeconds(10) - timeBegin2.AddSeconds(1)).Seconds);
            Bookmark newBookmark2 = scs.BookmarkCreate(loginInfo.Token, cameraGuid, timeBegin2.AddSeconds(1),
                                                       timeBegin2.AddSeconds(5), timeBegin2.AddSeconds(10)
                                                       , bookmarkRef2.ToString(), bookmarkHeader.ToString(), bookmarkDesc.ToString());

            Console.WriteLine("-> trigger time = {0}", newBookmark2.TimeTrigged);
            Console.WriteLine("");

            #endregion

            #region BookmarkSearchTime

            // Get max 10 of the bookmarks created after the specified time
            Console.WriteLine("");
            Console.WriteLine("Looking for bookmarks using BookmarkSearchTime (finding the 2 newly created)");
            Bookmark[] bookmarkList = scs.BookmarkSearchTime(loginInfo.Token, newBookmark.TimeBegin.AddSeconds(-10), td,
                                                             10, mediaDeviceTypes, new Guid[0], new string[0], "");
            if (bookmarkList.Length > 0)
            {
                Console.WriteLine("-> Found {0} bookmark(s)", bookmarkList.Length);
                int counter = 1;
                foreach (Bookmark bookmark in bookmarkList)
                {
                    Console.WriteLine("{0}:", counter);
                    Console.WriteLine("     Id  ={0} ", bookmark.Id);
                    Console.WriteLine("     Name={0} ", bookmark.Header);
                    Console.WriteLine("     Desc={0} ", bookmark.Description);
                    Console.WriteLine("     user={0} ", bookmark.User);
                    Console.WriteLine("     Device={0} Start={1} Stop={2}  ", bookmark.DeviceId, bookmark.TimeBegin,
                                      bookmark.TimeEnd);
                    counter++;
                }
            }
            else
            {
                Console.WriteLine("sorry no bookmarks found");
            }

            Console.WriteLine("");

            #endregion

            #region BookmarkSearchFromBookmark

            // Get the next (max 10) bookmarks after the first
            Console.WriteLine(
                "Looking for bookmarks using BookmarkSearchFromBookmark (finding the last of the 2 newly created)");
            Bookmark[] bookmarkListsFromBookmark = scs.BookmarkSearchFromBookmark(loginInfo.Token, newBookmark.Id, td,
                                                                                  10, mediaDeviceTypes, new Guid[0], new string[0], "");
            if (bookmarkListsFromBookmark.Length > 0)
            {
                Console.WriteLine("-> Found {0} bookmark(s)", bookmarkListsFromBookmark.Length);
                int counter = 1;
                foreach (Bookmark bookmark in bookmarkListsFromBookmark)
                {
                    Console.WriteLine("{0}:", counter);
                    Console.WriteLine("     Id  ={0} ", bookmark.Id);
                    Console.WriteLine("     Name={0} ", bookmark.Header);
                    Console.WriteLine("     Desc={0} ", bookmark.Description);
                    Console.WriteLine("     user={0} ", bookmark.User);
                    Console.WriteLine("     Device={0} Start={1} Stop={2}  ", bookmark.DeviceId, bookmark.TimeBegin,
                                      bookmark.TimeEnd);
                    counter++;
                }
            }
            else
            {
                Console.WriteLine("sorry no bookmarks found");
            }

            Console.WriteLine("");

            #endregion

            #region BookmarkGet

            // Get first created bookmark
            Console.WriteLine(
                "Looking for the first bookmarks using BookmarkGet  (finding the first of the 2 newly created)");
            Bookmark newBookmarkFetched = scs.BookmarkGet(loginInfo.Token, newBookmark.Id);
            if (newBookmarkFetched != null)
            {
                Console.WriteLine("-> A bookmarks is found");
                Console.WriteLine("     Id  ={0} ", newBookmarkFetched.Id);
                Console.WriteLine("     Name={0} ", newBookmarkFetched.Header);
                Console.WriteLine("     Desc={0} ", newBookmarkFetched.Description);
                Console.WriteLine("     user={0} ", newBookmarkFetched.User);
                Console.WriteLine("     Device={0} Start={1} Stop={2}  ", newBookmarkFetched.DeviceId,
                                  newBookmarkFetched.TimeBegin, newBookmarkFetched.TimeEnd);
            }
            else
            {
                Console.WriteLine("Sorry no bookmarks found");
            }

            Console.WriteLine("");

            #endregion

            #region Deleting bookmarks

            Console.WriteLine("Deleting 2 newly created bookmarks");
            scs.BookmarkDelete(loginInfo.Token, newBookmark.Id);
            Console.WriteLine("   -> first deleted");
            scs.BookmarkDelete(loginInfo.Token, newBookmark2.Id);
            Console.WriteLine("   -> second deleted");

            #endregion



            Console.WriteLine("");
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
Esempio n. 28
0
        public PeriodicTimeInterval CreatePeriodicTimeInterval(PeriodicTimeInstant periodicTimeInstant, TimeDuration duration)
        {
            PeriodicTimeInterval periodicTimeInterval = new PeriodicTimeInterval()
            {
                PeriodicTimeInstant = periodicTimeInstant,
                Duration            = duration
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <PeriodicTimeInterval> repo = uow.GetRepository <PeriodicTimeInterval>();
                repo.Put(periodicTimeInterval);
                uow.Commit();
            }
            return(periodicTimeInterval);
        }
 public TreadmillExerciseStressTestBuilder SetTime(double minutes, double seconds)
 {
     _time = TimeDuration.Build(minutes, seconds);
     return(this);
 }
Esempio n. 30
0
        public void GenerateSeedData()
        {
            #region ENTITIES

            List <EntityStruct> entities = new List <EntityStruct>();
            entities.Add(new EntityStruct("SingleResource", typeof(SingleResource), typeof(BExIS.Rbm.Services.Resource.SingleResourceStore)));
            entities.Add(new EntityStruct("ResourceStructure", typeof(ResourceStructure), typeof(BExIS.Rbm.Services.ResourceStructure.ResourceStructureStore)));
            entities.Add(new EntityStruct("ResourceStructureAttribute", typeof(ResourceStructureAttribute), typeof(BExIS.Rbm.Services.ResourceStructure.ResourceStructureAttributeStore)));
            entities.Add(new EntityStruct("Activity", typeof(Activity), typeof(BExIS.Rbm.Services.Booking.ActivityStore)));
            entities.Add(new EntityStruct("BookingEvent", typeof(BookingEvent), typeof(BExIS.Rbm.Services.Booking.BookingEventStore)));
            entities.Add(new EntityStruct("Notification", typeof(Notification), typeof(BExIS.Rbm.Services.Booking.NotificationStore)));
            entities.Add(new EntityStruct("Schedule", typeof(Schedule), typeof(BExIS.Rbm.Services.Booking.ScheduleStore)));



            Dictionary <string, Type> rbmEntities = new Dictionary <string, Type>();
            rbmEntities.Add("SingleResource", typeof(SingleResource));
            rbmEntities.Add("ResourceStructure", typeof(ResourceStructure));
            rbmEntities.Add("ResourceStructureAttribute", typeof(ResourceStructureAttribute));
            rbmEntities.Add("Activity", typeof(Activity));
            rbmEntities.Add("BookingEvent", typeof(BookingEvent));
            rbmEntities.Add("Notification", typeof(Notification));
            rbmEntities.Add("Schedule", typeof(Schedule));

            using (var entityManager = new EntityManager())
            {
                foreach (var et in entities)
                {
                    Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == et.Name.ToUpperInvariant()).FirstOrDefault();

                    if (entity == null)
                    {
                        entity                 = new Entity();
                        entity.Name            = et.Name;
                        entity.EntityType      = et.Type;
                        entity.EntityStoreType = et.StoreType;
                        //entity.UseMetadata = true;
                        entity.Securable = true;
                        entityManager.Create(entity);
                    }
                }
            }

            try
            {
                ResourceStructureAttribute rsa = new ResourceStructureAttribute();
                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsa = rsaManager.CreateResourceStructureAttribute("Exploratory", "Biodiversity Exploratories funded by DFG Priority Programme 1374. They serve as open research platform for all biodiversity and ecosystem research groups of Germany.");

                var dcManager = new DataContainerManager();

                string[]          keys        = { "Hainich-Dün", "Schorfheide-Chorin", "Schwäbische Alb" };
                List <DomainItem> domainItems = CreateDomainItems(keys);
                DomainConstraint  dc          = new DomainConstraint(ConstraintProviderSource.Internal, "", "en-US", "a simple domain validation constraint", false, null, null, null, domainItems);
                dcManager.AddConstraint(dc, rsa);


                ResourceStructureAttribute rsa2 = new ResourceStructureAttribute();
                using (var rsaManager2 = new ResourceStructureAttributeManager())
                    rsa2 = rsaManager2.CreateResourceStructureAttribute("Type", "Type of resource.");

                var dcManager2 = new DataContainerManager();

                string[]          keys2        = { "Area", "Equipment", "Sleeping place" };
                List <DomainItem> domainItems2 = CreateDomainItems(keys2);
                DomainConstraint  dc2          = new DomainConstraint(ConstraintProviderSource.Internal, "", "en-US", "a simple domain validation constraint", false, null, null, null, domainItems2);
                dcManager2.AddConstraint(dc2, rsa2);

                ResourceStructureAttribute rsa3 = new ResourceStructureAttribute();
                using (var rsaManager3 = new ResourceStructureAttributeManager())
                    rsa3 = rsaManager3.CreateResourceStructureAttribute("Information File", "Important information as file");

                ResourceStructureManager rsManager = new ResourceStructureManager();;
                ResourceStructure        rs        = rsManager.Create("Explo resources", "Resources related to exploratories.", null, null);

                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa, rs, true, false);
                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa2, rs, true, false);

                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa3, rs, true, true);

                ActivityManager aManager = new ActivityManager();
                aManager.CreateActivity("Adding of material (litter, dead wood, chemicals ....)", "", false);
                aManager.CreateActivity("Adding of organisms (seeds and others)", "", false);
                aManager.CreateActivity("Conference", "", false);
                aManager.CreateActivity("Contact stakeholder", "", false);
                aManager.CreateActivity("Dismantling of experiments", "", false);
                aManager.CreateActivity("Installation of equipment remaining for some time", "", false);
                aManager.CreateActivity("Measuring and marking of subplots/experiments/study organisms", "", false);
                aManager.CreateActivity("Observation/capture of organisms without removal", "", false);
                aManager.CreateActivity("Plot maintenance", "", false);
                aManager.CreateActivity("Removal of org. material without killing", "", false);
                aManager.CreateActivity("Removal of organisms", "", false);
                aManager.CreateActivity("Removal of soil samples", "", false);
                aManager.CreateActivity("Visit without activity", "", false);

                ResourceManager             rManager = new ResourceManager();;
                List <newResourceStructure> rs_new   = new List <newResourceStructure>();

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (SCH)", color = "#ec5959", description = "Visit of all forest EPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all MIPs (SCH)", color = "#ec5959", description = "Visit of all forest MIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all VIPs (SCH)", color = "#ec5959", description = "Visit of all forest VIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Altenhof", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Arnimswalde", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Chorin", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Eichheide", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Glambeck", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Liepe", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Maienpfuhl", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Melzow", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Poratz", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Ringenwalde", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Senftenthal", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Theerofen", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Voigtswiese", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Forstgut Altkuenkendorf", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Fuerstliche Forstverwaltung Oettingen-Spielberg", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Stiftung Schorfheide-Chorin", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (SCH)", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (SCH)", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - ABP Landwirtschaft Neugrimnitz GmbH", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AEVG Stegelitz-Flieth", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Agrargemeinschaft Greiffenberg GmbH", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs (SCH)", color = "#ff0000", description = "Visit of all grassland EPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all MIPs (SCH)", color = "#ff0000", description = "Visit of all grassland MIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (SCH)", color = "#ff0000", description = "Visit of all grassland VIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Gut Biesenbrow", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Ingolf Limber", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Lehrschaeferei Friedrichsfelde", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - LW-Betrieb Haferkamp", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Naturrind GmbH Boeckenberg", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Reiner Wegner", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Weidewirtschaft Liepe", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit (SCH)", color = "#e28f8f", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (SCH)", color = "#9c3939", description = "Sleeping places in Schorfheide-Chorin", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (SCH)", color = "#940b0b", description = "Drying cabinet in Schorfheide-Chorin", duration = 1, quantity = 5, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Fridge (SCH)", color = "#940b0b", description = "Fridge in Schorfheide-Chorin", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Freezer (SCH)", color = "#940b0b", description = "Freezer in Schorfheide-Chorin", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (SCH)", color = "#940b0b", description = "Metal detector (Magna Trak 100) in Schorfheide-Chorin", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Binocular (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Chest freezer (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Helmet (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (HAI)", color = "#8cca0d", description = "Visit of all forest EPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all GPs (HAI)", color = "#8cca0d", description = "Visit of all forestGPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all MIPs (HAI)", color = "#8cca0d", description = "Visit of all forest MIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all VIPs (HAI)", color = "#8cca0d", description = "Visit of all forest VIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (HAI)", color = "8cca0d", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Anrode", color = "#8cca0d", description = "Forest - district Anrode", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - city of Mühlhausen", color = "#8cca0d", description = "Forest - city of Mühlhausen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Behringen", color = "#8cca0d", description = "Forest - district Behringen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Geney", color = "#8cca0d", description = "Forest - district Geney", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Keula", color = "#8cca0d", description = "Forest - district Keula", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Langula", color = "#8cca0d", description = "Forest - district Langula", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Sollstedt", color = "#8cca0d", description = "Forest - district Sollstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Zehnsberg", color = "#8cca0d", description = "Forest - district Zehnsberg", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - national park", color = "#8cca0d", description = "Forest - national park", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - national park Weberstedterholz (core zone)", color = "#8cca0d", description = "Forest - national park Weberstedterholz (core zone)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Westerwald", color = "#8cca0d", description = "Forest - district Westerwald", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all GPs (HAI)", color = "#9acd32", description = "Visit of all grassland GPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs (HAI)", color = "#9acd32", description = "Visit of all grassland EPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all MIPs (HAI)", color = "#9acd32", description = "Visit of all grassland MIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (HAI)", color = "#9acd32", description = "Visit of all grassland VIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (HAI)", color = "9acd32", description = "Visit of all new landuse experiment plots in HAI (HEG1,2,3,6,14,15)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Diedorf", color = "#9acd32", description = "Grassland - AG Diedorf", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Großenlupnitz", color = "#9acd32", description = "Grassland - AG Großenlupnitz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Kirchheiligen", color = "#9acd32", description = "Grassland - AG Kirchheiligen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Bollstedt", color = "#9acd32", description = "Grassland - AG Bollstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Lengefeld", color = "#9acd32", description = "Grassland - AG Lengefeld", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Mülverstedt", color = "#9acd32", description = "Grassland - AG Mülverstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Wartburgblick", color = "#9acd32", description = "Grassland - AG Wartburgblick", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Wenigenlupnitz", color = "#9acd32", description = "Grassland - AG Wenigenlupnitz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG-Struth-Eigenrieden", color = "#9acd32", description = "Grassland - AG-Struth-Eigenrieden", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - BEAG/TOA", color = "#9acd32", description = "Grassland - BEAG/TOA", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Bundesforst Dörnaerplatz", color = "#9acd32", description = "Grassland - Bundesforst Dörnaerplatz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Gut Sambach", color = "#9acd32", description = "Grassland - Gut Sambach", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Thüringen Wagyu Becker&Becker", color = "#9acd32", description = "Grassland - Thüringen Wagyu Becker&Becker", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Heller", color = "#9acd32", description = "Grassland - Heller", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Schaeferei Effenberger", color = "#9acd32", description = "Grassland - Schaeferei Effenberger", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Nationalpark", color = "#9acd32", description = "Grassland - Nationalpark", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Nordagrar (Naturrind Unstruttal)", color = "#9acd32", description = "Grassland - Nordagrar (Naturrind Unstruttal)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Schaeferei Goepfert", color = "#9acd32", description = "Grassland - Schaeferei Goepfert", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Börner", color = "#9acd32", description = "Grassland - Börner", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Strewe-Winterberg", color = "#9acd32", description = "Grassland - Strewe-Winterberg", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - TUPAG (Hainich Weiderind)", color = "#9acd32", description = "Grassland - TUPAG (Hainich Weiderind)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit", color = "#a9fb00", description = "No plot visit in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (HAI)", color = "#78ab0f", description = "Sleeping place in Hainich-Dün", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (HAI)", color = "#6a8a27", description = "Drying cabinete in Hainich-Dün", duration = 1, quantity = 4, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Fridge (HAI)", color = "#6a8a27", description = "Fridge in Hainich-Dün", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Freezer (HAI)", color = "#6a8a27", description = "Freezer in Hainich-Dün", duration = 1, quantity = 3, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (HAI)", color = "#6a8a27", description = "Metal detector (Magna Trak 100) in Hainich-Dün", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Garrett ACE  150) (HAI)", color = "#6a8a27", description = "Metal detector (Garrett ACE  150) in Hainich-Dün", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (ALB)", color = "#3a75e0", description = "Visit of all forest EPs in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - VIP AEW1-8 (ALB)", color = "#3a75e0", description = "Visit of all VIP AEW1-8 in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - VIP AEW9 (Alb)", color = "#3a75e0", description = "Visit of all VIP AEW9 in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (ALB)", color = "#3a75e0", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs excluding former military training area", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs including former military training area", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (ALB)", color = "#6495ed", description = "Visit of all grassland VIPs in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (ALB)", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit (ALB)", color = "#0057f5", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "total Exploratory outside EP", color = "#0057f6", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (ALB)", color = "#27509a", description = "Sleeping places in Schwäbische Alb", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (ALB)", color = "#7e95bf", description = "Drying cabinet in Schwäbische Alb", duration = 1, quantity = 5, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Binocular (ALB)", color = "#7e95bf", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (ALB)", color = "#7e95bf", description = "Metal detector (Magna Trak 100) in Schwäbische Alb", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });

                //get/create admin group for entity rights
                using (var groupManager = new GroupManager())
                    using (var permissionManager = new EntityPermissionManager())
                        using (var entityManager = new EntityManager())
                            using (var valueManager = new ResourceStructureAttributeManager())
                            {
                                var adminGroup = groupManager.Groups.Where(r => r.Name == "administrator").FirstOrDefault();
                                if (adminGroup == null)
                                {
                                    // create new group
                                    adminGroup = new Group
                                    {
                                        Name          = "administrator",
                                        Description   = "administrator",
                                        DisplayName   = "administrator",
                                        IsSystemGroup = false,
                                        IsValid       = true
                                    };

                                    groupManager.CreateAsync(adminGroup).Wait();
                                }

                                //create right type
                                int rights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant;

                                foreach (newResourceStructure rs_item in rs_new)
                                {
                                    var duration = new TimeDuration();
                                    duration.Value = rs_item.duration;
                                    var resource = rManager.CreateResource(rs_item.name, rs_item.description, rs_item.quantity, rs_item.color, rs_item.withActivity, rs_item.resourceStructure, duration);

                                    //add entity rights
                                    permissionManager.Create(adminGroup,
                                                             entityManager.FindByName("SingleResource"),
                                                             resource.Id,
                                                             rights
                                                             );

                                    ResourceAttributeUsage usage = valueManager.GetResourceAttributeUsageById(1);
                                    valueManager.CreateResourceAttributeValue(rs_item.explo, rManager.GetResourceById(resource.Id), usage);
                                    ResourceAttributeUsage usage2 = valueManager.GetResourceAttributeUsageById(2);
                                    valueManager.CreateResourceAttributeValue(rs_item.type, rManager.GetResourceById(resource.Id), usage2);
                                }
                            }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            #endregion

            #region SECURITY

            OperationManager operationManager = new OperationManager();
            FeatureManager   featureManager   = new FeatureManager();

            try
            {
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature ResourceBooking = features.FirstOrDefault(f => f.Name.Equals("Resource Booking"));
                if (ResourceBooking == null)
                {
                    ResourceBooking = featureManager.Create("Resource Booking", "Resource Booking");
                }

                Feature NotificationBlackboard = features.FirstOrDefault(f => f.Name.Equals("Notification Blackboard"));
                if (NotificationBlackboard == null)
                {
                    NotificationBlackboard = featureManager.Create("Notification Blackboard", "Notification Blackboard", ResourceBooking);
                }


                Feature ResourceAdmin = features.FirstOrDefault(f => f.Name.Equals("Resource Administration"));
                if (ResourceAdmin == null)
                {
                    ResourceAdmin = featureManager.Create("Resource Administration", "Resource Administration");
                }

                Feature ResourceManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Management"));
                if (ResourceManagement == null)
                {
                    ResourceManagement = featureManager.Create("Resource Management", "Resource Management", ResourceAdmin);
                }

                Feature ResourceStructureManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Structure Management"));
                if (ResourceStructureManagement == null)
                {
                    ResourceStructureManagement = featureManager.Create("Resource Structure Management", "Resource Structure Management", ResourceAdmin);
                }

                Feature ResourceStructureAttributeManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Structure Attribute Management"));
                if (ResourceStructureAttributeManagement == null)
                {
                    ResourceStructureAttributeManagement = featureManager.Create("Resource Structure Attribute Management", "Resource Structure Attribute Management", ResourceAdmin);
                }

                Feature NotificationManagement = features.FirstOrDefault(f => f.Name.Equals("Notification Management"));
                if (NotificationManagement == null)
                {
                    NotificationManagement = featureManager.Create("Notification Management", "Notification Management", ResourceAdmin);
                }

                Feature ActivityManagement = features.FirstOrDefault(f => f.Name.Equals("Activity Management"));
                if (ActivityManagement == null)
                {
                    ActivityManagement = featureManager.Create("Activity Management", "Activity Management", ResourceAdmin);
                }


                operationManager.Create("RBM", "Schedule", "*", ResourceBooking);
                operationManager.Create("RBM", "Calendar", "*", ResourceBooking);
                operationManager.Create("RBM", " NotificationBlackboard", "*", NotificationBlackboard);



                operationManager.Create("RBM", "Resource", "*", ResourceManagement);
                operationManager.Create("RBM", "ResourceStructure", "*", ResourceStructureManagement);
                operationManager.Create("RBM", "ResourceStructure", "*", ResourceStructureAttributeManagement);
                operationManager.Create("RBM", "Notification", "*", NotificationManagement);
                operationManager.Create("RBM", "Activity", "*", ActivityManagement);

                #region Help Workflow

                if (!operationManager.Exists("RBM", "help", "*"))
                {
                    operationManager.Create("RBM", "Help", "*");
                }

                #endregion Help Workflow
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                operationManager.Dispose();
                featureManager.Dispose();
            }

            #endregion
        }
Esempio n. 31
0
        public String ConvertProgramText(EpgEventInfo eventInfo, EventInfoTextMode textMode)
        {
            string retText   = "";
            string basicInfo = "";
            string extInfo   = "";

            if (eventInfo != null)
            {
                UInt64 key = Create64Key(eventInfo.original_network_id, eventInfo.transport_stream_id, eventInfo.service_id);
                if (ChSet5.Instance.ChList.ContainsKey(key) == true)
                {
                    basicInfo += ChSet5.Instance.ChList[key].ServiceName + "(" + ChSet5.Instance.ChList[key].NetworkName + ")" + "\r\n";
                }

                basicInfo += new TimeDuration(eventInfo.StartTimeFlag != 0, eventInfo.start_time,
                                              eventInfo.DurationFlag != 0, eventInfo.durationSec) + "\r\n";

                if (eventInfo.ShortInfo != null)
                {
                    basicInfo += eventInfo.ShortInfo.event_name + "\r\n\r\n";
                    extInfo   += eventInfo.ShortInfo.text_char + "\r\n\r\n";
                }

                if (eventInfo.ExtInfo != null)
                {
                    extInfo += eventInfo.ExtInfo.text_char + "\r\n\r\n";
                }

                //ジャンル
                extInfo += "ジャンル :\r\n";
                if (eventInfo.ContentInfo != null)
                {
                    foreach (EpgContentData info in eventInfo.ContentInfo.nibbleList)
                    {
                        String content = "";
                        int    nibble1 = info.content_nibble_level_1;
                        int    nibble2 = info.content_nibble_level_2;
                        if (nibble1 == 0x0E && nibble2 <= 0x01)
                        {
                            nibble1 = info.user_nibble_1 | (0x60 + nibble2 * 16);
                            nibble2 = info.user_nibble_2;
                        }
                        if (ContentKindDictionary.ContainsKey((ushort)(nibble1 << 8 | 0xFF)))
                        {
                            content += ContentKindDictionary[(ushort)(nibble1 << 8 | 0xFF)];
                        }
                        else
                        {
                            content += "(0x" + nibble1.ToString("X2") + ")";
                        }
                        if (ContentKindDictionary.ContainsKey((ushort)(nibble1 << 8 | nibble2)))
                        {
                            content += " - " + ContentKindDictionary[(ushort)(nibble1 << 8 | nibble2)];
                        }
                        else if (nibble1 != 0x0F)
                        {
                            content += " - (0x" + nibble2.ToString("X2") + ")";
                        }
                        extInfo += content + "\r\n";
                    }
                }
                extInfo += "\r\n";

                //映像
                extInfo += "映像 :";
                if (eventInfo.ComponentInfo != null)
                {
                    int    streamContent = eventInfo.ComponentInfo.stream_content;
                    int    componentType = eventInfo.ComponentInfo.component_type;
                    UInt16 componentKey  = (UInt16)(streamContent << 8 | componentType);
                    if (ComponentKindDictionary.ContainsKey(componentKey) == true)
                    {
                        extInfo += ComponentKindDictionary[componentKey];
                    }
                    if (eventInfo.ComponentInfo.text_char.Length > 0)
                    {
                        extInfo += "\r\n";
                        extInfo += eventInfo.ComponentInfo.text_char;
                    }
                }
                extInfo += "\r\n";

                //音声
                extInfo += "音声 :\r\n";
                if (eventInfo.AudioInfo != null)
                {
                    foreach (EpgAudioComponentInfoData info in eventInfo.AudioInfo.componentList)
                    {
                        int    streamContent = info.stream_content;
                        int    componentType = info.component_type;
                        UInt16 componentKey  = (UInt16)(streamContent << 8 | componentType);
                        if (ComponentKindDictionary.ContainsKey(componentKey) == true)
                        {
                            extInfo += ComponentKindDictionary[componentKey];
                        }
                        if (info.text_char.Length > 0)
                        {
                            extInfo += "\r\n";
                            extInfo += info.text_char;
                        }
                        extInfo += "\r\n";
                        extInfo += "サンプリングレート :";
                        switch (info.sampling_rate)
                        {
                        case 1:
                            extInfo += "16kHz";
                            break;

                        case 2:
                            extInfo += "22.05kHz";
                            break;

                        case 3:
                            extInfo += "24kHz";
                            break;

                        case 5:
                            extInfo += "32kHz";
                            break;

                        case 6:
                            extInfo += "44.1kHz";
                            break;

                        case 7:
                            extInfo += "48kHz";
                            break;

                        default:
                            break;
                        }
                        extInfo += "\r\n";
                    }
                }
                extInfo += "\r\n";

                //スクランブル
                if (!ChSet5.IsDttv(eventInfo.original_network_id))
                {
                    if (eventInfo.FreeCAFlag == 0)
                    {
                        extInfo += "無料放送\r\n";
                    }
                    else
                    {
                        extInfo += "有料放送\r\n";
                    }
                    extInfo += "\r\n";
                }

                //イベントリレー
                if (eventInfo.EventRelayInfo != null)
                {
                    if (eventInfo.EventRelayInfo.eventDataList.Count > 0)
                    {
                        extInfo += "イベントリレーあり:\r\n";
                        foreach (EpgEventData info in eventInfo.EventRelayInfo.eventDataList)
                        {
                            key = Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                            if (ChSet5.Instance.ChList.ContainsKey(key) == true)
                            {
                                extInfo += ChSet5.Instance.ChList[key].ServiceName + "(" + ChSet5.Instance.ChList[key].NetworkName + ")" + " ";
                            }
                            else
                            {
                                extInfo += "OriginalNetworkID : " + info.original_network_id.ToString() + " (0x" + info.original_network_id.ToString("X4") + ") ";
                                extInfo += "TransportStreamID : " + info.transport_stream_id.ToString() + " (0x" + info.transport_stream_id.ToString("X4") + ") ";
                                extInfo += "ServiceID : " + info.service_id.ToString() + " (0x" + info.service_id.ToString("X4") + ") ";
                            }
                            extInfo += "EventID : " + info.event_id.ToString() + " (0x" + info.event_id.ToString("X4") + ")\r\n";
                            extInfo += "\r\n";
                        }
                        extInfo += "\r\n";
                    }
                }

                extInfo += "OriginalNetworkID : " + eventInfo.original_network_id.ToString() + " (0x" + eventInfo.original_network_id.ToString("X4") + ")\r\n";
                extInfo += "TransportStreamID : " + eventInfo.transport_stream_id.ToString() + " (0x" + eventInfo.transport_stream_id.ToString("X4") + ")\r\n";
                extInfo += "ServiceID : " + eventInfo.service_id.ToString() + " (0x" + eventInfo.service_id.ToString("X4") + ")\r\n";
                extInfo += "EventID : " + eventInfo.event_id.ToString() + " (0x" + eventInfo.event_id.ToString("X4") + ")\r\n";
            }

            if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.BasicOnly)
            {
                retText = basicInfo;
            }
            if (textMode == EventInfoTextMode.All || textMode == EventInfoTextMode.ExtOnly)
            {
                retText += extInfo;
            }
            return(retText);
        }