예제 #1
0
    public void show()
    {
        DocxToText1 doc1 = new DocxToText1();


        doc1.DocxToText(path);
        string Resumetext = doc1.ExtractText().Replace("\r\n\r\n", "<br />");

        displayResume.InnerHtml = Resumetext.Replace("\r\n", "<br />");
    }
예제 #2
0
    public void show()
    {
        string      path = ConfigurationManager.AppSettings["Resumes"].ToString() + ViewState["jsid"].ToString() + ".docx";
        DocxToText1 doc1 = new DocxToText1();


        doc1.DocxToText(path);
        string Resumetext = doc1.ExtractText();

        displayResume.InnerHtml = Resumetext;
    }
예제 #3
0
    public void LodeData()
    {
        if (AsyncFileUpload1.HasFile)
        {
            if (AsyncFileUpload1.PostedFile.ContentLength <= 2097152)
            {
                ext = Path.GetExtension(AsyncFileUpload1.FileName).ToLower();

                string fname   = Path.GetFileName(AsyncFileUpload1.FileName);
                string strPath = ConfigurationManager.AppSettings["Resumes"].ToString() + fname;
                // string strPath = ConfigurationManager.AppSettings["Resumes"].ToString() + "Resume" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Second + DateTime.Now.Millisecond + ext;
                if (ext.ToLower() != ".pdf" && ext.ToLower() != ".docx")
                {
                    lblMsg.Text = "allow only .pdf and .doc";
                }
                else
                {
                    AsyncFileUpload1.SaveAs(strPath);
                    this.iframe1.Attributes["src"] = "\\SUNILSOFTPC\\Shared\\Srihari\\Resumes" + " \\" + fname;

                    DocxToText1           doc      = new DocxToText1();
                    Word.ApplicationClass oWordApp = new Word.ApplicationClass();
                    object isVisible = true;
                    object missing   = System.Reflection.Missing.Value;
                    doc.DocxToText(strPath);
                    string data = doc.ExtractText();



                    #region Getting Resume Derails
                    string MatchPhonePattern = @"\(?\d{3}\)?-? *\d{3}-? *-?\d{4}";
                    Regex  rx = new Regex(MatchPhonePattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    // Find matches.
                    var matches = rx.Matches(data).Cast <Match>().Where(m => m.Success).Select(m => m.Groups[0].Value).Distinct();
                    // Report the number of matches found.
                    //int noOfMatches = matches.Count;
                    // Report on each match.
                    //int i = 0;
                    int mcount = 1;

                    foreach (string match in matches)
                    {
                        if (mcount == 1)
                        {
                            txtMobileNumber.Text = match;
                            mcount = mcount + 1;
                        }
                        else if (mcount == 2)
                        {
                            if (txtMobileNumber.Text == match)
                            {
                                mcount = mcount + 1;
                            }

                            else
                            {
                                txtCellNumber.Text = match;
                                mcount             = mcount + 1;
                            }
                        }

                        else if (mcount == 3)
                        {
                            if (match == txtMobileNumber.Text || match == txtCellNumber.Text)
                            {
                                // txtCellNumber.Text = string.Empty;
                                mcount = mcount + 1;
                            }
                            else
                            {
                                if (txtCellNumber.Text == "")
                                {
                                    txtCellNumber.Text = match;
                                }
                                mcount = mcount + 1;
                            }
                        }
                    }

                    string Email = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                    Regex  erx   = new Regex(Email, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    // Find matches.
                    var ematches = erx.Matches(data).Cast <Match>().Where(m => m.Success).Select(m => m.Groups[0].Value).Distinct();
                    int ecount   = 1;
                    foreach (string match in ematches)
                    {
                        if (ecount == 1)
                        {
                            txtEmail.Text = match;
                            ecount        = ecount + 1;
                        }
                        else if (ecount == 2)
                        {
                            if (match == txtEmail.Text)
                            {
                                txtAEmail.Text = string.Empty;
                                // txtAEmail.Text = match.Value.ToString();

                                ecount = ecount + 1;
                            }
                            else
                            {
                                txtAEmail.Text = match;
                                ecount         = ecount + 1;
                            }
                        }
                        else if (ecount == 3)
                        {
                            if (match == txtEmail.Text || match == txtAEmail.Text)
                            {
                                // txtAEmail.Text = string.Empty;
                                ecount = ecount + 1;
                            }
                            else
                            {
                                if (txtAEmail.Text == "")
                                {
                                    txtAEmail.Text = match;
                                }
                                ecount = ecount + 1;
                            }
                        }
                    }



                    string ctZip = @"[A-Za-z\-]+,\s?[A-Za-z]{2}\s(\d{5}|[A-Za-z0-9]{3}\s?[0-9]{3})";
                    Regex  crx   = new Regex(ctZip, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    // Find matches.
                    var cmatches = crx.Matches(data).Cast <Match>().Where(m => m.Success).Select(m => m.Groups[0].Value).Distinct();
                    // Report the number of matches found.
                    //  int noOfcMatches = matches.Count;
                    // Report on each match.
                    int adcount = 1;
                    foreach (string match in cmatches)
                    {
                        if (adcount == 1)
                        {
                            string[] s = Regex.Split(match.Trim(), ",");


                            string city = s[0];
                            string szip = s[1];

                            string[] ctzp = Regex.Split(szip.Trim(), " ");

                            string state = ctzp[0];

                            string zip = ctzp[1];

                            txtAddress.Text = match;
                            txtCity.Text    = city;
                            txtState.Text   = state;
                            txtZip.Text     = zip;
                            adcount         = adcount + 1;
                        }
                        else if (adcount == 2)
                        {
                            //txtCellNumber.Text = match.Value.ToString();

                            //count = count + 1;
                        }
                    }

                    string names = data.Substring(0, 100);


                    string Names = @"((\w+\s){2})";

                    // string Names = @"\w+\s+\w+{2}";
                    Regex Nrx = new Regex(Names, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    // Find matches.
                    var Nmatches = Nrx.Matches(names).Cast <Match>().Where(m => m.Success).Select(m => m.Groups[0].Value).Distinct();
                    // Report the number of matches found.
                    // int noOfNMatches = Nmatches.Count;
                    // Report on each match.
                    int nmcount = 1;
                    foreach (string match in Nmatches)
                    {
                        if (nmcount == 1)
                        {
                            string[] Name = Regex.Split(match.Trim(), " ");


                            txtFName.Text = Name[0];
                            txtLName.Text = Name[1];
                            nmcount       = nmcount + 1;
                        }
                        else if (nmcount == 2)
                        {
                            //txtAEmail.Text = match.Value.ToString();

                            //count = count + 1;
                        }
                    }
                    string Statues  = @"\d{1}/\d{1}";
                    Regex  sNrx     = new Regex(Statues, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    var    smatches = sNrx.Matches(names).Cast <Match>().Where(m => m.Success).Select(m => m.Groups[0].Value).Distinct();
                    int    smcount  = 1;
                    foreach (string match in smatches)
                    {
                        if (smcount == 1)
                        {
                            string v = match;
                            nmcount = nmcount + 1;
                        }
                        else if (nmcount == 2)
                        {
                        }
                    }



                    #endregion
                }
            }
            else
            {
                lblMsg.Text    = "File size exceeded the maximum size limit. Please upload file having size below 1 megabyte.";
                lblMsg.Visible = true;
            }
        }
        else
        {
            lblMsg.Text    = "Please add the file to upload.";
            lblMsg.Visible = true;
        }
    }