コード例 #1
0
ファイル: PecModule.cs プロジェクト: maurbone/DocSuitePA
        //Registra il webservice nella tabella JeepServiceHosts
        private void SetJeepServiceHost()
        {
            var jsHost = new JeepServiceHost(Name);

            jsHost.IsActive  = Convert.ToInt16(true);
            jsHost.IsDefault = false;
            jsHost.Hostname  = Parameters.HostName;
            _jeepServiceHostFacade.Save(ref jsHost);
            FileLogger.Debug(Parameters.HostName, string.Format("Host di JeepService in registrazione [{0}].", Parameters.HostName));
        }
コード例 #2
0
ファイル: PecModule.cs プロジェクト: maurbone/DocSuitePA
        private List <PECMailBox> GetMailBoxes(Direction direction)
        {
            try
            {
                IList <PECMailBox> boxes = new List <PECMailBox>();
                if (string.IsNullOrEmpty(Parameters.HostName))
                {
                    boxes = GetAllMailBoxes();
                }

                else
                {
                    JeepServiceHost jeepServiceHost = _jeepServiceHostFacade.GetByHostName(Parameters.HostName);
                    if (jeepServiceHost == null)
                    {
                        boxes = GetAllMailBoxes();
                        FileLogger.Warn(Name, "Alert in [GetMailBoxes]. Nessun Host trovato per il nome indicato nei parametri.");
                    }
                    else
                    {
                        switch (direction)
                        {
                        case Direction.In:
                            boxes = _storeFacade.GetIngomingMailBoxesByHost(jeepServiceHost.Id, jeepServiceHost.IsDefault).Where(p => IsValidMailBox(p.Id)).ToList();
                            break;

                        case Direction.Out:
                            boxes = _storeFacade.GetOutgoingMailBoxesByHost(jeepServiceHost.Id, jeepServiceHost.IsDefault).Where(p => IsValidMailBox(p.Id)).ToList();
                            break;

                        default:
                            boxes = GetAllMailBoxes();
                            break;
                        }
                    }
                }

                Dictionary <PECMailBox, int> boxesToOrder = new Dictionary <PECMailBox, int>();
                string password;
                foreach (PECMailBox box in boxes)
                {
                    int countPecReceived = _PECMailBoxFacade.CountManyPECMailsReceived(box.Id, DateTime.Today.AddDays(-5));
                    boxesToOrder.Add(box, countPecReceived);
                    if (!_passwordBoxes.ContainsKey(box.Id))
                    {
                        password = box.Password;
                        if (DocSuiteContext.Current.ProtocolEnv.PECMailBoxPasswordEncriptionEnabled())
                        {
                            password = Encryption.DecryptString(box.Password, DocSuiteContext.Current.ProtocolEnv.PasswordEncryptionKey);
                        }
                        _passwordBoxes.Add(box.Id, password);
                    }
                }

                return(boxesToOrder.OrderByDescending(x => x.Value).Select(s => s.Key).ToList());
            }
            catch (Exception ex)
            {
                FileLogger.Error(Name, "Errore in [GetMailBoxes].", ex);
                SendMessage(string.Format("Errore in [GetMailBoxes]. \nErrore: {0} \nStacktrace: {1}", ex.Message, FullStacktrace(ex)));
                return(null);
            }
        }