Ejemplo n.º 1
0
        public CustomerBO SaveInfo()
        {
            CustomerBO customer = this.CustomerService.GetCustomerById(this.CustomerId);
            if (customer != null)
            {
                customer.Name = txtCustomerName.Text;
                customer.Telephone = txtTelephone.Text;
                customer.Address = txtAddress.Text;
                customer.Email = ctrlEmailTextBox.Text;
                customer.Note = txtNote.Text;
                customer.Company = txtCompanyName.Text;
                customer.PhoneNumber = txtPhoneNumber.Text;
                customer.FaxNumber = txtFaxNumber.Text;
                customer.TaxCode = txtTaxCode.Text;
                customer.LastEditedOn = DateTime.Now;
                customer.LastEditedBy = this.LoggedInUserId;
                customer.CustomerTypeId = this.CustomerTypeId;

                this.CustomerService.UpdateCustomer(customer);
            }
            else
            {
                customer = new CustomerBO() {
                    Name = txtCustomerName.Text,
                    Telephone = txtTelephone.Text,
                    Address = txtAddress.Text,
                    Email = ctrlEmailTextBox.Text,
                    Note = txtNote.Text,
                    Company = txtCompanyName.Text,
                    PhoneNumber = txtPhoneNumber.Text,
                    FaxNumber = txtFaxNumber.Text,
                    TaxCode = txtTaxCode.Text,
                    CreatedOn = DateTime.Now,
                    CreatedBy = this.LoggedInUserId,
                    CustomerTypeId = this.CustomerTypeId
                };

                customer.CustomerId = this.CustomerService.InsertCustomer(customer);
            }

            return customer;
        }
Ejemplo n.º 2
0
 public int InsertCustomer(CustomerBO customer)
 {
     return customerDao.InsertCustomer(customer);
 }
Ejemplo n.º 3
0
 public void UpdateCustomer(CustomerBO customer)
 {
     customerDao.UpdateCustomer(customer);
 }
Ejemplo n.º 4
0
        public int InsertCustomer(CustomerBO customer)
        {
            using (var context = new InThuDoEntities())
            {
                Customer cust = new Customer() {
                    Name = customer.Name,
                    Telephone = customer.Telephone,
                    Address = customer.Address,
                    Email = customer.Email,
                    CreatedOn = customer.CreatedOn,
                    CreatedBy = customer.CreatedBy,
                    Company = customer.Company,
                    PhoneNumber = customer.PhoneNumber,
                    FaxNumber = customer.FaxNumber,
                    TaxCode = customer.TaxCode,
                    Note = customer.Note,
                    CustomerTypeId = customer.CustomerTypeId
                };

                context.Customers.Add(cust);
                context.SaveChanges();
                return cust.CustomerId;
            }
        }
Ejemplo n.º 5
0
        private CustomerBO MapCustomer(Customer c)
        {
            if (c == null) return null;

            CustomerBO cust = new CustomerBO()
            {
                CustomerId = c.CustomerId,
                Name = c.Name,
                Telephone = c.Telephone,
                Address = c.Address,
                Email = c.Email,
                CreatedOn = c.CreatedOn,
                CreatedBy = c.CreatedBy,
                LastEditedOn = c.LastEditedOn,
                LastEditedBy = c.LastEditedBy,
                Company = c.Company,
                PhoneNumber = c.PhoneNumber,
                FaxNumber = c.FaxNumber,
                TaxCode = c.TaxCode,
                Note = c.Note,
                CustomerTypeId = c.CustomerTypeId,
                CustomerType = new CustomerTypeBO() {
                    Id = c.LibCustomerType.Id,
                    Code = c.LibCustomerType.Code,
                    Name = c.LibCustomerType.Name,
                    Description = c.LibCustomerType.Description
                }
            };

            return cust;
        }
Ejemplo n.º 6
0
        public void UpdateCustomer(CustomerBO customer)
        {
            using (var context = new InThuDoEntities())
            {
                Customer cust = context.Customers.SingleOrDefault(c => c.CustomerId == customer.CustomerId);
                cust.Name = customer.Name;
                cust.Telephone = customer.Telephone;
                cust.Address = customer.Address;
                cust.Email = customer.Email;
                cust.LastEditedOn = customer.LastEditedOn;
                cust.LastEditedBy = customer.LastEditedBy;
                cust.Company = customer.Company;
                cust.PhoneNumber = customer.PhoneNumber;
                cust.FaxNumber = customer.FaxNumber;
                cust.TaxCode = customer.TaxCode;
                cust.Note = customer.Note;
                cust.CustomerTypeId = customer.CustomerTypeId;

                context.SaveChanges();
            }
        }