コード例 #1
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void RadGrid1_OnItemDataBound(object sender, GridItemEventArgs e)
    {
        var cboKhoa = e.Item.FindControl("cbboxloaiphong") as RadComboBox;
        //texrtbox id
        var txtidphong = e.Item.FindControl("txtidphong") as RadTextBox;

        if (cboKhoa != null)
        {
            var presenter   = new PMPhong(this);
            var dsloaiphong = presenter.GetAllLoaiPhong();

            cboKhoa.DataTextField  = "Ten";
            cboKhoa.DataValueField = "ID";
            cboKhoa.DataSource     = dsloaiphong;
            cboKhoa.DataBind();
        }
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            var item  = (GridEditFormItem)e.Item;
            var combo = (RadComboBox)item.FindControl("cbboxloaiphong");
            if (!(e.Item is IGridInsertItem))
            {
                combo.SelectedValue = DataBinder.Eval(item.DataItem, "IdLoaiPhong").ToString();
            }
            txtidphong.Text = DataBinder.Eval(e.Item.DataItem, "ID").ToString();
        }
    }
コード例 #2
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void txtsearch_OnTextChanged(object sender, EventArgs e)
    {
        var       presenter = new PMPhong(this);
        DataTable dt;

        dt = presenter.List(txtsearch.Text);
        RadGrid1.DataSource = dt;
        RadGrid1.DataBind();
    }
コード例 #3
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void RadGrid1_OnInsertCommand(object sender, GridCommandEventArgs e)
    {
        newValue     = new Hashtable();
        editableItem = e.Item as GridEditableItem;
        e.Item.OwnerTableView.ExtractValuesFromItem(newValue, editableItem);
        var presenter = new PMPhong(this);

        var cbb = e.Item.FindControl("cbboxloaiphong") as RadComboBox;

        IdLoaiPhong = Convert.ToInt32(cbb.SelectedValue);
        Message     = presenter.Inseart() ? "Thêm thành công" : "Thêm thất bại";
        if (Message == "Thêm thành công")
        {
        }
    }
コード例 #4
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void RadGrid1_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        var       presenter = new PMPhong(this);
        DataTable dt;

        if (txtsearch.Text == "")
        {
            dt = presenter.List(null);
        }
        else
        {
            dt = presenter.List(txtsearch.Text);
        }
        RadGrid1.DataSource = dt;
    }
コード例 #5
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void RadGrid1_OnDeleteCommand(object sender, GridCommandEventArgs e)
    {
        newValue     = new Hashtable();
        editableItem = e.Item as GridEditableItem;
        e.Item.OwnerTableView.ExtractValuesFromItem(newValue, editableItem);
        var presenter = new PMPhong(this);

        GridDataItem item = (GridDataItem)e.Item;
        int          id   = Convert.ToInt32(item.GetDataKeyValue("ID").ToString());

        Message = presenter.Delete(id) ? "Xóa xong" : "Không xóa được nè";
        if (Message == "Xóa xong")
        {
        }
    }
コード例 #6
0
ファイル: UC_MDSPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void RadGrid1_OnUpdateCommand(object o, GridCommandEventArgs e)
    {
        newValue     = new Hashtable();
        editableItem = e.Item as GridEditableItem;
        e.Item.OwnerTableView.ExtractValuesFromItem(newValue, editableItem);
        var presenter = new PMPhong(this);

        var cbb = e.Item.FindControl("cbboxloaiphong") as RadComboBox;

        //var txtidphong = e.Item.FindControl("txtidphong") as RadTextBox;
        IdLoaiPhong = Convert.ToInt32(cbb.SelectedValue);
        //ID = Convert.ToInt32(txtidphong.Text);
        Message = presenter.Update() ? "Đã cập nhật" : "Cập nhật bị lỗi";
        if (Message == "Đã cập nhật")
        {
        }
    }
コード例 #7
0
ファイル: UC_MPhong.ascx.cs プロジェクト: TVMD/KaraOKe
    protected void Page_Load(object sender, EventArgs e)
    {
        var presenter = new PMPhong(this);
        var dsPhong   = presenter.List(null);

        string[] romicon  = { "fa fa-play", "fa fa-bookmark", "fa fa-pause" };
        string[] romstate = { "Phòng trống", "Đã đặt trước", "Đang có khách" };

        var    col      = 0;
        string idstring = null;

        foreach (DataRow item in dsPhong.Rows)
        {
            if (col % 4 == 0) //1 dong 4 cot
            {
                CreateDiv(("divrow_" + col / 4), "superDiv", "row top_tiles", "");
            }

            var currentrow = FindControl("divrow_" + col / 4);
            idstring = item["ID"].ToString();

            //item tung cot
            CreateDiv("rom_boss" + idstring, ("divrow_" + col / 4),
                      "animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12 hihi", "");
            CreateDiv("rom" + idstring, "rom_boss" + idstring, "tile-stats", "");
            CreateDiv("rom_icon" + idstring, "rom" + idstring, "icon", "");
            CreateDiv("rom_count" + idstring, "rom" + idstring, "count", item["Ten"].ToString());

            var status = Convert.ToInt32(item["StatusID"].ToString());
            FindControl("rom" + idstring).Controls.Add(new LiteralControl("<h3>" + romstate[status - 1] + "</h3>"));
            FindControl("rom_icon" + idstring)
            .Controls.Add(new LiteralControl("<i class='" + romicon[status - 1] + "'></i>"));
            col++;
        }
        ((Default2)Page).SetTitle("Quản lý phòng");
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "loadjs", "phong_ready();", true);
    }