Esempio n. 1
0
        public ActionResult CreateAddresss(AddressView addrView)
        {
            var postMethod = "Addresses";
            var personID   = addrView.Addr.person.id;
            var url        = _baseUrl + personID + postMethod;
            var xmlString  = new StringBuilder();

            // serialze address object to xml
            XmlWriter     writer = XmlWriter.Create(xmlString);
            XmlSerializer ser    = new XmlSerializer(typeof(Address));

            ser.Serialize(writer, addrView.Addr);

            try
            {
                // set up web request
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
                req.Method      = "POST";
                req.ContentType = "text/xml; encoding='utf-8'";

                //bytes = System.Text.Encoding.ASCII.GetBytes(v_objXm);

                //reqStream = req.GetRequestStream();



                return(RedirectToAction("Details/" + personID));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 2
0
    public List <AddressView> getAddressAll(int cust_id)
    {
        List <AddressView> addressList = new List <AddressView>();
        int address_id;


        string postal_code, address;
        string queryStr = "SELECT * FROM address WHERE cust_id = @cust_id Order By address_id";


        SqlConnection conn = new SqlConnection(_connStr);
        SqlCommand    cmd  = new SqlCommand(queryStr, conn);

        cmd.Parameters.AddWithValue("@cust_id", cust_id);
        conn.Open();
        SqlDataReader dr = cmd.ExecuteReader();

        while (dr.Read())
        {
            address_id  = Convert.ToInt32(dr["address_id"].ToString());
            postal_code = dr["postal_code"].ToString();
            address     = dr["address"].ToString();

            AddressView a = new AddressView(address_id, postal_code, address, cust_id);
            addressList.Add(a);
        }
        conn.Close();
        dr.Close();
        dr.Dispose();
        return(addressList);
    }
Esempio n. 3
0
        public AddressViewModel(AddressView addressView)
        {
            this.addressView = addressView;

            Address address = new Address("2 rue des pouet", 35410, "Nouvoitou", "FR");

            this.addressView.addressUserControl.Address = address;
        }
    protected void gv_ViewAddress_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int         result     = 0;
        AddressView addr       = new AddressView();
        string      categoryID = gv_ViewAddress.DataKeys[e.RowIndex].Value.ToString();

        result = addr.AddressDelete(categoryID);

        Response.Redirect("CustomerAddressView.aspx");
    }
Esempio n. 5
0
 public static void SetTo(this AddressView view, Address model)
 {
     Mapper.Map(view, model);
 }
Esempio n. 6
0
 public static Address ToModel(this AddressView view)
 {
     return(Mapper.Map <Address>(view));
 }
        public ActionResult Create(AddressView addrView)
        {
            var    postMethod = "/Addresses";
            var    personID   = addrView.Addr.person.id;
            var    url        = _baseUrl + personID + postMethod;
            string xmlString;


            // serialze address object to xml
            //XmlWriter writer = XmlWriter.Create(xmlString);
            //XmlWriter writer =
            XmlSerializer ser = new XmlSerializer(typeof(Address));
            //ser.Serialize(writer, addrView.Addr);

            MemoryStream stream = new MemoryStream();

            ser.Serialize(stream, addrView.Addr);
            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            xmlString = reader.ReadToEnd();
            reader.Close();

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

            req.Accept = "application/xml";

            byte[] bArray = Encoding.UTF8.GetBytes(xmlString);

            req.Method        = "POST";
            req.ContentLength = bArray.Length;
            req.ContentType   = "application/xml; charset=utf-8";

            Stream requestStream = req.GetRequestStream();

            requestStream.Write(bArray, 0, bArray.Length);
            requestStream.Close();
            HttpWebResponse res            = req.GetResponse() as HttpWebResponse;
            Stream          responseStream = res.GetResponseStream();

            //StreamReader sr = new StreamReader(responseStream);
            //string str = sr.ReadToEnd();
            //sr.Close();


            //try
            //{

            //string content = ser.Serialize(

            // set up serialized stream

            /*
             * // set up web request
             * HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
             * req.Method = "POST";
             * req.ContentType = "application/xml;charset=utf-8";
             * req.ContentLength = stream.GetBuffer().Count();
             *
             * stream = (MemoryStream) req.GetRequestStream();
             * ser.Serialize(stream, addrView.Addr);
             * stream.Close();
             * //write
             * //XmlWriter writer = XmlWriter.Create(req.GetRequestStream());
             * //XmlWriter writer = new XmlTextWriter(req.GetRequestStream(), System.Text.Encoding.UTF8);
             * //ser.Serialize(writer, addrView.Addr);
             * //req.ContentLength = ser
             * //StreamWriter sWriter = new StreamWriter(req.GetRequestStream());
             * ////sWriter.WriteLine(writer.ToString());
             * //sWriter.Close();
             * //writer.Close();
             */


            //HttpWebResponse resp = (HttpWebResponse) req.GetResponse();

            if (res.StatusCode != HttpStatusCode.OK && res.StatusCode != HttpStatusCode.Created)
            {
                throw new HttpException((int)res.StatusCode, res.StatusDescription);
            }

            //bytes = System.Text.Encoding.ASCII.GetBytes(v_objXm);

            //reqStream = req.GetRequestStream();



            return(RedirectToAction("Details", "Person", new { id = personID }));

            //}
            //catch
            //{
            return(View());
            //}
        }
Esempio n. 8
0
        void ReleaseDesignerOutlets()
        {
            if (AddressView != null)
            {
                AddressView.Dispose();
                AddressView = null;
            }

            if (btnAvailableProducts != null)
            {
                btnAvailableProducts.Dispose();
                btnAvailableProducts = null;
            }

            if (btnBack != null)
            {
                btnBack.Dispose();
                btnBack = null;
            }

            if (btnChat != null)
            {
                btnChat.Dispose();
                btnChat = null;
            }

            if (btnReportProvider != null)
            {
                btnReportProvider.Dispose();
                btnReportProvider = null;
            }

            if (btnReviewbyOther != null)
            {
                btnReviewbyOther.Dispose();
                btnReviewbyOther = null;
            }

            if (divider1 != null)
            {
                divider1.Dispose();
                divider1 = null;
            }

            if (EmailView != null)
            {
                EmailView.Dispose();
                EmailView = null;
            }

            if (HeaderView != null)
            {
                HeaderView.Dispose();
                HeaderView = null;
            }

            if (iconEnvelop != null)
            {
                iconEnvelop.Dispose();
                iconEnvelop = null;
            }

            if (lblAddress != null)
            {
                lblAddress.Dispose();
                lblAddress = null;
            }

            if (lblEmailId != null)
            {
                lblEmailId.Dispose();
                lblEmailId = null;
            }

            if (lblProviderMobileNo != null)
            {
                lblProviderMobileNo.Dispose();
                lblProviderMobileNo = null;
            }

            if (lblProviderName != null)
            {
                lblProviderName.Dispose();
                lblProviderName = null;
            }

            if (lblTitle != null)
            {
                lblTitle.Dispose();
                lblTitle = null;
            }

            if (MarkerIcon != null)
            {
                MarkerIcon.Dispose();
                MarkerIcon = null;
            }

            if (ProviderDisplayPicture != null)
            {
                ProviderDisplayPicture.Dispose();
                ProviderDisplayPicture = null;
            }

            if (ProviderProfileView != null)
            {
                ProviderProfileView.Dispose();
                ProviderProfileView = null;
            }

            if (ProviderWallPicture != null)
            {
                ProviderWallPicture.Dispose();
                ProviderWallPicture = null;
            }
        }
Esempio n. 9
0
        public void GetSingleAddress()
        {
            AddressView result = _client.GetAddress("0268200000075156");

            Assert.IsNotNull(result);
        }