Ejemplo n.º 1
0
        private void BtnSavePhone_Click(object sender, EventArgs e)
        {
            PhoneDbDataContext dbDataContext = new PhoneDbDataContext();

            grdObject.Refresh();
            Phone    phone    = new Phone();
            Customer customer = new Customer();

            customer.CustomerId = Convert.ToInt32((txtKisiId.Text));
            phone.PhoneNumber   = txtPhoneNumber.Text;
            phone.PhoneTag      = txtPhoneTag.Text;
            string[] itemValues = new string[] { "Primary", "Second", "Third" };
            foreach (string value in itemValues)
            {
                ChImportantPhone.Properties.Items.Add(value, CheckState.Unchecked, true);
            }
            ChImportantPhone.SetEditValue("1");
            // Disable the Circle item.
            ChImportantPhone.Properties.Items["1"].Enabled = false;


            dbDataContext.Customers.InsertOnSubmit(customer);
            dbDataContext.SubmitChanges();
            grdObject.DataSource = dbDataContext.Customers;
        }
Ejemplo n.º 2
0
        private void AddCustomer_Click(object sender, EventArgs e)
        {
            PhoneDbDataContext dbDataContext = new PhoneDbDataContext();

            grdObject.Refresh();
            Customer customer = new Customer();

            customer.Name    = txtAd.Text;
            customer.Surname = txtSoyad.Text;
            dbDataContext.Customers.InsertOnSubmit(customer);
            dbDataContext.SubmitChanges();
            grdObject.DataSource = dbDataContext.Customers;
        }