Exemple #1
0
        public ActionResult AddAddress(addresses addr)
        {
            try
            {
                List <object> list = new List <object>();
                list.Add(addr.CustID);
                list.Add(addr.Add_Type);
                list.Add(addr.del_Address);

                return(View());
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        public IActionResult CreateAddress(addressViewModel newAdd)
        {
            int?id = HttpContext.Session.GetInt32("Id");

            if (ModelState.IsValid)
            {
                addresses newAddress = new addresses()
                {
                    usersid    = (int)id,
                    address    = newAdd.address,
                    apt        = newAdd.apt,
                    zipcode    = newAdd.zipcode,
                    city       = newAdd.city,
                    state      = newAdd.state,
                    created_at = DateTime.Now,
                    updated_at = DateTime.Now
                };
                _context.Add(newAddress);
                _context.SaveChanges();
                return(RedirectToAction("UpdateInfo"));
            }
            return(View("createaddress"));
        }
 // create remote endpoint
 CreateRemoteEndPoint(addresses, port);
Exemple #4
0
        /// <summary>
        /// Gets the nav person.
        /// </summary>
        /// <param name="xmlDoc">The XML document.</param>
        /// <returns></returns>
        public static List <person> GetNAVPerson(XDocument xmlDoc)
        {
            List <person> personObj = new List <person>();
            //Fetch the elements
            IEnumerable <XElement> xelementList = xmlDoc.Descendants(Constants.PersonNode);

            //TODO: multiple person
            if (xelementList != null)
            {
                //Read the element value into person object
                personObj = (from b in xelementList
                             select new person
                {
                    personGuid = b.Element(Constants.PersonGuid) != null ? b.Element(Constants.PersonGuid).Value : null,
                    masterGuid = b.Element(Constants.MasterGuid) != null ? b.Element(Constants.MasterGuid).Value : null,
                    personId = b.Element(Constants.PersonId) != null ? b.Element(Constants.PersonId).Value : null,
                    firstName = b.Element(Constants.FirstName) != null ? b.Element(Constants.FirstName).Value : null,
                    lastName = b.Element(Constants.LastName) != null ? b.Element(Constants.LastName).Value : null,
                    title = b.Element(Constants.Title) != null ? b.Element(Constants.Title).Value : null,
                    messageCreatedDate = b.Attribute(Constants.MessageCreatedDate) != null ? b.Attribute(Constants.MessageCreatedDate).Value : null,
                    messageType = b.Attribute(Constants.MessageType) != null ? b.Attribute(Constants.MessageType).Value : null,
                    sender = b.Attribute(Constants.Sender) != null ? b.Attribute(Constants.Sender).Value : null,
                    originator = b.Attribute(Constants.Originator) != null ? b.Attribute(Constants.Originator).Value : null,
                }).ToList();

                foreach (person personData in personObj)
                {
                    //this is done as the person xml sent from person service do not have a value for originator. A work around for empty originator from person service
                    if (string.IsNullOrEmpty(personData.originator))
                    {
                        personData.originator = ConfigurationManager.AppSettings[Constants.DefaultOriginator];
                    }
                    //generate list of emails, phones and addresses
                    List <emails>    emailList   = new List <emails>();
                    List <addresses> addressList = new List <addresses>();
                    List <phones>    phoneList   = new List <phones>();

                    //Fetch the emails node content
                    IEnumerable <XElement> emailsElementList = xelementList.Elements(Constants.Emails);
                    if (emailsElementList != null && emailsElementList.Count() > 0)
                    {
                        //Fetch the email node from the emails element list
                        IEnumerable <XElement> emailElement = emailsElementList.Elements(Constants.Email);
                        if (emailElement != null && emailElement.Count() > 0)
                        {
                            //Read the Type and address of each email into the emails list
                            foreach (XElement email in emailElement)
                            {
                                email        mail       = new email();
                                List <email> emailsList = new List <email>();
                                emails       emails     = new emails();

                                mail.type = email.Attribute(Constants.Type) != null?email.Attribute(Constants.Type).Value : null;

                                mail.address = email.Attribute(Constants.Address) != null?email.Attribute(Constants.Address).Value : null;

                                emailsList.Add(mail);
                                emails.email = emailsList.ToArray();
                                emailList.Add(emails);
                            }
                            emails[] emailArray = emailList.ToArray();
                            personData.emails = emailArray;
                        }
                    }

                    //Fetch the addresses node content
                    IEnumerable <XElement> addressesElementList = xelementList.Elements(Constants.Addresses);
                    if (addressesElementList != null && addressesElementList.Count() > 0)
                    {
                        //Fetch the address node from the addresses element list
                        IEnumerable <XElement> addressElement = addressesElementList.Elements(Constants.Address);
                        if (addressElement != null && addressElement.Count() > 0)
                        {
                            foreach (XElement addressDetail in addressElement)
                            {
                                address        addressObj    = new address();
                                List <address> addressesList = new List <address>();
                                addresses      addressesObj  = new addresses();

                                addressObj.number = addressDetail.Attribute(Constants.Number) != null?addressDetail.Attribute(Constants.Number).Value : null;

                                addressObj.id = addressDetail.Attribute(Constants.ID) != null?addressDetail.Attribute(Constants.ID).Value : null;

                                addressObj.type = addressDetail.Attribute(Constants.Type) != null?addressDetail.Attribute(Constants.Type).Value : null;

                                addressObj.shipToName = addressDetail.Attribute(Constants.ShipToName) != null?addressDetail.Attribute(Constants.ShipToName).Value : null;

                                addressObj.isPrimary = addressDetail.Attribute(Constants.IsPrimary) != null?addressDetail.Attribute(Constants.IsPrimary).Value : null;

                                addressObj.companyName = addressDetail.Element(Constants.CompanyName) != null?addressDetail.Element(Constants.CompanyName).Value : null;

                                addressObj.country = addressDetail.Element(Constants.Country) != null?addressDetail.Element(Constants.Country).Value : null;

                                addressObj.city = addressDetail.Element(Constants.City) != null?addressDetail.Element(Constants.City).Value : null;

                                addressObj.line1 = addressDetail.Element(Constants.Line1) != null?addressDetail.Element(Constants.Line1).Value : null;

                                addressObj.line2 = addressDetail.Element(Constants.Line2) != null?addressDetail.Element(Constants.Line2).Value : null;

                                addressObj.line3 = addressDetail.Element(Constants.Line3) != null?addressDetail.Element(Constants.Line3).Value : null;

                                addressObj.regionCode = addressDetail.Element(Constants.RegionCode) != null?addressDetail.Element(Constants.RegionCode).Value : null;

                                addressObj.postalCode = addressDetail.Element(Constants.PostalCode) != null?addressDetail.Element(Constants.PostalCode).Value : null;

                                addressesList.Add(addressObj);
                                addressesObj.address = addressesList.ToArray();

                                addressList.Add(addressesObj);
                            }
                            addresses[] addressArray = addressList.ToArray();
                            personData.addresses = addressArray;
                        }
                    }
                    //Fetch the phones node content
                    IEnumerable <XElement> phonesElementList = xelementList.Elements(Constants.Phones);
                    if (phonesElementList != null && phonesElementList.Count() > 0)
                    {
                        //Fetch the phone node from the phones element list
                        IEnumerable <XElement> phoneElement = phonesElementList.Elements(Constants.Phone);
                        if (phoneElement != null && phoneElement.Count() > 0)
                        {
                            foreach (XElement phoneDetail in phoneElement)
                            {
                                phone        phoneObj   = new phone();
                                phones       phonesObj  = new phones();
                                List <phone> phonesList = new List <phone>();

                                phoneObj.number = phoneDetail.Attribute(Constants.Number).Value;
                                phoneObj.type   = phoneDetail.Attribute(Constants.Type).Value;


                                phonesList.Add(phoneObj);
                                phonesObj.phone = phonesList.ToArray();
                                phoneList.Add(phonesObj);
                            }
                            phones[] phoneArray = phoneList.ToArray();
                            personData.phones = phoneArray;
                        }
                    }
                }
            }
            return(personObj);
        }