public ActionResult Create(CandidateDocumentViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newDocument = new CandidateDocument
                {
                    CandidateId  = vm.CandidateId,
                    DocumentType = vm.DocumentType,
                    FileSize     = 0.0
                };

                if (vm.Document != null)
                {
                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadRecruitDocument(vm.Document);
                    newDocument.DocumentPath = blobPath;
                    newDocument.FileName     = vm.Document.FileName;
                }

                _candidateDocumentRepository.Create(newDocument);
                _unitOfWork.Commit();

                return(RedirectToAction("Details", "Candidates", new { id = vm.CandidateId }));
            }

            return(View(vm));
        }
        public async Task <ActionResult <BaseResponse> > PostCandidateDocument(CandidateDocument candidateDocument)
        {
            _context.CandidateDocuments.Add(candidateDocument);
            await _context.SaveChangesAsync();

            return(new BaseResponse
            {
                ErrorCode = 1,
                Messege = "Add new success!!",
                Data = CreatedAtAction("GetCandidateDocument", new { id = candidateDocument.Id }, candidateDocument)
            });
        }
        public async Task <IActionResult> PutCandidateDocument(int id, CandidateDocument candidateDocument_update)
        {
            var Cand = await _context.CandidateDocuments.FindAsync(id);

            if (Cand == null)
            {
                return(NotFound());
            }

            Cand.DOC_ID = candidateDocument_update.DOC_ID;
            Cand.C_ID   = candidateDocument_update.C_ID;
            Cand.Note   = candidateDocument_update.Note;

            _context.CandidateDocuments.Update(Cand);
            await _context.SaveChangesAsync();

            return(Ok(Cand));
        }
Beispiel #4
0
        //
        //
        //
        //
        // the preceding class is devoted to the following method only:
        public System.Data.DataTable SearchByAbstract(
            string criteria
            )
        {// refers to usp_Documento_SEARCH_byAbstract_SERVICE
            System.Data.DataTable result = null;
            //
            if (null == criteria)
            {
                return(null);
            }// else can continue.
            //result =
            //    Entity_materie.Proxies.usp_doc_multi_SEARCH_CandidateDocuments_SERVICE.usp_doc_multi_SEARCH_CandidateDocuments(
            //        null // id_set not specified -> the semantic research on abstracts involves all docs.
            //);
            if (null == result)
            {
                return(result);// exit on no-connection.
            }// else continue.
            int cardDocs = result.Rows.Count;

            CandidateDocument[] measures = new CandidateDocument[cardDocs];
            for (int c = 0; c < cardDocs; c++)
            {
                measures[c]           = new CandidateDocument();
                measures[c].id        = (int)(result.Rows[c]["id"]);
                measures[c].autore    = (string)(result.Rows[c]["autore"]);
                measures[c]._abstract = (string)(result.Rows[c]["abstract"]);
                // go evaluate the credibility measure:
                measures[c].credibilityMeasure = evaluateCredibilityMeasure(
                    criteria,
                    measures[c]._abstract
                    );
            }
            //
            // this table will be returned to BPL.
            System.Data.DataTable PlausibleDocuments = new System.Data.DataTable("PlausibleDocuments");
            PlausibleDocuments.Columns.Add("id", typeof(int));
            PlausibleDocuments.Columns.Add("autore", typeof(string));
            PlausibleDocuments.Columns.Add("abstract", typeof(string));
            PlausibleDocuments.Columns.Add("credibilityMeasure", typeof(double));
            // read through the measures[] and take only the plausible ones:
            //      two criteria:
            //          take the first "n", no more
            //          don't go below a threshold, with matching measure
            const double matchingThreshold    = +.01;           // TODO calibrate these model constants. It's the percentage of credibility of the matching.
            const Int32  candidateCardinality = Int32.MaxValue; // NB. this represents plus infinity; meaning no threshold on how many docs can match.

            for (int choosenElements = 0, currentElement = 0; choosenElements < candidateCardinality; currentElement++)
            {
                if (currentElement >= measures.Length)
                {
                    break;                                   // don't scan more than available documents.
                }
                if (measures[currentElement].credibilityMeasure >= matchingThreshold)
                {
                    // TODO add to datatable
                    object[] tmpRow = new object[4];
                    tmpRow[0] = measures[currentElement].id;
                    tmpRow[1] = measures[currentElement].autore;
                    tmpRow[2] = measures[currentElement]._abstract;
                    tmpRow[3] = measures[currentElement].credibilityMeasure;
                    PlausibleDocuments.Rows.Add(tmpRow);
                    ++choosenElements;
                } // else skip
            }     // end for: onReached_CandidateCardinality exits.
            // order by credibilityMeasure desc.
            System.Data.DataRow[] orderedDocuments =
                PlausibleDocuments.Select("", "credibilityMeasure DESC");
            //
            System.Data.DataTable orderedDocumentsTable = new System.Data.DataTable("orderedDocumentsTable");
            orderedDocumentsTable.Columns.Add("id", typeof(int));
            orderedDocumentsTable.Columns.Add("autore", typeof(string));
            orderedDocumentsTable.Columns.Add("abstract", typeof(string));
            orderedDocumentsTable.Columns.Add("credibilityMeasure", typeof(double));
            for (int c = 0; c < orderedDocuments.Length; c++)
            {
                object[] tmpRow = new object[4];
                tmpRow[0] = orderedDocuments[c]["id"];
                tmpRow[1] = orderedDocuments[c]["autore"];
                tmpRow[2] = orderedDocuments[c]["abstract"];
                tmpRow[3] = orderedDocuments[c]["credibilityMeasure"];
                orderedDocumentsTable.Rows.Add(tmpRow);
            }
            // ready
            return(orderedDocumentsTable);
        }// end Search() method.
