public static void Thongtincuahang_Update(Thongtincuahang ttch)
 {
     ThongtincuahangDAO.Update(ttch);
 }
Exemple #2
0
    protected void btn_thongtincuahang_sua_Click(object sender, EventArgs e)
    {
        Thongtincuahang ttch = new Thongtincuahang();
        ttch.Diachi = txt_thongtincuahang_diachi.Text;
        ttch.Email = txt_thongtincuahang_email.Text;
        ttch.Sdt = txt_thongtincuahang_sdt.Text;
        ttch.Kinhdo = txt_thongtincuahang_kinhdo.Text;
        ttch.Vido = txt_thongtincuahang_vido.Text;

        try
        {
            ThongtincuahangBUS.Thongtincuahang_Update(ttch);

            string mapcontent = "var myCenter = new google.maps.LatLng(" + ttch.Kinhdo + ", " + ttch.Vido + ");function initialize() {var mapProp = {center: myCenter,zoom: 16,mapTypeId: google.maps.MapTypeId.ROADMAP};var map = new google.maps.Map(document.getElementById('plugin-map'), mapProp);var marker = new google.maps.Marker({position: myCenter,});marker.setMap(map);}google.maps.event.addDomListener(window, 'load', initialize);";
            if (File.Exists(Server.MapPath("~/script/") + "google-map.js"))
            {
                File.Delete(Server.MapPath("~/script/") + "google-map.js");
                using (StreamWriter sw = File.CreateText(Server.MapPath("~/script/") + "google-map.js"))
                {
                    sw.Write(mapcontent);
                }
            }
            else
            {
                using (StreamWriter sw = File.CreateText(Server.MapPath("~/script/") + "google-map.js"))
                {
                    sw.Write(mapcontent);
                }
            }

            Response.Write("<script>alert('Cập nhật thành công')</script>");
        }
        catch (Exception)
        {
            Response.Write("<script>alert('Cập nhật thất bại')</script>");
        }
    }