Ejemplo n.º 1
0
        /// <summary>
        /// Return the absolute path to the currently active Incoming folder for this partition
        /// or null if there's no incoming folder (e.g., Import Service is not running) or if it's undeterministic (e.g., misconfiguration)
        /// </summary>
        /// <returns></returns>
        public static string GetIncomingFolder(this ServerPartition partition)
        {
            var importServices = ServiceLock.FindServicesOfType(ServiceLockTypeEnum.ImportFiles);

            if (importServices == null || importServices.Count == 0)
            {
                return(null);
            }

            // Only expect to have one instance of the Import File service
            if (importServices.Count > 1)
            {
                Platform.Log(LogLevel.Warn, "Detect multiple instances of the Import Files Service!");
                return(null);
            }

            var activeService = importServices.SingleOrDefault(s => s.Enabled);

            if (activeService == null)
            {
                return(null);
            }

            var filesystem = FilesystemMonitor.Instance.GetFilesystemInfo(activeService.FilesystemKey);

            // Note: Import Service doesn't care if the filesystem is disabled or readonly so we don't need to care either
            var incomingPath = Path.Combine(filesystem.Filesystem.FilesystemPath, String.Format("{0}_{1}", partition.PartitionFolder, FilesystemMonitor.ImportDirectorySuffix));

            return(incomingPath);
        }
Ejemplo n.º 2
0
        public override void DataBind()
        {
            ServiceLock service = ServiceLock;

            if (service != null)
            {
                // only rebind the data if the dialog has been closed
                if (ModalDialog.State == ModalDialog.ShowState.Hide)
                {
                    Type.Text        = ServerEnumDescription.GetLocalizedDescription(service.ServiceLockTypeEnum);
                    Description.Text = ServerEnumDescription.GetLocalizedLongDescription(service.ServiceLockTypeEnum);
                    Enabled.Checked  = service.Enabled;

                    if (service.FilesystemKey != null)
                    {
                        FileSystemDataAdapter adaptor = new FileSystemDataAdapter();
                        Model.Filesystem      fs      = adaptor.Get(service.FilesystemKey);
                        FileSystem.Text = fs.Description;
                    }
                    else
                    {
                        FileSystem.Text = string.Empty;
                    }

                    CalendarExtender.SelectedDate = service.ScheduledTime;

                    AddCustomTime(service.ScheduledTime);
                }
            }

            base.DataBind();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the device list window in the panel.
        /// </summary>
        /// <remarks>
        /// This method should only be called when necessary as the information in the list window needs to be transmitted back to the client.
        /// If the list is not changed, call <seealso cref="LoadServiceLocks()"/> instead.
        /// </remarks>
        public void UpdateToolbarButtons()
        {
            ServiceLock service = ServiceLockGridViewControl.SelectedServiceLock;

            EditServiceScheduleButton.Enabled = service != null;

            ToolbarUpdatePanel.Update();
        }
Ejemplo n.º 4
0
 void AddEditServiceLockDialog_ServiceLockUpdated(ServiceLock serviceLock)
 {
     DataBind();
     if (ServiceLockUpdated != null)
     {
         ServiceLockUpdated(serviceLock);
     }
 }
Ejemplo n.º 5
0
        protected void EditServiceScheduleButton_Click(object sender, ImageClickEventArgs e)
        {
            LoadServiceLocks();
            ServiceLock service = ServiceLockGridViewControl.SelectedServiceLock;

            if (service != null)
            {
                EditServiceLock(service);
            }
        }
        /// <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);
        }
        protected void CustomizeFilesystemColumn(GridViewRow row)
        {
            Label text = row.FindControl("Filesystem") as Label;

            ServiceLock item = row.DataItem as ServiceLock;

            if (text != null && item != null)
            {
                text.Text = item.FilesystemKey == null ? "N/A" : _fsController.LoadFileSystem(item.FilesystemKey).Description;
            }
        }
        protected void CustomizeLockColumn(GridViewRow row)
        {
            Image img = row.FindControl("LockedImage") as Image;

            ServiceLock item = row.DataItem as ServiceLock;

            if (img != null && item != null)
            {
                img.ImageUrl = item.Lock ? ImageServerConstants.ImageURLs.Checked : ImageServerConstants.ImageURLs.Unchecked;
            }
        }
        protected void CustomizeDescriptionColumn(GridViewRow row)
        {
            Label descLabel = row.FindControl("Description") as Label;

            ServiceLock item = row.DataItem as ServiceLock;

            if (descLabel != null && item != null)
            {
                descLabel.Text = ServerEnumDescription.GetLocalizedLongDescription(item.ServiceLockTypeEnum);
            }
        }
        protected void CustomizeTypeColumn(GridViewRow row)
        {
            Label typeLabel = row.FindControl("Type") as Label;

            ServiceLock item = row.DataItem as ServiceLock;

            if (typeLabel != null && item != null)
            {
                typeLabel.Text = ServerEnumDescription.GetLocalizedDescription(item.ServiceLockTypeEnum);
            }
        }
Ejemplo n.º 11
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];
        }
        /// <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);
        }
Ejemplo n.º 13
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();
                }
            }
        }
Ejemplo n.º 14
0
        public void Insert(Guid Guid, short ServiceLockTypeEnum, string ProcessorId, bool LockX, DateTime ScheduledTime,
                           Guid? FilesystemGUID, bool Enabled, string State)
        {
            var item = new ServiceLock();

            item.Guid = Guid;

            item.ServiceLockTypeEnum = ServiceLockTypeEnum;

            item.ProcessorId = ProcessorId;

            item.LockX = LockX;

            item.ScheduledTime = ScheduledTime;

            item.FilesystemGUID = FilesystemGUID;

            item.Enabled = Enabled;

            item.State = State;


            item.Save(UserName);
        }
Ejemplo n.º 15
0
 private void ServiceLockPanel_ServiceLockUpdated(ServiceLock serviceLock)
 {
     DataBind();
 }