示例#1
0
    protected void btnDuyet_ServerClick(object sender, EventArgs e)
    {
        _idRoom = (DataTable)Session["_idRoom"];
        var checkValue = from b in db.tbQuanLyBooks
                         where b.book_id == Convert.ToInt32(txtId.Value)
                         select b;

        if (checkValue.Count() > 0)
        {
            var update = checkValue.FirstOrDefault();
            update.book_active = "Verified-Notcheck";
            update.book_show   = false;
            db.SubmitChanges();
            if (Session["_idRoom"] != null)
            {
                var getID = from row in _idRoom.AsEnumerable()
                            join r in db.tbRooms on row.Field <int>("room_id") equals r.room_id
                            select new
                {
                    id = row.Field <int>("room_id"),
                    r.listing_id
                };
                foreach (var item in getID)
                {
                    tbLockRoom ins = new tbLockRoom();
                    ins.room_id            = item.id;
                    ins.lookroom_dateStart = update.book_checkin;
                    ins.lookroom_dateEnd   = update.book_checkout;
                    ins.listing_id         = item.listing_id;
                    db.tbLockRooms.InsertOnSubmit(ins);
                    try
                    {
                        db.SubmitChanges();
                    }
                    catch
                    {
                    }
                }
                Session["_idRoom"] = null;
            }
            loadData();
        }
    }
示例#2
0
    protected void btnDuyet_ServerClick(object sender, EventArgs e)
    {
        RoomId = (DataTable)Session["RoomId"];
        string _id = txtIdCt.Value;

        string[] getId = _id.Split(',');
        foreach (var item in getId)
        {
            var getValue = from b in db.tbOrders
                           where b.order_id == Convert.ToInt32(item)
                           select b;
            if (getValue.Count() > 0)
            {
                var update = getValue.FirstOrDefault();
                if (update.order_hidden == null)
                {
                    update.order_Show = false;
                    //Nhả phòng
                    var getLockRoom = from r in db.tbLockRooms
                                      where r.order_id == Convert.ToInt32(item)
                                      select r;
                    foreach (var room in getLockRoom)
                    {
                        room.lookroom_active = false;
                        db.SubmitChanges();
                    }
                    txtIdCt.Value = " ";
                }
                else
                {
                    update.order_Show   = false;
                    update.order_status = "verified";
                    update.order_hidden = false;
                    db.SubmitChanges();
                    if (Session["RoomId"] != null)
                    {
                        var getID = from row in RoomId.AsEnumerable()
                                    join r in db.tbRooms on row.Field <int>("room_id") equals r.room_id
                                    select new
                        {
                            id = row.Field <int>("room_id"),
                            r.listing_id
                        };
                        foreach (var it in getID)
                        {
                            tbLockRoom ins = new tbLockRoom();
                            ins.room_id            = it.id;
                            ins.lookroom_dateStart = update.order_checkin;
                            ins.lookroom_dateEnd   = update.order_checkout;
                            ins.listing_id         = it.listing_id;
                            ins.lookroom_active    = true;
                            ins.order_id           = update.order_id;
                            db.tbLockRooms.InsertOnSubmit(ins);
                            db.SubmitChanges();
                        }
                        Session["RoomId"] = null;
                    }
                    txtIdCt.Value = " ";
                }
            }
        }
        loadData();
        alert.alert_Success(Page, "Duyệt Thành Công", "");
    }