public ADDRESSINFO(ADDRESS Address)
 {
     this.ID = Address.ID;
     this.Name = Address.Name;
     this.Address = Address.Address1;
     this.City = Address.City;
     this.Type = Address.TypeID;
     this.Location = Address.Location;
     this.PostCode = Address.PostCode;
     this.Telephone = Address.Telephone;
 }
 public ADDRESSINFO(ADDRESS Address)
 {
     this.ID        = Address.ID;
     this.Name      = Address.Name;
     this.Address   = Address.Address1;
     this.City      = Address.City;
     this.Type      = Address.TypeID;
     this.Location  = Address.Location;
     this.PostCode  = Address.PostCode;
     this.Telephone = Address.Telephone;
 }
 public void DeleteAddressById(int id)
 {
     var obj = new ADDRESS() { ID = id };
     DeleteAddress(obj);
 }
 public void DeleteAddress(ADDRESS Address)
 {
     Context.ADDRESS.Attach(Address);
     Context.ADDRESS.DeleteObject(Address);
 }
 public void InsertAddress(ADDRESS address)
 {
     Context.ADDRESS.AddObject(address);
 }
 public void UpdateAddress(ADDRESS address)
 {
     Context.ADDRESS.AddObject(address);
     Context.ObjectStateManager.ChangeObjectState(address, EntityState.Modified);
 }
        public void ReloadControl(bool PageLoad)
        {
            ADDRESS addr = null;
            if (AddrID != 0)
            {
                if (!DisableOriginal)
                {
                    addr = ApplicationContext.Current.Customers.GetAddressById(AddrID);
                }
                else
                {
                    ADDRESSINFO a = ApplicationContext.Current.Orders.GetAddress(AddrID);
                    addr = new ADDRESS(a);
                }

                loadAddress(addr);
                if (!InOrder)
                {
                    lnkDelAddr.Visible = true;
                    imgDelete.Visible = true;
                    imgSeparator.Visible = true;
                }
            }

            if (PageLoad)
            {
                // viewstate of dropdown is enabled, so there is no need to reload it on every postback
                LoadDDLs(addr == null ? null : addr.City, addr == null ? null : addr.TypeID);
            }
            else
            {
                // ddl already loaded, the values must be re-set
                if (addr != null && addr.City.HasValue)
                {
                    ddlCities.SelectedValue = addr.City.Value.ToString();
                }

                if (addr != null && addr.TypeID.HasValue)
                {
                    ddlAddrType.SelectedValue = addr.TypeID.Value.ToString();
                }
            }
        }
        private void loadAddress(ADDRESS addr)
        {
            txtAddress.Text = addr.Address1;
            txtLocation.Text = addr.Location;
            txtName.Text = addr.Name;
            txtPostal.Text = addr.PostCode;
            txtTel.Text = addr.Telephone;

            litName.Text = addr.Name;
            if (!String.IsNullOrWhiteSpace(addr.Telephone))
            {
                litTel.Text = "<tr><td>Tel: " + addr.Telephone + "</td></tr>";
            }
            litAddress.Text = addr.Address1;
            litOther.Text = addr.Location + ", " + (addr.CityName == null ? ddlCities.SelectedItem.Text : addr.CityName) + ", " + addr.PostCode;
        }
        public ADDRESS GetAddress()
        {
            ADDRESS addr = new ADDRESS();
            addr.Address1 = txtAddress.Text;
            addr.Name = txtName.Text;
            addr.Location = txtLocation.Text;
            addr.PostCode = txtPostal.Text;
            addr.Telephone = txtTel.Text;

            if (ddlAddrType.SelectedValue != "-1")
            {
                addr.TypeID = Int32.Parse(ddlAddrType.SelectedValue);
            }

            if (ddlCities.SelectedValue != "-1")
            {
                addr.City = Int32.Parse(ddlCities.SelectedValue);
                addr.CityName = ddlCities.SelectedItem.Text;
            }

            addr.CustomerID = CurrentCustomer.Id;

            return addr;
        }
        /// <summary>
        /// Writes the address.
        /// </summary>
        /// <param name="orderDettId">The order dett id.</param>
        /// <param name="phOrd">The ph ord.</param>
        /// <param name="miniTitlesFontStyleIns">The mini titles font style ins.</param>
        private static void WriteAddress(int? orderDettId, ref Phrase phOrd, Font miniTitlesFontStyleIns)
        {
            if (orderDettId.HasValue)
            {
                var addressShipp = new ADDRESS(ApplicationContext.Current.Orders.GetAddress(orderDettId.Value));
                {
                    string addSh = string.Format(
@"{0}
{1}
{2}
{3}
{4}
{5}", addressShipp.Name,
    addressShipp.Address1,
    addressShipp.Location,
    addressShipp.PostCode,
    addressShipp.StateName,
    addressShipp.Telephone);
                    phOrd = new Phrase(addSh, miniTitlesFontStyleIns);
                }
            }
            else
            {
                phOrd = new Phrase(" ", miniTitlesFontStyleIns);
            }
        }
 public void DeleteAddress(ADDRESS Address)
 {
     _customerDAO.DeleteAddress(Address);
     Context.SaveChanges();
 }
 public void InsertAddress(ADDRESS address)
 {
     _customerDAO.InsertAddress(address);
     Context.SaveChanges();
 }
 public void UpdateAddress(ADDRESS address)
 {
     _customerDAO.UpdateAddress(address);
     Context.SaveChanges();
 }