コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int roomID = 0;
            Session["Prop_Action"] = "I";
            if (Request.QueryString["RoomType_ID"] != null)
            {
                roomID = Convert.ToInt32(Request.QueryString["RoomType_ID"]);
                Session["Prop_Action"] = "U";
            }


            if (Session["Prop_Action"] == "U")
            {
                // int proID= int.Parse(Session["Pro_ID"].ToString());
                RoomTypes room = new RoomTypes();
                room.RoomType_ID = roomID;
                room.SelectOne();
                txtTypeID.Value = room.RoomType_ID.ToString();
                txtTypeEn.Text  = room.RoomType_EN.ToString();
                txtTypeAr.Text  = room.RoomType_AR.ToString();
                txtDesc.Text    = room.Description.ToString();
            }
        }
    }
コード例 #2
0
    protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            string    strRoomID = grid.Rows[e.RowIndex].Cells[0].Text;
            RoomTypes room      = new RoomTypes();
            room.RoomType_ID = int.Parse(strRoomID);
            room.SelectOne();
            room.Delete();
            // bool retval=new Rooms().Delete(room.Room_ID)

            BindGridView(0);
        }
        catch (Exception ex) { }
    }
コード例 #3
0
    private DataTable GetRoomTypes(int roomTypeId)
    {
        DataTable table    = null;
        RoomTypes roomType = new RoomTypes();

        if (roomTypeId == 0)
        {
            table = roomType.SelectAll();
        }
        else
        {
            roomType.RoomType_ID = roomTypeId;
            table = roomType.SelectOne();
        }
        return(table);
    }
コード例 #4
0
    private void BindGridView(int roomTypeId)
    {
        DataTable table    = null;
        RoomTypes roomType = new RoomTypes();

        if (roomTypeId == 0)
        {
            table = roomType.SelectAll();
        }
        else
        {
            roomType.RoomType_ID = roomTypeId;
            table = roomType.SelectOne();
        }

        grid.DataSource = table;
        grid.DataBind();
    }
コード例 #5
0
    private void DeleteRomType(int roomTypeId)
    {
        RoomTypes room = new RoomTypes();

        room.RoomType_ID = roomTypeId;
        room.SelectOne();
        if (room.Delete())
        {
            BindGridView();
        }
        else
        {
            if (room.ErrorCode == -10)
            {
                lblMsg.Text = "Cannot Delete. This Room Type is associated with Rates";
            }
            else if (room.ErrorCode == -20)
            {
                lblMsg.Text = "Cannot Delete. This Room Type is associated with Rooms";
            }
            lblMsg.ForeColor = Color.Red;
        }
    }