protected void OnGridDocumentsDeleteCommand(object source, GridCommandEventArgs e) { CandidateDocumentRepository docRepo = new CandidateDocumentRepository(); string docID = e.CommandArgument.ToString(); CandidateDocument doc = docRepo.FindOne(new CandidateDocument(Int32.Parse(docID))); if (doc != null) { docRepo.Delete(doc); } grdDocuments.Rebind(); }
protected void OnButtonSaveClick(object sender, EventArgs e) { radUploadSingle.AllowedFileExtensions = WebConfig.AllowFileExtension; radUploadSingle.MaxFileSize = WebConfig.MaxFileSize; CandidateDocumentRepository docRepo = new CandidateDocumentRepository(); //edit if (!string.IsNullOrEmpty(Request.QueryString["docID"])) { int docID = Int32.Parse(Request.QueryString["docID"]); CandidateDocument doc = docRepo.FindOne(new CandidateDocument(docID)); if (doc != null) { if (!string.IsNullOrEmpty(txtDocumentLegend.Text.Trim())) doc.DocumentLegend = txtDocumentLegend.Text.Trim(); if (radUploadSingle.UploadedFiles.Count >0) { string fileName = DateTime.Now.ToString("ddMMyyyyHHmmss") + "_" + radUploadSingle.UploadedFiles[0].GetName(); doc.DocumentName = fileName;//radUploadSingle.UploadedFiles[0].GetName(); doc.ContentType = radUploadSingle.UploadedFiles[0].ContentType; if (chkIsCV.Checked) { doc.Type = "CV"; doc.AbsoluteURL = WebConfig.CVDocumentAbsolutePath + fileName; radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.CVDocumentPhysicalPath + fileName); Common.IndexingDocumentFile(fileName, doc.CandidateID); } else { doc.AbsoluteURL = WebConfig.DocumentAbsolutePath + fileName; radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.DocumentPhysicalPath + fileName); } } docRepo.Update(doc); } } else //add new if (!string.IsNullOrEmpty(Request.QueryString["candID"])) { if (radUploadSingle.UploadedFiles.Count >0) { string fileName = DateTime.Now.ToString("ddMMyyyyHHmmss") + "_" + radUploadSingle.UploadedFiles[0].GetName(); CandidateDocument doc = new CandidateDocument(); doc.DocumentLegend = txtDocumentLegend.Text.Trim(); doc.DocumentName = fileName;// radUploadSingle.UploadedFiles[0].GetName(); doc.ContentType = radUploadSingle.UploadedFiles[0].ContentType; doc.CreatedDate = DateTime.Now; doc.CandidateID = Int32.Parse(Request.QueryString["candID"]); if (chkIsCV.Checked) { doc.Type = chkIsCV.Checked ? "CV" : ""; doc.AbsoluteURL = WebConfig.CVDocumentAbsolutePath + fileName; radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.CVDocumentPhysicalPath + fileName); Common.IndexingDocumentFile(fileName, Int32.Parse(Request.QueryString["candID"])); } else { doc.AbsoluteURL = WebConfig.DocumentAbsolutePath + fileName; radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.DocumentPhysicalPath + fileName); } docRepo.Insert(doc); } } string script = "<script type=\"text/javascript\">"; script += " OnBtnSaveClientClicked();"; script += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("saveAndCloseWindow")) ClientScript.RegisterStartupScript(this.GetType(), "saveAndCloseWindow", script); }
/// <summary> /// Neos sends informations of a candidate to a company that is potentially interested in hiring the candidate... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnBtnSendPresentationClicked(object sender, EventArgs e) { //Find email of company first. if (!string.IsNullOrEmpty(ddlCompany.SelectedValue) && !string.IsNullOrEmpty(Request.QueryString["CandidateId"])) { PresentationEmailObject emailObject = new PresentationEmailObject(); emailObject.CompanyId = int.Parse(ddlCompany.SelectedValue); emailObject.CandidateId = int.Parse(Request.QueryString["CandidateId"]); emailObject.AutoCreateAction = true; emailObject.Body = txtPresentationText.Text; if (!string.IsNullOrEmpty(SessionManager.CurrentUser.Email)) { emailObject.CcEmails.Add(SessionManager.CurrentUser.Email.Trim()); } foreach (GridDataItem itemContact in grdPresentationContacts.Items) { if (itemContact.Selected) { TableCell cell = itemContact["ContactID"]; if (!string.IsNullOrEmpty(cell.Text)) { emailObject.ContactId = int.Parse(cell.Text); } Literal lblContactEmail = itemContact["TemplateContactEmailColumn"].FindControl("lblContactEmail") as Literal; if (lblContactEmail != null && Common.IsValidEmailAddress(lblContactEmail.Text.Trim())) { emailObject.MainEmails.Add(lblContactEmail.Text.Trim()); } } } CandidateDocumentRepository canDocRepo = new CandidateDocumentRepository(); foreach (GridDataItem itemCanDoc in grdPresentationAttachedDocs.Items) { if (itemCanDoc.Selected) { TableCell cell = itemCanDoc["DocumentID"]; if (!string.IsNullOrEmpty(cell.Text)) { int canDocId = int.Parse(cell.Text); CandidateDocument canDoc = canDocRepo.FindOne(new CandidateDocument(canDocId)); if (!string.IsNullOrEmpty(canDoc.Type) && canDoc.Type.Trim() == "CV") { emailObject.AttachmentList.Add(canDoc.DocumentName, WebConfig.CVDocumentPhysicalPath + canDoc.DocumentName); } else { emailObject.AttachmentList.Add(canDoc.DocumentName, WebConfig.DocumentPhysicalPath + canDoc.DocumentName); } } } } CompanyDocumentRepository comDocRepo = new CompanyDocumentRepository(); foreach (GridDataItem itemComDoc in grdComDocuments.Items) { if (itemComDoc.Selected) { TableCell cell = itemComDoc["DocumentID"]; if (!string.IsNullOrEmpty(cell.Text)) { int comDocId = int.Parse(cell.Text); CompanyDocument comDoc = comDocRepo.FindOne(new CompanyDocument(comDocId)); emailObject.AttachmentList.Add(comDoc.DocumentName, WebConfig.CompanyDocumentPhysicalPath + comDoc.DocumentName); } } } SessionManager.PresentationEmailObject = emailObject; radWinSendPresentation.NavigateUrl = "SendPresentationEmail.aspx"; radWinSendPresentation.VisibleOnPageLoad = true; } }