コード例 #1
0
ファイル: index.aspx.cs プロジェクト: theanarch/Projekt
        // Add
        protected void ButtonAdd_Click(object sender, EventArgs e)
        {
            ListBoxContacts.Items.Add($"{TextBoxFirstname.Text} {TextBoxLastname.Text}");

            SQL.AddContact(TextBoxFirstname.Text, TextBoxLastname.Text, TextBoxSSN.Text);

            TextBoxFirstname.Text = "";
            TextBoxLastname.Text  = "";
            TextBoxSSN.Text       = "";
        }
コード例 #2
0
ファイル: Index.aspx.cs プロジェクト: sebbelinan/testudo
 protected void ButtonAddPerson_Click(object sender, EventArgs e)
 {
     if (SQL.CheckSSN(ssn))
     {
         SQL.AddContact(name, lastname, ssn);
     }
     else
     {
         //Literal1.Text = ("Alert, " "<script language ") FIXA TILL ALERT SENARE
     }
     UpdateListbox();
     ClearTextbox();
 }
コード例 #3
0
        protected void ButtonAddContact_Click(object sender, EventArgs e)
        {
            string firstname = TextBoxFirstname.Text;
            string lastname  = TextBoxLastname.Text;
            string ssn       = TextBoxSSN.Text;

            SQL.AddContact(firstname, lastname, ssn);
            ListBoxContacts.Items.Clear();

            foreach (var p in SQL.ImportData())
            {
                ListBoxContacts.Items.Add($"{p.FirstName} {p.LastName}");
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Contact> contacts = SQL.ImportData();

            JSONLiteral.Text = JsonConvert.SerializeObject(contacts);

            if (Request["action"] != null)
            {
                string action = Request["action"].ToString();
                if (action == "addcontact")
                {
                    string firstName = Request["firstname"];
                    string lastName  = Request["lastname"];
                    string ssn       = Request["ssn"];

                    SQL.AddContact(firstName, lastName, ssn);

                    JSONLiteral.Text = JsonConvert.SerializeObject("ok");
                }
            }
        }