public void BindData(Contact contact)
        {
            this.ContactID = contact.ContactID;
            txtImie.Text = contact.FirstName;
            txtNazwisko.Text = contact.LastName;
            txtEmail.Text = contact.Email;
            txtTelefon.Text = contact.Phone;

            lblEmail.Text = contact.Email;
            lblFullName.Text = contact.FirstName + " " + contact.LastName;
            lblPhone.Text = contact.Phone;
        }
Beispiel #2
0
        public Employee SaveInfo()
        {
            Employee employee = EmployeeService.GetEmployeeById(this.EmployeeID);
            if (employee == null)
            {
                Membership.CreateUser(txtLogin.Text, txtPassword.Text);
                employee = EmployeeService.GetEmployeeByLogin(txtLogin.Text);
            }
            Contact contact = null;
            Address address = null;
            if (employee.Contact == null)
                contact = new Contact();
            else
                contact = employee.Contact;
            if (employee.Address == null)
                address = new Address();
            else
                address = employee.Address;
            contact.Email = txtEmail.Text;
            contact.FirstName = txtFirstName.Text;
            contact.LastName = txtLastName.Text;
            contact.Phone = txtPhoneNumber.Text;

            address.Street = txtStreetAddress.Text;
            address.HouseNr = txtHouse.Text;
            address.ApartmentNr = txtApartment.Text;
            address.ZipCode = txtZipPostalCode.Text;

            address.City = CityService.GetCityOrCreateNew(txtCity.Text);
            address.Country = BasicService<Country, Guid>.GetByID(ctrlSelectCountry.SelectedCountryId);

            if (employee.CreationDate == DateTime.MinValue)
                employee.CreationDate = DateTime.Now;
            if (employee.LastActivityDate == DateTime.MinValue)
                employee.LastActivityDate = DateTime.Now;
            if (employee.LastLoginDate == DateTime.MinValue)
                employee.LastLoginDate = DateTime.Now;
            employee.Address = address;
            employee.Contact = contact;
            EmployeeService.SaveEmployee(employee);
            return employee;
        }
Beispiel #3
0
        public static IList<CustomerFacility> GetCustomerFacilitiesForContact(Contact contact)
        {
            Repository<CustomerFacility, Guid> rep = new Repository<CustomerFacility,Guid>();
            var result = from cf in rep.GetQueryable()
                         where cf.Contacts.Contains(contact)
                         select cf;

            return result.ToList();
        }
Beispiel #4
0
 public static IList<CustomerFacility> GetFacilitiesForContact(Contact contact)
 {
     Repository<CustomerFacility, Guid> repo = new Repository<CustomerFacility, Guid>();
     var result = repo.GetQueryable().Where(fac => fac.Contacts.Contains(contact));
     return result.ToList();
 }
Beispiel #5
0
 public static IList<Customer> GetCustomersForContactID(Contact contact)
 {
     IList<CustomerFacility> facilities = GetCustomerFacilitiesForContact(contact);
     var customers = from c in facilities
                     select c.Customer;
     return customers.Distinct().ToList();
 }