Beispiel #1
0
        protected void createCustomer_Click1(object sender, EventArgs e)
        {
            using (ChallengeLINQDataContext Data = new ChallengeLINQDataContext())
            {
                string cusName       = custNameText.Text;
                string cusGender     = custGenderText.Text;
                string PaymentMethod = custPaymentText.Text;
                string course        = custCourseName.SelectedItem.Text;
                string hostel        = custHostelName.SelectedItem.Text;

                CustomerClass theCustomer = new CustomerClass(cusName, cusGender, course, hostel, PaymentMethod);

                List <string> customerDetails = new List <string>(theCustomer.addToList());

                foreach (string measurement in customerDetails)
                {
                    summaryList.Items.Add(measurement);
                }

                CustomerTable TableCustomer = new CustomerTable(); //This enters the formdata into the database, specifically the CustomerTable
                TableCustomer.customerName   = cusName;
                TableCustomer.customerGender = cusGender;
                TableCustomer.paymentMethod  = PaymentMethod;
                TableCustomer.courseName     = course;
                TableCustomer.hostelName     = hostel;

                Data.CustomerTables.InsertOnSubmit(TableCustomer);
                Data.SubmitChanges();
            }
        }
 partial void UpdateCustomerTable(CustomerTable instance);
 partial void DeleteCustomerTable(CustomerTable instance);
 partial void InsertCustomerTable(CustomerTable instance);