コード例 #1
0
 public int RegisterCustomer(CustomerInterface.Customer customer)
 {
     using (DataClassesCustomerDataContext ctx = new DataClassesCustomerDataContext())
     {
         Customer customerToInsert;
         customerToInsert = new Customer();
         customerToInsert.CustomerName      = customer.CustomerName;
         customerToInsert.CustomerFirstName = customer.CustomerFirstName;
         ctx.Customer.InsertOnSubmit(customerToInsert);
         ctx.SubmitChanges();
         return(customerToInsert.CustomerID);
     }
 }
コード例 #2
0
        public int RegisterCustomer(CustomInterface.Customer customer)
        {
            using (DataClassesCustomerDataContext ctx = new DataClassesCustomerDataContext())
            {
                Customer customerToInsert;
                customerToInsert = new Customer();
                customerToInsert.CustomerName = customer.CustomerName;
                customerToInsert.CustomerFirstName = customer.CustomerFirstName;
                ctx.Customer.InsertOnSubmit(customerToInsert);
                ctx.SubmitChanges();
                return customerToInsert.CustomerID;

            }
        }
コード例 #3
0
        public int RegisterCustomer(CustomerInterface.Customer customer)
        {
            Console.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

            using (DataClassesCustomerDataContext ctx =
                       new DataClassesCustomerDataContext())
            {
                Customer customerToInsert;
                customerToInsert = new Customer();
                customerToInsert.CustomerName      = customer.CustomerName;
                customerToInsert.CustomerFirstName = customer.CustomerFirstName;
                ctx.Customer.InsertOnSubmit(customerToInsert);
                ctx.SubmitChanges();
                return(customerToInsert.CustomerID);
            }
        }