private void UserCalculateEvent()
        {
            string FQN             = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.FQN, true);
            string Start           = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.StartDateTime, true);
            int    DurationHours   = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationHours);
            int    DurationMinutes = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationMinutes);
            int    DurationSeconds = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationSeconds);

            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable results = base.ServiceBroker.ServicePackage.ResultTable;

            WorkflowManagementServer mngServer = this.ServiceBroker.K2Connection.GetConnection <WorkflowManagementServer>();

            using (mngServer.Connection)
            {
                TimeSpan Duration = new TimeSpan(DurationHours, DurationMinutes, DurationSeconds);

                DateTime dt;
                if (!DateTime.TryParse(Start, out dt))
                {
                    throw new ApplicationException(Resources.DateNotValid);
                }

                AvailabilityZone zone = mngServer.ZoneLoad(mngServer.UserGetZone(FQN));
                if (zone.AvailabilityHoursList == null || zone.AvailabilityHoursList.Count == 0)
                {
                    throw new ApplicationException(Resources.WorkingHoursNotSet);
                }

                DataRow dRow = results.NewRow();
                dRow[Constants.SOProperties.WorkingHoursConfiguration.FinishDateTime] = mngServer.UserCalculateEvent(FQN, dt, Duration);
                results.Rows.Add(dRow);
            }
        }
        private void UserGetZone()
        {
            string FQN = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.FQN, true);

            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable results = base.ServiceBroker.ServicePackage.ResultTable;

            WorkflowManagementServer mngServer = this.ServiceBroker.K2Connection.GetConnection <WorkflowManagementServer>();

            using (mngServer.Connection)
            {
                DataRow dRow = results.NewRow();
                dRow[Constants.SOProperties.WorkingHoursConfiguration.ZoneName] = mngServer.UserGetZone(FQN);
                results.Rows.Add(dRow);
            }
        }
        private void UserGetZone()
        {
            string FQN = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.FQN, true);
            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable results = base.ServiceBroker.ServicePackage.ResultTable;

            WorkflowManagementServer mngServer = new WorkflowManagementServer();
            using (mngServer.CreateConnection())
            {
                mngServer.Open(BaseAPIConnectionString);
                DataRow dRow = results.NewRow();
                dRow[Constants.SOProperties.WorkingHoursConfiguration.ZoneName] = mngServer.UserGetZone(FQN);
                results.Rows.Add(dRow);
            }
        }
        private void UserCalculateEvent()
        {
            string FQN = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.FQN, true);
            string Start = base.GetStringProperty(Constants.SOProperties.WorkingHoursConfiguration.StartDateTime, true);
            int DurationHours = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationHours);
            int DurationMinutes = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationMinutes);
            int DurationSeconds = base.GetIntProperty(Constants.SOProperties.WorkingHoursConfiguration.DurationSeconds);

            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable results = base.ServiceBroker.ServicePackage.ResultTable;

            WorkflowManagementServer mngServer = new WorkflowManagementServer();
            using (mngServer.CreateConnection())
            {
                mngServer.Open(BaseAPIConnectionString);

                TimeSpan Duration = new TimeSpan(DurationHours, DurationMinutes, DurationSeconds);

                DateTime dt;
                if (!DateTime.TryParse(Start, out dt))
                {
                    throw new ApplicationException(Constants.ErrorMessages.DateNotValid);
                }

                AvailabilityZone zone = mngServer.ZoneLoad(mngServer.UserGetZone(FQN));
                if (zone.AvailabilityHoursList == null || zone.AvailabilityHoursList.Count == 0)
                {
                    throw new ApplicationException(Constants.ErrorMessages.WorkingHoursNotSet);
                }

                DataRow dRow = results.NewRow();
                dRow[Constants.SOProperties.WorkingHoursConfiguration.FinishDateTime] = mngServer.UserCalculateEvent(FQN, dt, Duration);
                results.Rows.Add(dRow);
            }
        }