⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewroom.aspx.cs

📁 酒店管理 主要实现了基础设施管理(客房管理、客房类型管理)、业务管理(入住、退房、数据库切换) 本系统简单明了,适合初学者学习,采用三层加抽象工厂实现
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using BLL;
using Model;
using AjaxControlToolkit;

public partial class ViewRoom : System.Web.UI.Page
{
    private RoomOperatorBLL roomOp = new RoomOperatorBLL();
    private RoomTypeOperatorBLL roomTypeOp = new RoomTypeOperatorBLL();

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void gdv_RoomInfo_RowDataBound(object sender, GridViewRowEventArgs e)
    {
       
        //光棒效果
        //判断是否是数据显示控件的数据行(将标头排除)
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover","bgColor=this.style.backgroundColor;foreColor=this.style.color;this.style.backgroundColor='gray';this.style.color='blue';");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=bgColor;this.style.color=foreColor;");



            Label number = e.Row.FindControl("lbl_roomNumber") as Label;
            LinkButton close = e.Row.FindControl("btn_close") as LinkButton;

            AnimationExtender anim1 = e.Row.FindControl("AnimationExtender1") as AnimationExtender;
            AnimationExtender anim2 = e.Row.FindControl("AnimationExtender2") as AnimationExtender;

            //ctl00_cph_Content_gdv_RoomInfo_ctl06_linkBtn_Description
            //ctl00_cph_Content_gdv_RoomInfo_ctl09_btn_close

            if (number != null && anim1 != null && close != null && anim2 != null)
            {
                //anim1.TargetControlID = "ct100_cph_Content_gdv_RoomInfo_ct" + number.Text.Trim() + "_linkBtn_Description";
                //anim2.TargetControlID = "ct100_cph_Content_gdv_RoomInfo_ct" + number.Text.Trim() + "_btn_close";
            }
        }
    }

    /// <summary>
    /// 返回完整的路径
    /// </summary>
    /// <param name="temp"></param>
    /// <returns></returns>
    protected string GetUrl(object temp)
    {
        string id = temp as string;
        return "~/AddRoom.aspx?Id=" + id;
    }

    /// <summary>
    /// 截取字符串为指定长度
    /// </summary>
    /// <param name="temp"></param>
    /// <returns></returns>
    protected string GetSubStr(object temp)
    {
        return GetSubstring.GetSubStr(temp);
    }

    protected void gdv_RoomInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.gdv_RoomInfo.PageIndex = e.NewPageIndex;
    }
    protected void gdv_RoomInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            this.gdv_RoomInfo.SelectedIndex = e.RowIndex;
            Label roomid = this.gdv_RoomInfo.SelectedRow.FindControl("lbl_RoomID") as Label;
            if (roomid != null)
            {
                roomOp.DeleteValuesFormRoom(roomOp.GetRoomByRoomID(int.Parse(roomid.Text)));
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('删除失败!!" + ex.Message + ex.StackTrace + ")</script>");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -