Exemplo n.º 1
0
        static public ServiceLock Load(IPersistenceContext read, ServerEntityKey key)
        {
            var         broker    = read.GetBroker <IServiceLockEntityBroker>();
            ServiceLock theObject = broker.Load(key);

            return(theObject);
        }
Exemplo n.º 2
0
 static public ServiceLock Insert(ServiceLock entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         ServiceLock newEntity = Insert(update, entity);
         update.Commit();
         return(newEntity);
     }
 }
        /// <summary>
        /// Delete a service from the database.
        /// </summary>
        /// <param name="service"></param>
        /// <returns><b>true</b> if the record is deleted successfully. <b>false</b> otherwise.</returns>
        public bool DeleteServiceLock(ServiceLock service)
        {
            Platform.Log(LogLevel.Info, "User deleting service lock {0}", service.Key);

            bool ok = _adapter.DeleteServiceLock(service);

            Platform.Log(LogLevel.Info, "User delete service lock {0}: {1}", service.Key, ok ? "Successful" : "Failed");

            return ok;
        }
        /// <summary>
        /// Add a service in the database.
        /// </summary>
        /// <param name="service"></param>
        public ServiceLock AddServiceLock(ServiceLock service)
        {
            Platform.Log(LogLevel.Info, "User adding new service lock { type={0}, filesystem={1} }", service.ServiceLockTypeEnum, service.FilesystemKey);

            ServiceLock dev = _adapter.AddServiceLock(service);

            if (dev!=null)
                Platform.Log(LogLevel.Info, "New service added by user : {Key={0}, type={1}, filesystem={2}", service.Key, service.ServiceLockTypeEnum, service.FilesystemKey);
            else
                Platform.Log(LogLevel.Info, "Failed to add new service : {  type={1}, filesystem={2} }", service.ServiceLockTypeEnum, service.FilesystemKey);

            return dev;
        }
Exemplo n.º 5
0
        static public ServiceLock Insert(IUpdateContext update, ServiceLock entity)
        {
            var broker        = update.GetBroker <IServiceLockEntityBroker>();
            var updateColumns = new ServiceLockUpdateColumns();

            updateColumns.ServiceLockTypeEnum = entity.ServiceLockTypeEnum;
            updateColumns.Lock          = entity.Lock;
            updateColumns.ScheduledTime = entity.ScheduledTime;
            updateColumns.Enabled       = entity.Enabled;
            updateColumns.State         = entity.State;
            updateColumns.FilesystemKey = entity.FilesystemKey;
            updateColumns.ProcessorId   = entity.ProcessorId;
            ServiceLock newEntity = broker.Insert(updateColumns);

            return(newEntity);
        }
Exemplo n.º 6
0
 void ServiceLockPanel_ServiceLockUpdated(ServiceLock serviceLock)
 {
     DataBind();
 }
Exemplo n.º 7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (ViewState[ "_ServiceLock"] != null)
            {
                ServerEntityKey serviceLockKey = ViewState[ "_ServiceLock"] as ServerEntityKey;
                _serviceLock = ServiceLock.Load(serviceLockKey);
            }

            ScheduleDate.Text = Request[ScheduleDate.UniqueID] ;
        }
Exemplo n.º 8
0
 static public ServiceLock Insert(IUpdateContext update, ServiceLock entity)
 {
     var broker = update.GetBroker<IServiceLockEntityBroker>();
     var updateColumns = new ServiceLockUpdateColumns();
     updateColumns.ServiceLockTypeEnum = entity.ServiceLockTypeEnum;
     updateColumns.Lock = entity.Lock;
     updateColumns.ScheduledTime = entity.ScheduledTime;
     updateColumns.Enabled = entity.Enabled;
     updateColumns.State = entity.State;
     updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
     updateColumns.FilesystemKey = entity.FilesystemKey;
     updateColumns.ProcessorId = entity.ProcessorId;
     ServiceLock newEntity = broker.Insert(updateColumns);
     return newEntity;
 }
Exemplo n.º 9
0
 static public ServiceLock Insert(ServiceLock entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         ServiceLock newEntity = Insert(update, entity);
         update.Commit();
         return newEntity;
     }
 }
Exemplo n.º 10
0
        private void EditServiceLock(ServiceLock service)
        {
            EditServiceLockDialog.ServiceLock = service;

            if (service != null)
            {
                if (service.Lock)
                {
                    ConfirmEditDialog.Message = SR.ServiceLockUpdate_Confirm_ServiceIsLocked;
                    ConfirmEditDialog.MessageType =
                        MessageBox.MessageTypeEnum.YESNO;
                    ConfirmEditDialog.Show();
                }
                else
                {
                    ShowEditServiceLockDialog();
                }

            }


        }
Exemplo n.º 11
0
 void AddEditServiceLockDialog_ServiceLockUpdated(ServiceLock serviceLock)
 {
     DataBind();
     if (ServiceLockUpdated != null)
         ServiceLockUpdated(serviceLock);
 }