Ejemplo n.º 1
0
    protected void RadGrid1_OnItemDataBound(object sender, GridItemEventArgs e)
    {
        var cbbphong    = e.Item.FindControl("cbboxphong") as RadComboBox;
        var txtidhoadon = e.Item.FindControl("txtidhoadon") as RadTextBox;

        if (cbbphong != null)
        {
            var presenter = new PMHoaDonDV(this);
            var dshang    = presenter.GetAllPhong();

            cbbphong.DataTextField  = "Ten";
            cbbphong.DataValueField = "ID";
            cbbphong.DataSource     = dshang;
            cbbphong.DataBind();
        }

        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            var item = (GridEditFormItem)e.Item;
            if (!(e.Item is IGridInsertItem))
            {
                cbbphong.SelectedValue = DataBinder.Eval(e.Item.DataItem, "ID_Phong").ToString();
            }
            txtidhoadon.Text = DataBinder.Eval(e.Item.DataItem, "ID").ToString();
        }
    }
Ejemplo n.º 2
0
    protected void txtsearch_OnTextChanged(object sender, EventArgs e)
    {
        var       presenter = new PMHoaDonDV(this);
        DataTable dt;

        dt = presenter.List(txtsearch.Text);
        RadGrid1.DataSource = dt;
        RadGrid1.DataBind();
    }
Ejemplo n.º 3
0
    protected void btnTinhTienClick(object sender, EventArgs e)
    {
        status.Value = "1"; //3 la busy 1 la free
        (new PMPhong(this)).End();

        var presenter = new PMHoaDonDV(this);

        tongtienhang.Value      = presenter.GetTongTienHang().ToString();
        tongtienthanhtoan.Value = presenter.GetOne(presenter.GetLastByRomChaged(ID).ID).TongTien.ToString();
        tienphong.Value         = (Decimal.Parse(tongtienthanhtoan.Value) - Decimal.Parse(tongtienhang.Value)).ToString();

        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tinhtien", "btntinhtienclick();", true);
    }
Ejemplo n.º 4
0
    protected void RadGrid1_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        var       presenter = new PMHoaDonDV(this);
        DataTable dt;

        if (txtsearch.Text == "")
        {
            dt = presenter.List(null);
        }
        else
        {
            dt = presenter.List(txtsearch.Text);
        }
        RadGrid1.DataSource = dt;
    }
Ejemplo n.º 5
0
    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 PMHoaDonDV(this);
        var txtidhoadon = e.Item.FindControl("txtidhoadon") as RadTextBox;

        //ID_HoaDon = Convert.ToInt32(txtidhoadon.Text);
        ID_HoaDon = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ID"));

        Message = presenter.Delete() ? "Xóa xong" : "Không xóa được nè";
        if (Message == "Xóa xong")
        {
        }
    }
Ejemplo n.º 6
0
    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 PMHoaDonDV(this);

        var cbbphong    = e.Item.FindControl("cbboxphong") as RadComboBox;
        var txtidhoadon = e.Item.FindControl("txtidhoadon") as RadTextBox;

        ID_HoaDon = Convert.ToInt32(txtidhoadon.Text);
        ID_Phong  = Convert.ToInt32(cbbphong.SelectedValue);

        Message = presenter.Update() ? "Đã cập nhật" : "Cập nhật bị lỗi";
        if (Message == "Đã cập nhật")
        {
        }
    }