Ejemplo n.º 1
0
        public void BindData(Address address)
        {
            this.AddressID = address.AddressID;
            txtStreet.Text = address.Street;
            txtHouseNr.Text = address.HouseNr;
            txtApartmentNr.Text = address.ApartmentNr;
            txtCity.Text = address.City.Name;
            txtZipCode.Text = address.ZipCode;
            ctrlSelectCountry.SelectedCountryId = address.Country.CountryID;
            ctrlSelectCountry.BindData();

            lblCity.Text = address.City.Name;
            lblCountry.Text = address.Country.Name;
            lblStreet.Text = address.Street;
            lblHouseApartment.Text = address.HouseNr + "/" + address.ApartmentNr;
            lblZipCode.Text = address.ZipCode;
        }
Ejemplo n.º 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;
        }