Beispiel #5
0
        public ActionResult Create(NewCandidateViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var newCandidate = new Candidate
                {
                    Source          = vm.Source,
                    Qualification   = vm.Qualification,
                    TotalExperience = vm.TotalExperience,
                    ResumePath      = vm.ResumePath,
                    PhotoPath       = vm.PhotoPath,
                    Status          = vm.Status,
                    Comments        = vm.Comments,
                    CurrentCTC      = vm.CurrentCTC,
                    ExpectedCTC     = vm.ExpectedCTC,
                    Person          = vm.Person,
                    DesignationId   = vm.CandidateDesignationId
                };


                // Clean up white spaces for Email and Phone Numbers
                if (!string.IsNullOrEmpty(newCandidate.Person.Email))
                {
                    newCandidate.Person.Email = newCandidate.Person.Email.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.SecondaryEmail))
                {
                    newCandidate.Person.SecondaryEmail = newCandidate.Person.SecondaryEmail.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.PhoneNo))
                {
                    newCandidate.Person.PhoneNo = newCandidate.Person.PhoneNo.Trim();
                }

                if (!string.IsNullOrEmpty(newCandidate.Person.OfficePhone))
                {
                    newCandidate.Person.OfficePhone = newCandidate.Person.OfficePhone.Trim();
                }

                newCandidate.RecievedOn = vm.RecievedOn;

                newCandidate.CreatedByUserId = WebUser.Id;

                _candidateRepository.Create(newCandidate);
                _unitOfWork.Commit();

                // Update the Candidate Code.
                var selectedCandidate = _candidateRepository.Get(newCandidate.Id);
                if (selectedCandidate != null)
                {
                    selectedCandidate.Code = $"LA{selectedCandidate.Id.ToString("D" + 6)}";
                    _candidateRepository.Update(selectedCandidate);
                    _unitOfWork.Commit();
                }

                // Map the Technologies
                if (vm.TechnologyIds != null)
                {
                    foreach (var technologyId in vm.TechnologyIds)
                    {
                        var newMap = new CandidateTechnologyMap
                        {
                            CandidateId  = newCandidate.Id,
                            TechnologyId = technologyId
                        };

                        _candidateTechnologyMapRepository.Create(newMap);
                    }

                    _unitOfWork.Commit();
                }

                // Add the resume and map it to docs.
                if (vm.Resume != null)
                {
                    var newDocument = new CandidateDocument
                    {
                        CandidateId  = newCandidate.Id,
                        DocumentType = CandidateDocumentType.Resume
                    };

                    var siteSettings      = _settingsService.GetSiteSettings();
                    var blobUploadService = new BlobUploadService(siteSettings.BlobSettings);
                    var blobPath          = blobUploadService.UploadRecruitDocument(vm.Resume);
                    newDocument.DocumentPath = blobPath;
                    newDocument.FileName     = vm.Resume.FileName;

                    _candidateDocumentRepository.Create(newDocument);
                    _unitOfWork.Commit();
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.CandidateDesignationId = new SelectList(_candidateDesignationRepository.GetAll(), "Id", "Title");
            return(View(vm));
        }