将字段从表单传递到网站上的字段

Passing Fields From a Form To The Fields On a Website

所以我只是一个自学 C# 的业余程序员,目前正在设计我自己的应用程序以减少为我的工作做事所需的步骤数量,我有几件事我想在一件事上得到帮助我想创建更新 Internet 表单的字段 我不确定这是否可以在两种不同的语言之间进行。

Website Elements

//When Button is Pressed Create The New Job In The Specified Location and 
//then create text files to send file attributes to.
//Future: Add the ability to also use these field attributes to update and 
//create the job folder on the website as well.

private void NewJob_Click(object sender, EventArgs e)
    {
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text);
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\0-Submittals"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\0-Submittals");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\1-Pricing"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\1-Pricing");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\2-Take Off"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\2-Take Off");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\3-Files"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\3-Files");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\4-Plans"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\4-Plans");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\5-Specs"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\5-Specs");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\6-Emails"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\6-Emails");
        if (!Directory.Exists(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\Properties"))
            Directory.CreateDirectory(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + "\Properties");

        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Contact.txt", lblContact.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\JobName.txt", lblJobName.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\BidDate.txt", lblBidDate.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Engineer.txt", lblEngineer.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\TakeOff.txt", lblTakeOff.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Received.txt", lblReceived.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Vendor.txt", lblVendor.Text);
        File.WriteAllText(@textBox1.Text + "\" + lblBidDate.Text + " - " + lblJobName.Text + @"\Properties\Notes.txt", lblNotes.Text);

    }

另一个问题是,当您右键单击用作文件资源管理器的网络浏览器时,如何在不移除防火墙的情况下消除此错误。 Photo of the security Message

提前致谢。

我想通了

private void Generate_Click(object sender, EventArgs e) {

        if (lblContact.Text.Contains("name0"))
            lblContact.Text.Replace("name0", "7");


        HtmlDocument doc = wbNewProject.Document;
        HtmlElement wbJobName = doc.GetElementById("Name"); //lblcontact.text
        HtmlElement wbEngineer = doc.GetElementById("engineer-lookup"); //
        HtmlElement wbSalesEng = doc.GetElementById("SalesEngineerUserId");
        HtmlElement wbLocation = doc.GetElementById("Location");
        HtmlElement wbBidDate = doc.GetElementById("BidDate");
        HtmlElement wbPriorApproval = doc.GetElementById("PriorApproval"); //True or False
        HtmlElement wbTakeOff = doc.GetElementById("TakeOffComplete"); //True or False
        HtmlElement wbProject = doc.GetElementById("RoleType"); //Design/Build or Plan/Spec
        wbJobName.SetAttribute("value", lblJobName.Text);

        if (lblContact.Text.Contains("Name1"))
            wbSalesEng.SetAttribute("value", "2");
        if (lblContact.Text.Contains("name2"))
            wbSalesEng.SetAttribute("value", "3");
        if (lblContact.Text.Contains("name3"))
            wbSalesEng.SetAttribute("value", "4");
        if (lblContact.Text.Contains("name4"))
            wbSalesEng.SetAttribute("value", "5");
        if (lblContact.Text.Contains("name5"))
            wbSalesEng.SetAttribute("value", "6");
        if (lblContact.Text.Contains("name6"))
            wbSalesEng.SetAttribute("value", "7");
        if (lblContact.Text.Contains("name7"))
            wbSalesEng.SetAttribute("value", "10");
        if (lblContact.Text.Contains("name8"))
            wbSalesEng.SetAttribute("value", "11");
        if (lblContact.Text.Contains("name9"))
            wbSalesEng.SetAttribute("value", "12");

        wbLocation.SetAttribute("value", lblLocation.Text);
        wbBidDate.SetAttribute("value", lblBidDate.Text);

        if (lblPriorApp.Text.Contains("Yes"))
        wbPriorApproval.SetAttribute("value", "true");
        if (lblPriorApp.Text.Contains("No"))
            wbPriorApproval.SetAttribute("value", "false");
        if (lblTakeOff.Text.Contains("Done"))
        wbTakeOff.SetAttribute("value", "true");
        if (lblTakeOff.Text.Contains("Not Done"))
            wbTakeOff.SetAttribute("value", "false");

        wbEngineer.SetAttribute("value", lblEngineer.Text);
        wbProject.SetAttribute("value", lblProject.Text);
    }