public DataTable getCMSImage(string hotelID)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();
        imageDBEntity.HotelID = hotelID;
        _imageEntity.ImageDBEntity.Add(imageDBEntity);
        return ImageBP.GetImageByHotelID(_imageEntity);
    }
    private void Renew(string[] ids, string[] orders, string[] types, string[] hotelID)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();

        for (int i = 0; i < orders.Length; i++)
        {
            //if (types[0] == "sortable1")
            //{
            //    imageDBEntity.HotelID = hotelID[0].ToString();
            //    _imageEntity.ImageDBEntity.Add(imageDBEntity);
            //    ImageBP.UpdateSupImageDetailsByID(_imageEntity);// 将原封面图  取消

            //    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
            //    imageDBEntity = new ImageDBEntity();
            //    imageDBEntity.Id = orders[0].ToString();
            //    imageDBEntity.IsCover = "1";
            //    imageDBEntity.Seq = 0;

            //    _imageEntity.ImageDBEntity.Add(imageDBEntity);
            //    ImageBP.RenewSupCoverImageByID(_imageEntity);
            //}
            //else
            //{
            //    imageDBEntity.Id = orders[i].ToString();
            //    imageDBEntity.Seq = i;
            //    imageDBEntity.IsCover = "0";
            //    _imageEntity.ImageDBEntity.Add(imageDBEntity);
            //    ImageBP.RenewSupImageByID(_imageEntity);
            //}
            if (types[0] == "sortable1")
            {
                if (orders[i].ToString() != "-1")
                {
                    imageDBEntity.HotelID = hotelID[0].ToString();
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateSupImageDetailsByID(_imageEntity);// 将原封面图  取消

                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                    imageDBEntity.Id = orders[i].ToString();
                    imageDBEntity.IsCover = "1";
                    imageDBEntity.Seq = 0;

                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.RenewSupCoverImageByID(_imageEntity);
                    return;
                }
                else
                {
                    imageDBEntity.HotelID = hotelID[0].ToString();
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateSupImageDetailsByID(_imageEntity);// 将原封面图  取消
                }
            }
            else
            {
                imageDBEntity.Id = orders[i].ToString();
                imageDBEntity.Seq = i;
                imageDBEntity.IsCover = "0";
                _imageEntity.ImageDBEntity.Add(imageDBEntity);
                ImageBP.RenewSupImageByID(_imageEntity);
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        string hotelId = Request.QueryString["hotelId"].ToString();

        string Answer = this.HiddenAnswer.Value;
        string[] strAnswer = Answer.Split('|');
        for (int i = 0; i < strAnswer.Length; i++)
        {
            if (!string.IsNullOrEmpty(strAnswer[i]))
            {
                _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                ImageDBEntity imageDBEntity = new ImageDBEntity();

                string[] strAnswerChild = strAnswer[i].Split(',');

                string CoverPic = strAnswerChild[0].Split('&')[1].ToString();//封面图
                //http://hotelvp.qiniudn.com/hotels/Shanghai/10003/8603413e9d1fa4a1.jpg?imageView/1/w/100/h/75
                string ImgSrc = strAnswerChild[1].Split('&')[1].ToString();//图片路径

                string fileName = strAnswerChild[2].Split('&')[1].ToString();//图片名称

                string picTypeValue = strAnswerChild[3].Split('&')[1].ToString();//1房型图片、2酒店外观、3促销图片、4酒店大堂、5餐饮娱乐、6酒店图标、7其他

                string roomTypevalue = strAnswerChild[4].Split('&')[1].ToString();//房型Code

                string htpPathBak = strAnswerChild[5].Split('&')[1].ToString();//房型Code

                //清除酒店现有封面图
                if (CoverPic == "true")
                {
                    imageDBEntity.HotelID = hotelId;
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateSupImageDetailsByID(_imageEntity);
                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                }
                //设置当前图片信息
                imageDBEntity.ImgType = picTypeValue;
                imageDBEntity.HtpPath = ImgSrc;
                imageDBEntity.Source = "HOTELVP";
                imageDBEntity.IsCover = CoverPic == "true" ? "1" : "0";
                imageDBEntity.HotelID = hotelId;
                //imageDBEntity.RoomTypeCode = roomTypevalue;
                imageDBEntity.HtpPathBak = htpPathBak;
                imageDBEntity.CreateTime = System.DateTime.Now;
                _imageEntity.ImageDBEntity.Add(imageDBEntity);
                int TImageID = ImageBP.TSupImageCheckInsert(_imageEntity);
                //如果为房型图   入T_Room表
                if (picTypeValue == "1")
                {
                    //判断当前酒店 当前房型是否已设置房型图片
                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                    imageDBEntity.HotelID = hotelId;
                    imageDBEntity.RoomTypeCode = roomTypevalue;
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    DataTable dtImageID = ImageBP.SelectTRoomImageIDByHotelID(_imageEntity);
                    if (dtImageID.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(dtImageID.Rows[0]["IMAGE_ID"].ToString()))
                        {
                            _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                            imageDBEntity = new ImageDBEntity();
                            imageDBEntity.Id = dtImageID.Rows[0]["IMAGE_ID"].ToString();
                            imageDBEntity.ImgType = "7";
                            imageDBEntity.IsCover = "0";
                            _imageEntity.ImageDBEntity.Add(imageDBEntity);
                            ImageBP.UpdateSupImageDetailsRepeatByID(_imageEntity);
                            _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                            imageDBEntity = new ImageDBEntity();
                        }
                    }

                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                    imageDBEntity.Id = TImageID.ToString();
                    imageDBEntity.HotelID = hotelId;
                    imageDBEntity.RoomTypeCode = roomTypevalue;
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateTRoomByHotelID(_imageEntity);
                }

                //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "window.opener.location.reload();window.opener=null;window.close();", true);

            }
        }

        if (Request.Params["flag"] != null && Request.Params["flag"].ToString() == "true")
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "window.opener.document.getElementById('MainContent_btnRefresh').click();;window.opener=null;window.close();", true);
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "window.opener.document.getElementById('btnRefresh').click();;window.opener=null;window.close();", true);
        }
    }
    private void DeletePic(string id)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();
        imageDBEntity.Id = id;
        imageDBEntity.HotelID = this.HidHotelID.Value;
        _imageEntity.ImageDBEntity.Add(imageDBEntity);
        ImageBP.DeleteSupImageByID(_imageEntity);
    }
    public void RenewSeq(string[] ids, string[] orders, string[] types, string[] hotelID)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();
        for (int i = 0; i < orders.Length; i++)
        {
            imageDBEntity.Id = orders[i].ToString();
            imageDBEntity.Seq = i;
            imageDBEntity.IsCover = "0";
            _imageEntity.ImageDBEntity.Add(imageDBEntity);
            ImageBP.RenewSupImageByID(_imageEntity);
        }
        HotelInfoSA.RefushHotelList(this.HidHotelID.Value);
    }
    public void BindPic(string type)
    {
        //detailMessageContent.InnerHtml = "";
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();
        //if (type == "1")
        //    imageDBEntity.HotelID = HidHotelID.Value;
        //else
        //    imageDBEntity.HotelID = Session["hotelID"].ToString();

        imageDBEntity.HotelID = HidHotelID.Value;

        _imageEntity.ImageDBEntity.Add(imageDBEntity);
        DataTable dtPic = ImageBP.GetSupImageByHotelID(_imageEntity).Tables[0];

        if (dtPic.Rows.Count > 0)
        {
            string dtCoverPicIds = "";
            StringBuilder sbCoverPic = new StringBuilder();
            //IS_COVER   0:普通图片 1:封面图
            //DataRow[] dtCoverPic = dtPic.Select("IS_COVER='1'");//所有封面图
            DataRow[] dtCoverPic = dtPic.Select("IS_COVER='1'");//所有封面图
            sbCoverPic.Append("<ul><li class=\"title\">封面图片</li><li>");
            sbCoverPic.Append("<ul id=\"sortable1\" class=\"connectedSortable\">");

            ////新增
            if (dtCoverPic.Length > 0)
            {
                sbCoverPic.Append("<li class=\"ui-state-default\" id=\"specialID\" runat=\"server\" title=\"-1\" style=\"width: 1px; border-width: 0px; background-color: White; border-color: White; margin-left: 0px; margin-right: 0px; padding: 0px; margin-bottom: 0px;\">");
                sbCoverPic.Append("<div style=\"width: 1px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\">");
                sbCoverPic.Append("</div>");
                sbCoverPic.Append("</li>");
            }
            else
            {
                sbCoverPic.Append("<li class=\"ui-state-default\" id=\"specialID\" runat=\"server\" title=\"-1\" style=\"width: 1px; border-width: 0px; background-color: White; border-color: White; margin-left: 200px; margin-right: 0px; padding: 0px; margin-bottom: 0px;\">");
                sbCoverPic.Append("<div style=\"width: 1px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\">");
                sbCoverPic.Append("</div>");
                sbCoverPic.Append("</li>");
            }
            //以上新增

            for (int i = 0; i < dtCoverPic.Length; i++)
            {
                dtCoverPicIds += dtCoverPic[i]["ID"].ToString() + ",";
                sbCoverPic.Append("<li class=\"ui-state-default\" title=\"" + dtCoverPic[i]["ID"].ToString() + "\">");
                //sbCoverPic.Append("<img src=\"" + dtCoverPic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" />" + dtCoverPic[i]["ID"].ToString() + "");

                sbCoverPic.Append("<div style=\"width: 120px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\">");
                sbCoverPic.Append("<div style=\"position: absolute; top: -5px; right: -5px;border: 0px;\">");
                sbCoverPic.Append("<img src=\"../../Styles/images/delete.png\" style=\"border: 0px;\" onclick=\"deletePic(" + dtCoverPic[i]["ID"].ToString() + ")\" />");
                sbCoverPic.Append("</div><img src=\"" + dtCoverPic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" /></div>");
                sbCoverPic.Append("<span style=\"font-size:small;\">" + dtCoverPic[i]["IMG_TYPE"].ToString().Replace("0", "其他图片").Replace("1", "房型图片").Replace("2", "酒店外观").Replace("3", "促销图片").Replace("4", "酒店大堂").Replace("5", "餐饮娱乐").Replace("6", "酒店图标").Replace("7", "其他图片") + "</span>");
                sbCoverPic.Append("<a onclick=\"updatePic(" + dtCoverPic[i]["ID"].ToString() + "," + dtCoverPic[i]["HOTEL_ID"].ToString() + ")\" style=\"font-size:small;float:right;cursor:pointer\">[编辑]</a></div>");

                sbCoverPic.Append("</li>");
            }
            sbCoverPic.Append("</ul></li></ul>");
            dtCoverPicDiv.InnerHtml = sbCoverPic.ToString();
            dtCoverPicIds = dtCoverPicIds.TrimEnd(',');
            HidCoverPicIds.Value = dtCoverPicIds;

            //所有酒店图片
            string dtHotelPicIds = "";
            StringBuilder sbHotelPic = new StringBuilder();
            DataRow[] dtHotelPic = dtPic.Select("IMG_TYPE<>'1' and IS_COVER<>'1'");
            sbHotelPic.Append("<ul><li class=\"title\">酒店图片</li><li>");
            sbHotelPic.Append("<ul id=\"sortable2\" class=\"connectedSortable\">");

            ////新增
            if (dtHotelPic.Length > 0)
            {
                sbHotelPic.Append("<li class=\"ui-state-default\" id=\"specialID2\" runat=\"server\" title=\"-1\" style=\"width: 1px; border-width: 0px; background-color: White; border-color: White; margin-left: 0px; margin-right: 0px; padding: 0px; margin-bottom: 0px;\">");
                sbHotelPic.Append("<div style=\"width: 1px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\">");
                sbHotelPic.Append("</div>");
                sbHotelPic.Append("</li>");
            }
            else
            {
                sbHotelPic.Append("<li class=\"ui-state-default\" id=\"specialID2\" runat=\"server\" title=\"-1\" style=\"width: 1px; border-width: 0px; background-color: White; border-color: White; margin-left: 200px; margin-right: 0px; padding: 0px; margin-bottom: 0px;\">");
                sbHotelPic.Append("<div style=\"width: 1px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\">");
                sbHotelPic.Append("</div>");
                sbHotelPic.Append("</li>");
            }
            //以上新增

            for (int i = 0; i < dtHotelPic.Length; i++)
            {
                dtHotelPicIds += dtHotelPic[i]["ID"].ToString() + ",";
                sbHotelPic.Append("<li class=\"ui-state-default\" title=\"" + dtHotelPic[i]["ID"].ToString() + "\">");
                //sbHotelPic.Append("<img src=\"" + dtHotelPic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" /><br/>" + dtHotelPic[i]["IMG_TYPE"].ToString().Replace("0", "请选择").Replace("1", "房型图片").Replace("2", "酒店外观").Replace("3", "促销图片").Replace("4", "酒店大堂").Replace("5", "餐饮娱乐").Replace("6", "酒店图标").Replace("7", "其他") + "");
                //sbHotelPic.Append("<img src=\"" + dtHotelPic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" /><br/>" + dtHotelPic[i]["ID"].ToString() + "");
                sbHotelPic.Append("<div style=\"width: 120px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\" >");
                sbHotelPic.Append("<div style=\"position: absolute; top: -5px; right: -5px;border: 0px;\">");
                sbHotelPic.Append("<img src=\"../../Styles/images/delete.png\" style=\"border: 0px;\" onclick=\"deletePic(" + dtHotelPic[i]["ID"].ToString() + ")\" />");
                sbHotelPic.Append("</div><img src=\"" + dtHotelPic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" />");
                //sbHotelPic.Append(dtHotelPic[i]["IMG_TYPE"].ToString().Replace("0", "其他图片").Replace("1", "房型图片").Replace("2", "酒店外观").Replace("3", "促销图片").Replace("4", "酒店大堂").Replace("5", "餐饮娱乐").Replace("6", "酒店图标").Replace("7", "其他图片"));
                sbHotelPic.Append("<span style=\"font-size:small;\">" + dtHotelPic[i]["IMG_TYPE"].ToString().Replace("0", "其他图片").Replace("1", "房型图片").Replace("2", "酒店外观").Replace("3", "促销图片").Replace("4", "酒店大堂").Replace("5", "餐饮娱乐").Replace("6", "酒店图标").Replace("7", "其他图片") + "</span>");
                sbHotelPic.Append("<a onclick=\"updatePic(" + dtHotelPic[i]["ID"].ToString() + "," + dtHotelPic[i]["HOTEL_ID"].ToString() + ")\" style=\"font-size:small;float:right;cursor:pointer\">[编辑]</a></div>");

                sbHotelPic.Append("</li>");
            }
            sbHotelPic.Append("</ul></li></ul>");
            dtHotelPicDiv.InnerHtml = sbHotelPic.ToString();
            dtHotelPicIds = dtHotelPicIds.TrimEnd(',');
            HidHotelPicIds.Value = dtHotelPicIds;

            //所有房型图片
            //IMG_TYPE   1房型图片、2酒店外观、3促销图片、4酒店大堂、5餐饮娱乐、6酒店图标、7其他
            string roomTypeName = "";
            string dtRoomTypePicIds = "";
            DataSet dsRoomList = GetRoomNameByHotelID(HidHotelID.Value);
            StringBuilder sbRoomTypePic = new StringBuilder();
            //DataRow[] dtRoomTypePic = dtPic.Select("IMG_TYPE='1'");
            DataRow[] dtRoomTypePic = dtPic.Select("IMG_TYPE='1'");
            sbRoomTypePic.Append("<ul><li class=\"title\">房型图片</li><li>");
            sbRoomTypePic.Append("<ul id=\"sortable3\" class=\"connectedSortable\">");
            for (int i = 0; i < dtRoomTypePic.Length; i++)
            {
                dtRoomTypePicIds += dtRoomTypePic[i]["ID"].ToString() + ",";
                sbRoomTypePic.Append("<li class=\"ui-state-default\" title=\"" + dtRoomTypePic[i]["ID"].ToString() + "\">");

                //if (dsRoomList.Tables.Count > 0 && dsRoomList.Tables[0].Rows.Count > 0)
                //{
                //    for (int j = 0; j < dsRoomList.Tables[0].Rows.Count; j++)
                //    {
                //        if (dsRoomList.Tables[0].Rows[j]["ROOMCD"].ToString() == dtRoomTypePic[i]["ROOM_TYPE_CODE"].ToString())
                //        {
                //            roomTypeName = dsRoomList.Tables[0].Rows[j]["ROOMNM"].ToString();
                //        }
                //    }
                //}

                //sbRoomTypePic.Append("<img src=\"" + dtRoomTypePic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" /><br/>" + roomTypeName + "");
                //sbRoomTypePic.Append("<img src=\"" + dtRoomTypePic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" /><br/>" + dtRoomTypePic[i]["ID"].ToString() + "");
                sbRoomTypePic.Append("<div style=\"width: 120px; height: 90px; position: relative; border: 0px;background-repeat: no-repeat;\" >");
                sbRoomTypePic.Append("<div style=\"position: absolute; top: -5px; right: -5px;border: 0px;\">");
                sbRoomTypePic.Append("<img src=\"../../Styles/images/delete.png\" style=\"border: 0px;\" onclick=\"deletePic(" + dtRoomTypePic[i]["ID"].ToString() + ")\" />");
                sbRoomTypePic.Append("</div><img src=\"" + dtRoomTypePic[i]["HTP_PATH"].ToString() + "\" width=\"120\" height=\"90\" />");
                //sbRoomTypePic.Append("<span style=\"font-size:small;margin-top:5px;\">" + roomTypeName + "</span>");
                sbRoomTypePic.Append("<span style=\"font-size:small;margin-top:5px;\">" + dtRoomTypePic[i]["ROOM_NAME"].ToString() + "</span>");
                sbRoomTypePic.Append("<a onclick=\"updatePic(" + dtRoomTypePic[i]["ID"].ToString() + "," + dtRoomTypePic[i]["HOTEL_ID"].ToString() + ")\" style=\"font-size:small;float:right;cursor:pointer\">[编辑]</a></div>");

                sbRoomTypePic.Append("</li>");
            }
            sbRoomTypePic.Append("</ul></li></ul>");
            dtRoomTypePicDiv.InnerHtml = sbRoomTypePic.ToString();
            dtRoomTypePicIds = dtRoomTypePicIds.TrimEnd(',');
            HidRoomTypePicIds.Value = dtRoomTypePicIds;

            dtCoverPicDiv.Attributes["style"] = "margin: 15px 14px 15px 14px;display:''";
            dtHotelPicDiv.Attributes["style"] = "margin: 15px 14px 15px 14px;display:''";
            dtRoomTypePicDiv.Attributes["style"] = "margin: 15px 14px 15px 14px;display:''";

        }
        else
        {
            dtCoverPicDiv.InnerHtml = "";
            dtCoverPicDiv.Attributes.Add("style", "margin: 15px 14px 15px 14px;display:none");
            dtHotelPicDiv.InnerHtml = "";
            dtHotelPicDiv.Attributes.Add("style", "margin: 15px 14px 15px 14px;display:none");
            dtRoomTypePicDiv.InnerHtml = "";
            dtRoomTypePicDiv.Attributes.Add("style", "margin: 15px 14px 15px 14px;display:none");

            //detailMessageContent.InnerHtml = "当前酒店无图片!!!";
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string hotelId = Request.QueryString["hotelId"] == null ? "" : Request.QueryString["hotelId"].ToString();
        string id = Request.QueryString["id"] == null ? "" : Request.QueryString["id"].ToString();
        string picType = this.ddlPicType.Value;
        string roomCode = this.ddlRoomList.SelectedValue;

        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();

        if (this.chkCover.Checked)
        {
            //原来的封面图片会自动变成普通酒店图片
            imageDBEntity.HotelID = HidHotelID.Value;
            _imageEntity.ImageDBEntity.Add(imageDBEntity);
            ImageBP.UpdateSupImageDetailsByID(_imageEntity);// 将原封面图  取消
            _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
            imageDBEntity = new ImageDBEntity();
            imageDBEntity.IsCover = "1";
        }

        if (this.HidIsRoomType.Value == "1")
        {
            //清除原来房型图和Room的关联
            imageDBEntity.HotelID = hotelId;
            imageDBEntity.RoomTypeCode = this.HidRoomCode.Value;
            _imageEntity.ImageDBEntity.Add(imageDBEntity);
            DataTable dtImageID = ImageBP.SelectTRoomImageIDByHotelID(_imageEntity);
            if (dtImageID.Rows.Count > 0)
            {
                if (!string.IsNullOrEmpty(dtImageID.Rows[0]["IMAGE_ID"].ToString()))
                {
                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                    imageDBEntity.Id = "";
                    imageDBEntity.HotelID = hotelId;
                    imageDBEntity.RoomTypeCode = this.HidRoomCode.Value;
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateTRoomByHotelID(_imageEntity);
                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                }
            }
        }

        //重新设置图片信息
        imageDBEntity.Id = id;
        imageDBEntity.ImgType = picType;
        imageDBEntity.IsCover = this.chkCover.Checked == true ? "1" : "0";
        _imageEntity.ImageDBEntity.Add(imageDBEntity);
        ImageBP.UpdateSupImageDetailsRepeatByID(_imageEntity);
        if (picType == "1")
        {
            _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
            imageDBEntity = new ImageDBEntity();
            //将原来的房型图片 ImageType改为普通酒店图片   (其他)
            imageDBEntity.HotelID = hotelId;
            imageDBEntity.RoomTypeCode = roomCode;
            _imageEntity.ImageDBEntity.Add(imageDBEntity);
            DataTable dtImageID = ImageBP.SelectTRoomImageIDByHotelID(_imageEntity);
            if (dtImageID.Rows.Count > 0)
            {
                if (!string.IsNullOrEmpty(dtImageID.Rows[0]["IMAGE_ID"].ToString()))
                {
                    _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
                    imageDBEntity = new ImageDBEntity();
                    imageDBEntity.Id = dtImageID.Rows[0]["IMAGE_ID"].ToString();
                    imageDBEntity.ImgType = "7";
                    imageDBEntity.IsCover = "0";
                    _imageEntity.ImageDBEntity.Add(imageDBEntity);
                    ImageBP.UpdateSupImageDetailsRepeatByID(_imageEntity);
                }
            }

            _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
            imageDBEntity = new ImageDBEntity();
            imageDBEntity.Id = id;
            imageDBEntity.HotelID = HidHotelID.Value;
            imageDBEntity.RoomTypeCode = roomCode;
            _imageEntity.ImageDBEntity.Add(imageDBEntity);
            ImageBP.UpdateTRoomByHotelID(_imageEntity);
        }

        Response.Write("<script>window.returnValue=true;window.opener = null;window.close();</script>");
    }
    private void BindData(string id)
    {
        ImageEntity _imageEntity = new ImageEntity();
        _imageEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _imageEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _imageEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _imageEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _imageEntity.ImageDBEntity = new List<ImageDBEntity>();
        ImageDBEntity imageDBEntity = new ImageDBEntity();
        imageDBEntity.Id = id;

        _imageEntity.ImageDBEntity.Add(imageDBEntity);
        DataSet dsResult = ImageBP.GetSupImageByID(_imageEntity);
        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            string hotelID = dsResult.Tables[0].Rows[0]["HOTEL_ID"].ToString();
            string imgurl = dsResult.Tables[0].Rows[0]["HTP_PATH"].ToString();
            string imgType = dsResult.Tables[0].Rows[0]["IMG_TYPE"].ToString();
            //string roomCode = dsResult.Tables[0].Rows[0]["ROOM_TYPE_CODE"].ToString();
            string roomCode = dsResult.Tables[0].Rows[0]["ROOM_CODE"].ToString();
            string isCover = dsResult.Tables[0].Rows[0]["IS_COVER"].ToString();

            this.HidHotelID.Value = hotelID;
            this.HidRoomCode.Value = roomCode;

            this.ddlPicType.Value = imgType;
            if (imgType == "1")
            {
                this.RoomListDiv.Attributes["style"] = "display:''";
                this.HidIsRoomType.Value = "1";
            }

            if (isCover == "1")
            {
                this.chkCover.Checked = true;
            }

            this.ImgSrc.Src = imgurl.Replace("_100_75", "_400_300");
            this.spanUrl.InnerHtml = imgurl.Replace("_100_75", "");

            GetRoomNameByHotelID(hotelID);
            this.ddlRoomList.SelectedValue = roomCode;
        }
    }