Beispiel #1
0
        public Response <CandidateDTO> Post([FromBody] VCI.DTO.Request.Candidate candidate)
        {
            Response <CandidateDTO> Result = new Response <CandidateDTO>();
            CandidateDTO            CandidateCreated;
            BlobStorageBLL          BlobStorage = new BlobStorageBLL();
            Uri profileFoto;
            ProfessionalTitleDTO ProfessionalTitle;

            try
            {
                CandidateCreated = new CandidateDTO(candidate);

                //Aqui se guarda la foto de perfil y los archivos de los titulos profesionales
                candidate.ProfileFoto.Name = string.Format("{0}_profilefoto", candidate.Identification);
                profileFoto = BlobStorage.SaveFile(candidate.Identification, candidate.ProfileFoto);
                if (profileFoto == null)
                {
                    Result.Error = Error.Random;
                    return(Result);
                }
                CandidateCreated.ProfileFoto = profileFoto;

                int cont = 0;
                if (candidate.ProfessinalTitles != null)
                {
                    foreach (var aux in candidate.ProfessinalTitles)
                    {
                        if (string.IsNullOrEmpty(aux.Base64) || string.IsNullOrEmpty(aux.Format))
                        {
                            Result.Error = Error.AllProfessionalTitlesRequiredFile;
                            return(Result);
                        }
                        ProfessionalTitle      = new ProfessionalTitleDTO();
                        ProfessionalTitle.Name = aux.Title;
                        aux.Name = string.Format("ProfessionalTitle_{0}", cont);
                        ProfessionalTitle.URL = BlobStorage.SaveFile(candidate.Identification, aux);
                        if (ProfessionalTitle.URL == null)
                        {
                            Result.Error = Error.InternalError;
                            return(Result);
                        }
                        CandidateCreated.ProfessionalTitles.Add(ProfessionalTitle);
                        cont++;
                    }
                }

                //Se guarda el candidato en la base de datos
                CandidateCreated = CandidateBLL.Instance.Create(CandidateCreated);

                Result.Result  = CandidateCreated;
                Result.Success = true;
            }catch
            {
                Result.Error = Error.InternalError;
            }
            return(Result);
        }
Beispiel #2
0
        static void Main()
        {
            try
            {
                List <Document> _docs = new List <Document>();
                TableStorageBL  _bl   = new TableStorageBL("DOCS");
                _docs = _bl.GetDocumentConfig();

                if (_docs.Count > 0)
                {
                    foreach (Document _doc in _docs)
                    {
                        bool isNewDownload = checkDocumentFeed(_doc.downloadURL, _doc.lastChecked);
                        if (isNewDownload)
                        {
                            BlobStorageBLL.processZIPfile(_doc).Wait();
                            TableStorageBL.InsertGTFSItem(_doc);
                        }
                    }
                }
            }
            catch (Exception ex) { Console.WriteLine(ex.Message + "-" + ex.InnerException); }
        }