public BL.Customer GetCustomerById(int id)
        {
            var result = _context.Customers.Where(c => c.CustomerId == id).First();

            BL.Customer customer =
                new BL.Customer(result.CustomerId, result.FirstName, result.LastName, result.Phone, result.Email, result.Zip);
            return(customer);
        }
예제 #2
0
        public BL.Customer GetCustomerById(int id)
        {
            var result = _context.Customers.Where(c => c.CustomerId == id).First();

            BL.Customer customer =
                new BL.Customer(result.CustomerId, result.FirstName, result.LastName, result.Phone, result.Email, result.Zip);
            Console.WriteLine($"\n\nCustomer ID: {customer.CustomerId}\nName: {customer.FirstName} {customer.LastName}\nPhone: {customer.Phone}\nEmail: {customer.Email}\nZip: {customer.Zip}");
            return(customer);
        }
예제 #3
0
        public void CreateCustomer(BL.Customer customer)
        {
            Customer customerToCreate = new Customer()
            {
                FirstName = customer.FirstName, LastName = customer.LastName, Phone = customer.Phone,
                Email     = customer.Email, Zip = customer.Zip
            };

            _context.Add(customerToCreate);
            _context.SaveChanges();
        }
예제 #4
0
        private void OPS_Load(object sender, EventArgs e)
        {
            /*con = new SqlConnection(cs);
             * con.Open();
             * cmd = new SqlCommand("cd", con);
             * cmd.CommandType = CommandType.StoredProcedure;
             * object obj = cmd.ExecuteScalar();*/


            BL.Customer cus = new BL.Customer();

            //txtCID.Text = cus.cusIDAuto();

            //this.txtCID.Text = obj.ToString();

            lblUser.Text = "User: " + Login.setValue;
            timer.Start();
            btnRegister.PerformClick();
            txtCName.Focus();
            this.ActiveControl = txtCName;
        }
        public BL.Customer GetCustomerByEmail(string email)
        {
            BL.Customer customer = new BL.Customer();
            var         query    = _context.Customers.FirstOrDefault(e => e.Email == email);

            if (query != null)
            {
                customer.CustomerId = query.CustomerId;
                customer.FirstName  = query.FirstName;
                customer.LastName   = query.LastName;
                customer.Phone      = query.Phone;
                customer.Email      = query.Email;
                customer.Zip        = query.Zip;
            }
            else
            {
                customer.FirstName = null;
                customer.LastName  = null;
                customer.Phone     = null;
                customer.Email     = null;
                customer.Zip       = null;
            }
            return(customer);
        }
 public void CreateCustomer(BL.Customer customer)
 {
     _customerRepository.CreateCustomer(customer);
 }