Exemple #1
0
    protected void btnTestProcess_OnClick(object sender, System.EventArgs e)
    {
        int userID = System.Convert.ToInt32(Context.Items["userID"]);

        if (Request.Files.Count > 0)
        {
            if (null != upFile1.PostedFile && upFile1.PostedFile.FileName != "")
            {
                string fileName     = System.IO.Path.GetFileName(upFile1.PostedFile.FileName);
                string fileFullName = DateTime.Now.ToString("yyyyddMMHHmmss") + System.IO.Path.GetFileName(upFile1.PostedFile.FileName);
                string fileLocation = string.Format("{0}{1}", Server.MapPath(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Resources_PDFFolder"])), fileFullName);

                upFile1.PostedFile.SaveAs(fileLocation);

                process_process_contacts_upload target = new process_process_contacts_upload();
                string   mode    = "test";
                string[] to_pass = new string[2] {
                    mode, fileFullName
                };

                //Thread newThread = new Thread(() => { target.ProcessContacts(to_pass); });
                //newThread.Start();

                //processContacts = new Thread(new ThreadStart(ProcessContacts));
                //processContacts.Start();

                ProcessContacts(to_pass);

                btnTestProcess.Visible   = false;
                lblFileName.Text         = fileFullName;
                plhUpload.Visible        = false;
                plhRestartUpload.Visible = true;
                plhStep2Results.Visible  = true;
            }
            else
            {
                plhStep3.Visible   = false;
                lblUploadFail.Text = "You must first upload a file";
            }
        }
        else
        {
            plhStep3.Visible = false;
        }
    }
    protected void btnTestProcess_OnClick(object sender, System.EventArgs e)
    {
        int userID = System.Convert.ToInt32(Context.Items["userID"]);

        if (Request.Files.Count > 0)
        {
            if (null != upFile1.PostedFile && upFile1.PostedFile.FileName != "")
            {
                string fileName = System.IO.Path.GetFileName(upFile1.PostedFile.FileName);
                string fileFullName = DateTime.Now.ToString("yyyyddMMHHmmss") + System.IO.Path.GetFileName(upFile1.PostedFile.FileName);
                string fileLocation = string.Format("{0}{1}", Server.MapPath(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Resources_PDFFolder"])), fileFullName);

                upFile1.PostedFile.SaveAs(fileLocation);

                process_process_contacts_upload target = new process_process_contacts_upload();
                string mode = "test";
                string[] to_pass = new string[2] {mode, fileFullName};

                //Thread newThread = new Thread(() => { target.ProcessContacts(to_pass); });
                //newThread.Start();

                //processContacts = new Thread(new ThreadStart(ProcessContacts));
                //processContacts.Start();

                ProcessContacts(to_pass);

                btnTestProcess.Visible = false;
                lblFileName.Text = fileFullName;
                plhUpload.Visible = false;
                plhRestartUpload.Visible = true;
                plhStep2Results.Visible = true;
            }
            else
            {
                plhStep3.Visible = false;
                lblUploadFail.Text = "You must first upload a file";
            }

        }
        else
        {
            plhStep3.Visible = false;
        }
    }