示例#1
0
        public string AddNewShippingAddress(int CustomerId, string Firstname, string Lastname, string Email, int Phone, string flat, string street, string landmark, int CountryId, string AreaId)
        {
            List <Nullable <decimal> > obj = new List <Nullable <decimal> >();

            string[] arr = new string[4];
            arr[1] = flat;
            arr[2] = street;
            arr[3] = landmark;
            Common.AddressAttributeValue objC;
            Common.AddressAttribute      objAddAttr;

            Common.Attributes objAttr = new Common.Attributes();
            List <Common.AddressAttribute> objList = new List <Common.AddressAttribute>();

            for (int i = 1; i < 4; i++)
            {
                objC          = new Common.AddressAttributeValue();
                objC.Value    = arr[i];
                objAddAttr    = new Common.AddressAttribute();
                objAddAttr.ID = i.ToString();
                objAddAttr.AddressAttributeValue = objC;

                objList.Add(objAddAttr);
            }
            string ser = SerializeXml.SerializeObject(objList);

            ser = ser.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n", "").
                  Replace("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", "").
                  Replace("  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"", "");

            using (var entities = new SedapExpressEntities())
            {
                obj = entities.AddNewShippingAddress(CustomerId, Firstname, Lastname, Email, Phone, ser, CountryId, AreaId).ToList <Nullable <decimal> >();
            }

            return(JsonConvert.SerializeObject(obj));
        }