Ejemplo n.º 1
0
 private Address fillAddress(User user, Enums.ADDRESS_TYPE addrType)
 {
     Address addr = new Address
     {
         Deleted = false,
         AddressFull = GetFullAddress(),
         AddressNo = addressno.Text,
         AddressLine1 = addressline1.Text,
         AddressLine2 = addressline2.Text,
         AddressLine3 = addressline3.Text,
         AddressLine4 = addressline4.Text,
         AddressLine5 = addressline5.Text,
         PostalCode = postalcode.Text,
         Telephone1 = telephone1.Text,
         Telephone2 = telephone2.Text,
         Fax = fax.Text,
         Mobile = mobile.Text,
         Town = town.Text,
         County = County.Text,
         Country = country.Text,
         UserId = user.UserID,
         SameAsCustomer = false,
         SameAsBilling = false,
         MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), addrType),
         CreationDate = DateTime.Now,
         LastAmendmentDate = DateTime.Now,
         AddressName = null,
         CreatedBy = user.UserID,
         LastAmendedBy = null
     };
     return addr;
 }
 private void SetAddresses(ref Address accountAddress, ref Address billingAddress, ref Address shippingAddress)
 {
     var query = from c in DatabaseContext.Addresses where c.UserId == LoggedIsUser.UserID select c;
     foreach (var n in query)
     {
         if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.PERSONAL)))
         {
             accountAddress = n;
         }
         else if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING)))
         {
             billingAddress = n;
         }
         else if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING)))
         {
             shippingAddress = n;
         }
     }
 }
