private void OrderService(object sender, RoutedEventArgs e)
 {
     if (dataRoom.SelectedItems.Count > 0)
     {
         Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
         Frm.OrderService    AR  = new Frm.OrderService(row.NAME, empid);
         AR.ShowDialog();
         GetRoomView();
     }
 }
 private void Booking(object sender, RoutedEventArgs e)
 {
     if (dataRoom.SelectedItems.Count > 0)
     {
         Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
         Frm.Booking         BK  = new Frm.Booking(row.NAME, empid);
         BK.ShowDialog();
         GetRoomView();
     }
 }
 private void EditNote(object sender, RoutedEventArgs e)
 {
     if (dataRoom.SelectedItems.Count > 0)
     {
         Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
         Frm.EditNote        CR  = new Frm.EditNote(row.NOTE, row.NAME);
         CR.ShowDialog();
         GetRoomView();
     }
 }
 private void CheckIn(object sender, RoutedEventArgs e)
 {
     if (dataRoom.SelectedItems.Count > 0)
     {
         Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
         Frm.CheckIn         CI  = new Frm.CheckIn(row.NAME, row.STATUS, empid);
         CI.ShowDialog();
         GetRoomView();
     }
 }
        private void CheckBill(object sender, RoutedEventArgs e)
        {
            if (dataRoom.SelectedItems.Count > 0)
            {
                Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
                Model.dao.RoomDao   RD  = new Model.dao.RoomDao();

                Frm.CheckBill CB = new Frm.CheckBill(RD.GetID(row.NAME));
                CB.ShowDialog();
                GetRoomView();
            }
        }
        private void ChangeRoom(object sender, RoutedEventArgs e)
        {
            if (dataRoom.SelectedItems.Count > 0)
            {
                Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;

                Frm.ChangeRoom CR = new Frm.ChangeRoom(row.NAME, row.PRICE, row.TYPE, row.CATEGORY);

                CR.ShowDialog();
                GetRoomView();
            }
        }
 private void DisableRoom(object sender, RoutedEventArgs e)
 {
     if (dataRoom.SelectedItems.Count > 0)
     {
         Model.view.RoomView row = (Model.view.RoomView)dataRoom.SelectedItem;
         Model.dao.RoomDao   RD  = new Model.dao.RoomDao();
         if (DisRoom.Header.ToString() == "Disable Room")
         {
             RD.DisableRoom(1, row.NAME);
         }
         else
         {
             RD.DisableRoom(2, row.NAME);
         }
         GetRoomView();
     }
 }
        void Window1_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            DependencyObject dep = (DependencyObject)e.OriginalSource;

            while ((dep != null) && !(dep is DataGridCell))
            {
                dep = VisualTreeHelper.GetParent(dep);
            }
            if (dep == null)
            {
                return;
            }

            if (dep is DataGridCell)
            {
                DataGridCell cell = dep as DataGridCell;
                cell.Focus();

                while ((dep != null) && !(dep is DataGridRow))
                {
                    dep = VisualTreeHelper.GetParent(dep);
                }
                DataGridRow row = dep as DataGridRow;
                dataRoom.SelectedItem = row.DataContext;

                Model.view.RoomView RowData = (Model.view.RoomView)dataRoom.SelectedItem;

                DisRoom.Header = RowData.STATUS == "Disabled" ? "Active" : "Disable Room";

                switch (RowData.STATUS)
                {
                case "In Use":
                    CusInfo.IsEnabled            = true;
                    DisRoom.IsEnabled            = false;
                    Booking_MenuItem.IsEnabled   = false;
                    Order_MenuItem.IsEnabled     = true;
                    Edit_MenuItem.IsEnabled      = false;
                    Checkbill_MenuItem.IsEnabled = true;
                    Checkin_MenuItem.IsEnabled   = true;
                    break;

                case "Booked":
                    CusInfo.IsEnabled            = true;
                    DisRoom.IsEnabled            = false;
                    Booking_MenuItem.IsEnabled   = false;
                    Order_MenuItem.IsEnabled     = false;
                    Edit_MenuItem.IsEnabled      = false;
                    Checkbill_MenuItem.IsEnabled = false;
                    Checkin_MenuItem.IsEnabled   = true;
                    break;

                case "Disabled":
                    CusInfo.IsEnabled            = false;
                    DisRoom.IsEnabled            = true;
                    Booking_MenuItem.IsEnabled   = false;
                    Order_MenuItem.IsEnabled     = false;
                    Edit_MenuItem.IsEnabled      = false;
                    Checkbill_MenuItem.IsEnabled = false;
                    Checkin_MenuItem.IsEnabled   = false;
                    break;

                case "Empty":
                    CusInfo.IsEnabled            = false;
                    DisRoom.IsEnabled            = true;
                    Booking_MenuItem.IsEnabled   = true;
                    Order_MenuItem.IsEnabled     = false;
                    Edit_MenuItem.IsEnabled      = true;
                    Checkbill_MenuItem.IsEnabled = false;
                    Checkin_MenuItem.IsEnabled   = true;
                    break;
                }
                if (accounttype == "Employee")
                {
                    DisRoom.IsEnabled       = false;
                    Edit_MenuItem.IsEnabled = false;
                }
            }
        }