Пример #1
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            btnUpdate.Enabled = false;
            var updatedCustomer = dbDataContext.Customers.FirstOrDefault(q => q.CustomerId == updatedId);

            if (updatedCustomer == null)
            {
                return;
            }
            updatedCustomer.Name    = txtUpdated.Text;
            updatedCustomer.Surname = txtUpdateSurname.Text;
            dbDataContext.SubmitChanges();
            grdObject.Refresh();
        }
Пример #2
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;
        }
Пример #3
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;
        }