Ejemplo n.º 3
0
        protected void userSubmitButton_Click(object sender, ImageClickEventArgs e)
        {
            //var allUsersofCompany = (from UserTable in DatabaseContext.Users where UserTable.CompanyID == LoggedIsUser.CompanyID && UserTable.Enabled == true select UserTable);
            //int totalEnabledUsers = allUsersofCompany.Count();
            //if(totalEnabledUsers == allUsersofCompany.)

            SelectedTabElement = 4;
            newUserPanel.Visible = false;
            addUser.Visible = true;
            List<User> checkuser = (from UserTable in DatabaseContext.Users where UserTable.Email == userEmailField.Text select UserTable).ToList();
            if (checkuser.Any())
            {
                SetErrorMessage("Email address already resgistered with Simplicity");
            }
            else
            {
                Address Companyaddress = (from addr in LoggedIsUser.Addresses where addr.MultiAddressType == "COMPANY" select addr).FirstOrDefault();
                User user = new User
                {
                    FullName = userSurNameField.Text + ", " + userFirstNameField.Text,
                    Surname = userSurNameField.Text,
                    Forename = userFirstNameField.Text,
                    JobTitle = userJobTitle.Text,
                    Email = userEmailField.Text,
                    Password = Utility.GetMd5Sum(userPasswordField.Text),
                    ReminderQuestionID = byte.Parse(userlistForgotPasswordQuestion.SelectedValue),
                    ReminderQuestion = userlistForgotPasswordQuestion.SelectedItem.Text,
                    ReminderAnswer = Utility.GetMd5Sum(usertxtForgotPasswordAnswer.Text),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    Type = Enum.GetName(typeof(Enums.ENTITY_TYPE), Enums.ENTITY_TYPE.USER),
                    Deleted = false,
                    OnHold = false,
                    Verified = false,
                    Enabled = true,
                    UserUID = Guid.NewGuid().ToString(),
                    VerificationCode = Guid.NewGuid().ToString(),
                    Approved = 0,
                    PaymentType = 0,
                    LoginAttempts = 0
                };

                Address address = new Address
                {
                    Deleted = Companyaddress.Deleted,
                    AddressFull = Companyaddress.AddressFull,
                    AddressNo = Companyaddress.AddressNo,
                    AddressLine1 = Companyaddress.AddressLine1,
                    AddressLine2 = Companyaddress.AddressLine2,
                    AddressLine3 = Companyaddress.AddressLine3,
                    AddressLine4 = Companyaddress.AddressLine4,
                    AddressLine5 = Companyaddress.AddressLine5,
                    PostalCode = Companyaddress.PostalCode,
                    Telephone1 = Companyaddress.Telephone1,
                    Telephone2 = Companyaddress.Telephone2,
                    Fax = Companyaddress.Fax,
                    Mobile = Companyaddress.Mobile,
                    Town = Companyaddress.Town,
                    County = Companyaddress.County,
                    Country = Companyaddress.Country,
                    UserId = user.UserID,
                    SameAsCustomer = Companyaddress.SameAsCustomer,
                    SameAsBilling = Companyaddress.SameAsBilling,
                    MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.PERSONAL),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    AddressName = Companyaddress.AddressName,
                    CreatedBy = LoggedIsUser.UserID,
                    LastAmendedBy = Companyaddress.LastAmendedBy
                };

                Address companyAddress = new Address
                {
                    Deleted = Companyaddress.Deleted,
                    AddressFull = Companyaddress.AddressFull,
                    AddressNo = Companyaddress.AddressNo,
                    AddressLine1 = Companyaddress.AddressLine1,
                    AddressLine2 = Companyaddress.AddressLine2,
                    AddressLine3 = Companyaddress.AddressLine3,
                    AddressLine4 = Companyaddress.AddressLine4,
                    AddressLine5 = Companyaddress.AddressLine5,
                    PostalCode = Companyaddress.PostalCode,
                    Telephone1 = Companyaddress.Telephone1,
                    Telephone2 = Companyaddress.Telephone2,
                    Fax = Companyaddress.Fax,
                    Mobile = Companyaddress.Mobile,
                    Town = Companyaddress.Town,
                    County = Companyaddress.County,
                    Country = Companyaddress.Country,
                    UserId = user.UserID,
                    SameAsCustomer = Companyaddress.SameAsCustomer,
                    SameAsBilling = Companyaddress.SameAsBilling,
                    MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.COMPANY),
                    CreationDate = DateTime.Now,
                    LastAmendmentDate = DateTime.Now,
                    AddressName = Companyaddress.AddressName,
                    CreatedBy = LoggedIsUser.UserID,
                    LastAmendedBy = Companyaddress.LastAmendedBy
                };

                user.Addresses.Add(address);
                user.Addresses.Add(companyAddress);
                user.CompanyID = LoggedIsUser.CompanyID;
                DatabaseContext.AddToUsers(user);
                DatabaseContext.SaveChanges();

                //call health and safety stored procedure over here to insert company there as well
                addCompanyToHS(user);
                EmailUtility.SendUserAccountCreationEmail(user, userPasswordField.Text,usertxtForgotPasswordAnswer.Text);
                Response.Redirect("~/SignUp.aspx?SelectedTabElement="+SelectedTabElement);
            }
        }
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Address accountAddress = null;
            Address billingAddress = null;
            Address shippingAddress = null;

            SetAddresses(ref accountAddress, ref billingAddress, ref shippingAddress);

            if (BillingCheck.Checked)
            {
                if (billingAddress != null)
                {

                    billingAddress.Deleted = false;
                    billingAddress.UserId = LoggedIsUser.UserID;
                    billingAddress.SameAsCustomer = true;
                    billingAddress.SameAsBilling = false;
                    billingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING);
                    billingAddress.AddressName = null;
                    billingAddress.AddressNo = null;
                    billingAddress.AddressLine1 = null;
                    billingAddress.AddressLine2 = null;
                    billingAddress.AddressLine3 = null;
                    billingAddress.AddressLine4 = null;
                    billingAddress.AddressLine5 = null;
                    billingAddress.PostalCode = null;
                    billingAddress.AddressFull = null;
                    billingAddress.Telephone1 = null;
                    billingAddress.Telephone2 = null;
                    billingAddress.Fax = null;
                    billingAddress.Mobile = null;
                    billingAddress.CreatedBy = LoggedIsUser.UserID;
                    billingAddress.CreationDate = DateTime.Now;
                    billingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    billingAddress.LastAmendmentDate = DateTime.Now;
                    billingAddress.Town = null;
                    billingAddress.County = null;
                    billingAddress.Country = null;
                    billingAddress.AddressID = billingAddress.AddressID;
                    DatabaseContext.SaveChanges();
                }
                else
                {
                    billingAddress = new Address();
                    billingAddress.Deleted = false;
                    billingAddress.UserId = LoggedIsUser.UserID;
                    billingAddress.SameAsCustomer = true;
                    billingAddress.SameAsBilling = false;
                    billingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING);
                    billingAddress.AddressName = null;
                    billingAddress.AddressNo = null;
                    billingAddress.AddressLine1 = null;
                    billingAddress.AddressLine2 = null;
                    billingAddress.AddressLine3 = null;
                    billingAddress.AddressLine4 = null;
                    billingAddress.AddressLine5 = null;
                    billingAddress.PostalCode = null;
                    billingAddress.AddressFull = null;
                    billingAddress.Telephone1 = null;
                    billingAddress.Telephone2 = null;
                    billingAddress.Fax = null;
                    billingAddress.Mobile = null;
                    billingAddress.CreatedBy = LoggedIsUser.UserID;
                    billingAddress.CreationDate = DateTime.Now;
                    billingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    billingAddress.LastAmendmentDate = DateTime.Now;
                    billingAddress.Town = null;
                    billingAddress.County = null;
                    billingAddress.Country = null;
                    DatabaseContext.AddToAddresses(billingAddress);
                    DatabaseContext.SaveChanges();
                }
            }
            else
            {
                if (billingAddress != null)
                {
                    billingAddress.Deleted=false;
                    billingAddress.UserId = LoggedIsUser.UserID;
                    billingAddress.SameAsCustomer = true;
                    billingAddress.SameAsBilling=false;
                    billingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING);
                    billingAddress.AddressName=null;
                    billingAddress.AddressNo= txtBillingAddressNo.Text;
                    billingAddress.AddressLine1=txtBillingAddressLine1.Text;
                    billingAddress.AddressLine2=txtBillingAddressLine2.Text;
                    billingAddress.AddressLine3=txtBillingAddressLine3.Text;
                    billingAddress.AddressLine4=txtBillingAddressLine4.Text;
                    billingAddress.AddressLine5=txtBillingAddressLine5.Text;
                    billingAddress.PostalCode=txtBillingPostCode.Text;
                    billingAddress.AddressFull=null;
                    billingAddress.Telephone1= txtBillingTele1.Text;
                    billingAddress.Telephone2= txtBillingTele2.Text;
                    billingAddress.Fax=txtBillingFax.Text;
                    billingAddress.Mobile= txtBillingMobile.Text;
                    billingAddress.CreatedBy= LoggedIsUser.UserID;
                    billingAddress.CreationDate= DateTime.Now;
                    billingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    billingAddress.LastAmendmentDate = DateTime.Now;
                    billingAddress.Town= txtBillingTown.Text;
                    billingAddress.County=txtBillingCounty.Text;
                    billingAddress.Country=txtBillingCountry.Text;
                    billingAddress.AddressID = billingAddress.AddressID;
                    DatabaseContext.SaveChanges();
                }
                else
                {
                    billingAddress = new Address();
                    billingAddress.Deleted = false;
                    billingAddress.UserId = LoggedIsUser.UserID;
                    billingAddress.SameAsCustomer = true;
                    billingAddress.SameAsBilling = false;
                    billingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING);
                    billingAddress.AddressName = null;
                    billingAddress.AddressNo = txtBillingAddressNo.Text;
                    billingAddress.AddressLine1 = txtBillingAddressLine1.Text;
                    billingAddress.AddressLine2 = txtBillingAddressLine2.Text;
                    billingAddress.AddressLine3 = txtBillingAddressLine3.Text;
                    billingAddress.AddressLine4 = txtBillingAddressLine4.Text;
                    billingAddress.AddressLine5 = txtBillingAddressLine5.Text;
                    billingAddress.PostalCode = txtBillingPostCode.Text;
                    billingAddress.AddressFull = null;
                    billingAddress.Telephone1 = txtBillingTele1.Text;
                    billingAddress.Telephone2 = txtBillingTele2.Text;
                    billingAddress.Fax = txtBillingFax.Text;
                    billingAddress.Mobile = txtBillingMobile.Text;
                    billingAddress.CreatedBy = LoggedIsUser.UserID;
                    billingAddress.CreationDate = DateTime.Now;
                    billingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    billingAddress.LastAmendmentDate = DateTime.Now;
                    billingAddress.Town = txtBillingTown.Text;
                    billingAddress.County = txtBillingCounty.Text;
                    billingAddress.Country = txtBillingCountry.Text;
                    billingAddress.AddressID = billingAddress.AddressID;
                    DatabaseContext.AddToAddresses(billingAddress);
                    DatabaseContext.SaveChanges();
                }
            }
            if (ShippingCheck.Checked)
            {
                if (shippingAddress != null)
                {

                    shippingAddress.Deleted = false;
                    shippingAddress.UserId = LoggedIsUser.UserID;
                    shippingAddress.SameAsCustomer = true;
                    shippingAddress.SameAsBilling = false;
                    shippingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING);
                    shippingAddress.AddressName = null;
                    shippingAddress.AddressNo = null;
                    shippingAddress.AddressLine1 = null;
                    shippingAddress.AddressLine2 = null;
                    shippingAddress.AddressLine3 = null;
                    shippingAddress.AddressLine4 = null;
                    shippingAddress.AddressLine5 = null;
                    shippingAddress.PostalCode = null;
                    shippingAddress.AddressFull = null;
                    shippingAddress.Telephone1 = null;
                    shippingAddress.Telephone2 = null;
                    shippingAddress.Fax = null;
                    shippingAddress.Mobile = null;
                    shippingAddress.CreatedBy = LoggedIsUser.UserID;
                    shippingAddress.CreationDate = DateTime.Now;
                    shippingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    shippingAddress.LastAmendmentDate = DateTime.Now;
                    shippingAddress.Town = null;
                    shippingAddress.County = null;
                    shippingAddress.Country = null;
                    shippingAddress.AddressID = shippingAddress.AddressID;
                    DatabaseContext.SaveChanges();

                }
                else
                {

                    shippingAddress = new Address();
                    shippingAddress.Deleted = false;
                    shippingAddress.UserId = LoggedIsUser.UserID;
                    shippingAddress.SameAsCustomer = true;
                    shippingAddress.SameAsBilling = false;
                    shippingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING);
                    shippingAddress.AddressName = null;
                    shippingAddress.AddressNo = null;
                    shippingAddress.AddressLine1 = null;
                    shippingAddress.AddressLine2 = null;
                    shippingAddress.AddressLine3 = null;
                    shippingAddress.AddressLine4 = null;
                    shippingAddress.AddressLine5 = null;
                    shippingAddress.PostalCode = null;
                    shippingAddress.AddressFull = null;
                    shippingAddress.Telephone1 = null;
                    shippingAddress.Telephone2 = null;
                    shippingAddress.Fax = null;
                    shippingAddress.Mobile = null;
                    shippingAddress.CreatedBy = LoggedIsUser.UserID;
                    shippingAddress.CreationDate = DateTime.Now;
                    shippingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    shippingAddress.LastAmendmentDate = DateTime.Now;
                    shippingAddress.Town = null;
                    shippingAddress.County = null;
                    shippingAddress.Country = null;
                    DatabaseContext.AddToAddresses(shippingAddress);
                    DatabaseContext.SaveChanges();
                }
            }
            else
            {
                if (shippingAddress != null)
                {

                    shippingAddress.Deleted = false;
                    shippingAddress.UserId = LoggedIsUser.UserID;
                    shippingAddress.SameAsCustomer = true;
                    shippingAddress.SameAsBilling = false;
                    shippingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING);
                    shippingAddress.AddressName = null;
                    shippingAddress.AddressNo = txtShippingAddressNo.Text;
                    shippingAddress.AddressLine1 = txtShippingAddressLine1.Text;
                    shippingAddress.AddressLine2 = txtShippingAddressLine2.Text;
                    shippingAddress.AddressLine3 = txtShippingAddressLine3.Text;
                    shippingAddress.AddressLine4 = txtShippingAddressLine4.Text;
                    shippingAddress.AddressLine5 = txtShippingAddressLine5.Text;
                    shippingAddress.PostalCode = txtShippingPostCode.Text;
                    shippingAddress.AddressFull = null;
                    shippingAddress.Telephone1 = txtShippingTele1.Text;
                    shippingAddress.Telephone2 = txtShippingTele2.Text;
                    shippingAddress.Fax = txtShippingFax.Text;
                    shippingAddress.Mobile = txtShippingMobile.Text;
                    shippingAddress.CreatedBy = LoggedIsUser.UserID;
                    shippingAddress.CreationDate = DateTime.Now;
                    shippingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    shippingAddress.LastAmendmentDate = DateTime.Now;
                    shippingAddress.Town = txtShippingTown.Text;
                    shippingAddress.County = txtShippingCounty.Text;
                    shippingAddress.Country = txtShippingCountry.Text;
                    shippingAddress.AddressID = shippingAddress.AddressID;
                    DatabaseContext.SaveChanges();
                }
                else
                {
                    shippingAddress = new Address();
                    shippingAddress.Deleted = false;
                    shippingAddress.UserId = LoggedIsUser.UserID;
                    shippingAddress.SameAsCustomer = true;
                    shippingAddress.SameAsBilling = false;
                    shippingAddress.MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING);
                    shippingAddress.AddressName = null;
                    shippingAddress.AddressNo = txtShippingAddressNo.Text;
                    shippingAddress.AddressLine1 = txtShippingAddressLine1.Text;
                    shippingAddress.AddressLine2 = txtShippingAddressLine2.Text;
                    shippingAddress.AddressLine3 = txtShippingAddressLine3.Text;
                    shippingAddress.AddressLine4 = txtShippingAddressLine4.Text;
                    shippingAddress.AddressLine5 = txtShippingAddressLine5.Text;
                    shippingAddress.PostalCode = txtShippingPostCode.Text;
                    shippingAddress.AddressFull = null;
                    shippingAddress.Telephone1 = txtShippingTele1.Text;
                    shippingAddress.Telephone2 = txtShippingTele2.Text;
                    shippingAddress.Fax = txtShippingFax.Text;
                    shippingAddress.Mobile = txtShippingMobile.Text;
                    shippingAddress.CreatedBy = LoggedIsUser.UserID;
                    shippingAddress.CreationDate = DateTime.Now;
                    shippingAddress.LastAmendedBy = LoggedIsUser.UserID;
                    shippingAddress.LastAmendmentDate = DateTime.Now;
                    shippingAddress.Town = txtShippingTown.Text;
                    shippingAddress.County = txtShippingCounty.Text;
                    shippingAddress.Country = txtShippingCountry.Text;
                    DatabaseContext.AddToAddresses(shippingAddress);
                    DatabaseContext.SaveChanges();
                }
            }
            Response.Redirect("~/ConfirmCheckout.aspx");
        }
 private void SetAddresses(ref Address accountAddress, ref Address billingAddress, ref Address shippingAddress)
 {
     int UserId = Int32.Parse(Session["selectedUserValue"].ToString());
     var query = from c in DatabaseContext.Addresses where c.UserId == UserId select c;
     foreach (var n in query)
     {
         if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.PERSONAL)))
         {
             accountAddress = n;
         }
         else if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.BILLING)))
         {
             billingAddress = n;
         }
         else if (n.MultiAddressType.Equals(Enum.GetName(typeof(Enums.ADDRESS_TYPE), Enums.ADDRESS_TYPE.SHIPPING)))
         {
             shippingAddress = n;
         }
     }
 }
 /// <summary>
 /// Create a new Address object.
 /// </summary>
 /// <param name="addressID">Initial value of the AddressID property.</param>
 /// <param name="deleted">Initial value of the Deleted property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="sameAsCustomer">Initial value of the SameAsCustomer property.</param>
 /// <param name="sameAsBilling">Initial value of the SameAsBilling property.</param>
 /// <param name="multiAddressType">Initial value of the MultiAddressType property.</param>
 /// <param name="creationDate">Initial value of the CreationDate property.</param>
 public static Address CreateAddress(global::System.Int32 addressID, global::System.Boolean deleted, global::System.Int32 userId, global::System.Boolean sameAsCustomer, global::System.Boolean sameAsBilling, global::System.String multiAddressType, global::System.DateTime creationDate)
 {
     Address address = new Address();
     address.AddressID = addressID;
     address.Deleted = deleted;
     address.UserId = userId;
     address.SameAsCustomer = sameAsCustomer;
     address.SameAsBilling = sameAsBilling;
     address.MultiAddressType = multiAddressType;
     address.CreationDate = creationDate;
     return address;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAddresses(Address address)
 {
     base.AddObject("Addresses", address);
 }
 private Address fillAddressUser(User user, Enums.ADDRESS_TYPE addrType)
 {
     Address addr = new Address
     {
         Deleted = false,
         AddressFull = GetFullAddressCompanyTab(),
         AddressNo = CompanyTabAddressNo.Text,
         AddressLine1 = CompanyTabAddressLine1.Text,
         AddressLine2 = CompanyTabAddressLine2.Text,
         AddressLine3 = CompanyTabAddressLine3.Text,
         AddressLine4 = CompanyTabAddressLine4.Text,
         AddressLine5 = CompanyTabAddressLine5.Text,
         PostalCode = CompanyTabPostalCode.Text,
         Telephone1 = CompanyTabTelephone1.Text,
         Telephone2 = CompanyTabTelephone2.Text,
         Fax = CompanyTabFax.Text,
         Mobile = CompanyTabMobile.Text,
         Town = CompanyTabTown.Text,
         County = CompanyTabCounty.Text,
         Country = CompanyTabCountry.Text,
         UserId = user.UserID,
         SameAsCustomer = false,
         SameAsBilling = false,
         MultiAddressType = Enum.GetName(typeof(Enums.ADDRESS_TYPE), addrType),
         CreationDate = DateTime.Now,
         LastAmendmentDate = DateTime.Now,
         AddressName = null,
         CreatedBy = LoggedIsAdmin.UserID,
         LastAmendedBy = LoggedIsAdmin.UserID
     };
     return addr;
 }