protected void OnButtonSaveClick(object sender, EventArgs e)
    {
        radUploadSingle.AllowedFileExtensions = WebConfig.AllowFileExtension;
        radUploadSingle.MaxFileSize = WebConfig.MaxFileSize;

        CompanyDocumentRepository docRepo = new CompanyDocumentRepository();
        //edit
        if (!string.IsNullOrEmpty(Request.QueryString["docID"]))
        {
            int docID = Int32.Parse(Request.QueryString["docID"]);
            CompanyDocument doc = docRepo.FindOne(new CompanyDocument(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;

                    doc.AbsoluteURL = WebConfig.CompanyDocumentAbsolutePath + fileName;
                    radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.CompanyDocumentPhysicalPath + fileName);
                }
                docRepo.Update(doc);
            }
        }
        else //add new
            if (!string.IsNullOrEmpty(Request.QueryString["compID"]))
            {
                if (radUploadSingle.UploadedFiles.Count > 0)
                {
                    string fileName = DateTime.Now.ToString("ddMMyyyyHHmmss") + "_" + radUploadSingle.UploadedFiles[0].GetName();
                    CompanyDocument doc = new CompanyDocument();
                    doc.DocumentLegend = txtDocumentLegend.Text.Trim();
                    doc.DocumentName = fileName;// radUploadSingle.UploadedFiles[0].GetName();
                    doc.ContentType = radUploadSingle.UploadedFiles[0].ContentType;
                    doc.CreatedDate = DateTime.Now;
                    doc.CompanyID = Int32.Parse(Request.QueryString["compID"]);

                    doc.AbsoluteURL = WebConfig.CompanyDocumentAbsolutePath + fileName;
                    radUploadSingle.UploadedFiles[0].SaveAs(WebConfig.CompanyDocumentPhysicalPath + fileName);

                    docRepo.Insert(doc);
                }
            }
        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("saveAndCloseWindow"))
            ClientScript.RegisterStartupScript(this.GetType(), "saveAndCloseWindow", script);
    }
    protected void OnUploadMutiSaveClick(object sender, EventArgs e)
    {
        CompanyDocumentRepository docRepo = new CompanyDocumentRepository();

        radUploadMulti.MaxFileSize = WebConfig.MaxFileSize;
        radUploadMulti.AllowedFileExtensions = WebConfig.AllowFileExtension;
        radUploadMulti.MaxFileInputsCount = WebConfig.MaxDocumentFilePerMultiUpload;
        foreach (UploadedFile file in radUploadMulti.UploadedFiles)
        {
            string fileName = DateTime.Now.ToString("ddMMyyyyHHmmss") + "_" + file.GetName();
            CompanyDocument doc = new CompanyDocument();
            doc.DocumentLegend = file.GetFieldValue("Legend");
            doc.DocumentName = fileName;// file.GetName();
            doc.AbsoluteURL = WebConfig.CompanyDocumentAbsolutePath + fileName;
            doc.CreatedDate = DateTime.Now;
            doc.CompanyID = Int16.Parse(Request.QueryString["compID"]);
            doc.ContentType = file.ContentType;
            docRepo.Insert(doc);

            file.SaveAs(WebConfig.CompanyDocumentPhysicalPath + fileName);
        }
        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("saveAndCloseWindow"))
            ClientScript.RegisterStartupScript(this.GetType(), "saveAndCloseWindow", script);
    }
 private void BindData()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["docID"]))
     {
         int docID = Int32.Parse(Request.QueryString["docID"]);
         CompanyDocument doc = new CompanyDocumentRepository().FindOne(new CompanyDocument(docID));
         if (doc != null)
         {
             txtDocumentLegend.Text = doc.DocumentLegend;
         }
     }
 }
Пример #4
0
    /// <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;
        }
    }
Пример #5
0
 private void BindDocumentsGridOfCompany(int companyID)
 {
     if (companyID == 0)
     {
         grdComDocuments.DataSource = new List<CompanyDocument>();
         grdComDocuments.DataBind();
         return;
     }
     List<CompanyDocument> docList = new CompanyDocumentRepository().GetDocumentsOfCompany(companyID);
     grdComDocuments.DataSource = docList;
     grdComDocuments.DataBind();
 }
Пример #6
0
    protected void OnGridDocumentsItemCommand(object source, GridCommandEventArgs e)
    {
        if (e.CommandName == "viewdocument")
        {
            int docID = Int32.Parse(e.CommandArgument.ToString());
            CompanyDocument doc = new CompanyDocumentRepository().FindOne(new CompanyDocument(docID));
            if (doc != null)
            {
                string fileName = doc.AbsoluteURL.Substring(doc.AbsoluteURL.LastIndexOf(@"/") + 1, doc.AbsoluteURL.Length - (doc.AbsoluteURL.LastIndexOf(@"/") + 1));
                string filePath = doc.Type == "CV" ? WebConfig.CVDocumentPhysicalPath + fileName : WebConfig.DocumentPhysicalPath + fileName;
                Response.ContentType = doc.ContentType;
                Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
                Response.TransmitFile(filePath);
                Response.End();
                //Response.Buffer = false;
                //FileStream inStr = null;
                //byte[] buffer = new byte[1024];
                //long byteCount;

                //inStr = File.OpenRead(filePath);
                //while ((byteCount = inStr.Read(buffer, 0, buffer.Length)) > 0)
                //{
                //    if (Response.IsClientConnected)
                //    {
                //        Response.OutputStream.Write(buffer, 0, buffer.Length);
                //        Response.Flush();
                //    }
                //}
            }
        }
    }
Пример #7
0
 protected void OnGridDocumentsDeleteCommand(object source, GridCommandEventArgs e)
 {
     CompanyDocumentRepository docRepo = new CompanyDocumentRepository();
     string docID = e.CommandArgument.ToString();
     CompanyDocument doc = docRepo.FindOne(new CompanyDocument(Int32.Parse(docID)));
     if (doc != null)
     {
         docRepo.Delete(doc);
     }
     grdDocuments.Rebind();
 }