Exemplo n.º 1
0
        /// <summary>
        /// FORSE QUESTO METODO NON SERVE
        /// SERVE ECCOMEEEE!!
        /// </summary>
        /// <returns>una lista vuota</returns>
        public List <ComputableWorkflowReference> GetToBeCompiledWorkflows()
        {
            List <ComputableWorkflowReference> ret = new List <ComputableWorkflowReference>();

            if (!_registered)
            {
                return(ret);
            }

            Storage.StorageManager db   = new Storage.StorageManager();
            Storage.User           user = db.getEntityByID <Storage.User>(_userId);
            List <Storage.StorageManager.Pair <string, int> > tempcontacts = new List <Storage.StorageManager.Pair <string, int> >();

            foreach (Storage.ExternalAccount extAcc in user.ExternalAccount)
            {
                Storage.StorageManager.Pair <string, int> pair = new Storage.StorageManager.Pair <string, int>();
                pair.First  = extAcc.username;
                pair.Second = extAcc.serviceID;
                tempcontacts.Add(pair);
            }
            List <Storage.Contact> mycontacts = db.getContactsByExtID(tempcontacts);

            foreach (Storage.Contact mycontact in mycontacts)
            {
                List <Storage.Publication> pubs = db.getListPublicationsByContactID(mycontact.contactID);
                foreach (Storage.Publication pub in pubs)
                {
                    Storage.CompilationRequest req = db.getCompilationRequestByPulicationAndContact(mycontact.contactID, pub.publicationID);
                    if (!req.compiled)
                    {
                        ret.Add(new ComputableWorkflowReference(_userId, pub.publicationID, pub.namePublication, pub.description,
                                                                pub.themeID, req.compilReqID, !pub.isPublic, true, pub.expirationDate));
                    }
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert a list of Security.Contact in a list of StorageManager.Contact
        /// </summary>
        /// <param name="contactsList"></param>
        /// <returns></returns>
        private List <Storage.Contact> ConvertToStorageContact(List <Security.Contact> contactsList)
        {
            if (!_registered)
            {
                return(null);
            }
            if (contactsList == null)
            {
                return(null);
            }

            Storage.StorageManager sto = new Storage.StorageManager();
            List <Storage.StorageManager.Pair <string, int> > mycontacts = new List <Storage.StorageManager.Pair <string, int> >();

            foreach (Contact secContact in contactsList)
            {
                Storage.StorageManager.Pair <string, int> pair;
                pair        = new Storage.StorageManager.Pair <string, int>();
                pair.First  = secContact.Email;
                pair.Second = secContact.Service.ServiceId;
                mycontacts.Add(pair);
            }
            return(sto.getContactsByExtID(mycontacts));
        }