Example #1
0
        private void showData()
        {
            var customers = ReservationBLL.Search(pageIndex, pageSize, sortBy, sortOrder, keyword);

            dgReservations.ItemsSource = customers.Items;
            pageCount = customers.PageCount;
        }
Example #2
0
        public FormCheckIn()
        {
            InitializeComponent();

            _reservationBLL = new ReservationBLL();
            _checkInBLL     = new CheckInBLL();
            _roomBLL        = new RoomBLL();
        }
Example #3
0
 public FormMain()
 {
     InitializeComponent();
     CustomizedDesign();
     _reservationBLL = new ReservationBLL();
     System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromHours(12).TotalHours);
     timer.AutoReset = true;
     timer.Elapsed  += new System.Timers.ElapsedEventHandler(VerifyReservation);
     timer.Start();
 }
Example #4
0
 public FormSearchReservation(string clientCpf = "")
 {
     InitializeComponent();
     filterClient      = clientCpf;
     _reservationBLL   = new ReservationBLL();
     _roomBLL          = new RoomBLL();
     _clientBLL        = new ClientBLL();
     _reservationsGrid = new List <ReservationGrid>();
     reservation       = new Reservation();
 }
Example #5
0
        public frmReservation()
        {
            InitializeComponent();

            lsre  = new List <eReservation>();
            rebll = new ReservationBLL();

            lsre = rebll.getAllReservation();

            LoadDataGridView(dgvReservation, lsre);
        }
        public static string getRoomRent(int Room_id)
        {
            string roomRent = "";
            Room   aRoom    = new Room();

            aRoom.Id = Room_id;
            ReservationBLL aReservationBLL = new ReservationBLL();
            DataTable      dt = aReservationBLL.getRoomRentBLL(aRoom);

            roomRent = dt.Rows[0][0].ToString();
            return(roomRent);
        }
        public static int predictReservationID()
        {
            ReservationBLL aReservationBLL = new ReservationBLL();
            int            predictedID     = aReservationBLL.getMaxID_BLL();

            if (predictedID != 0)
            {
                predictedID = predictedID + 1;
            }
            else
            {
                predictedID = 1;
            }

            return(predictedID);
        }
        public static ProductDetails[] RoomVacancyInformation(int Room_id)
        {
            List <ProductDetails> MyData = new List <ProductDetails>();
            Room aRoom = new Room();

            aRoom.Id = Room_id;
            ReservationBLL aReservationBLL = new ReservationBLL();
            DataTable      dt = aReservationBLL.RoomVacancyInformationBLL(aRoom);

            foreach (DataRow DR in dt.Rows)
            {
                ProductDetails objProduct = new ProductDetails();
                objProduct.CheckIn  = DR["CheckInDate"].ToString();
                objProduct.CheckOut = DR["CheckOutDate"].ToString();
                MyData.Add(objProduct);
            }
            return(MyData.ToArray());
        }
        private void Button4_Click(object sender, EventArgs e)
        {
            try
            {
                //x => x._subscriber.SubscriberId == 2 ||
                int  m;
                bool isNumeric = int.TryParse(txtBorrowings.Text, out m);

                if (comboChoseGrid.SelectedItem.ToString() == "Borrowings")
                {
                    gridBorrowings.MainView = gridView3;
                    //BorrowingsLanguageChange();

                    if (txtBorrowings.Text == string.Empty)
                    {
                        gridBorrowings.DataSource = bbll.GetAll();
                    }

                    else if (isNumeric)
                    {
                        gridBorrowings.DataSource = bbll.GetAll().Where(x => x.SubscriberId == m ||
                                                                        x.materialId == m || x.BorrowId == m);
                    }
                    else
                    {
                        if (txtBorrowings.Text == string.Empty)
                        {
                            gridBorrowings.DataSource = bbll.GetAll();
                        }
                        else
                        {
                            gridBorrowings.DataSource = bbll.GetAll().Where(x => $"{x._subscriber.Name} {x._subscriber.LastName}" == txtBorrowings.Text || $"{ x._subscriber.LastName}" == txtBorrowings.Text ||
                                                                            $"{ x._subscriber.Name}" == txtBorrowings.Text ||
                                                                            x._material.Title == txtBorrowings.Text || x._material._Author.AuthorName == txtBorrowings.Text || x._shelf.Location == txtBorrowings.Text);
                        }
                    }
                }

                else
                {
                    reservationBO           = new Reservation();
                    res                     = new ReservationBLL();
                    gridBorrowings.MainView = gridView1;

                    //ReservationLanguageChange();
                    if (txtBorrowings.Text == string.Empty)
                    {
                        gridBorrowings.DataSource = res.GetAll();
                    }

                    else if (isNumeric)
                    {
                        gridBorrowings.DataSource = res.GetAll().Where(x => x.SubscriberId == m ||
                                                                       x.MaterialId == m || x.MaterialId == m);
                    }
                    else
                    {
                        if (txtBorrowings.Text == string.Empty)
                        {
                            gridBorrowings.DataSource = res.GetAll();
                        }
                        else
                        {
                            gridBorrowings.DataSource = res.GetAll().Where(x => $"{x._subscriber.Name} {x._subscriber.LastName}" == txtBorrowings.Text ||
                                                                           x._material.Title == txtBorrowings.Text || x._material._Author.AuthorName == txtBorrowings.Text);
                        }
                    }
                }
            }
            catch (Exception)
            {
                gridBorrowings.DataSource = bbll.GetAll();
            }
        }
        protected void btnCancel_Reservation_Click(object sender, EventArgs e)
        {
            string   gender    = drpGenderSelection.Value;
            Customer aCustomer = new Customer();

            aCustomer.Id = 0;
            int.TryParse(TxtID_Reservation.Text, out aCustomer.Id);
            aCustomer.Name = TextBox2.Text;
            aCustomer.DOB  = TextBox3.Text;
            aCustomer.Age  = 0;
            int.TryParse(TextBox4.Text, out aCustomer.Age);
            aCustomer.Sex               = gender;
            aCustomer.Profession        = TextBox5.Text;
            aCustomer.ProfessionAddress = TextBox6.Text;
            aCustomer.PermanentAddress  = TextBox7.Text;
            aCustomer.PresentAddress    = TextPresentAdd.Text;
            aCustomer.ContactNo         = TextBox8.Text;
            aCustomer.Email             = TextBox9.Text;
            aCustomer.NIDorPassportNo   = TextBox11.Text;

            Record aRecord = new Record();

            aRecord.RoomID = 0;
            int.TryParse(TextBox12.Text, out aRecord.RoomID);
            aRecord.RoomNO        = TextBox13.Text;
            aRecord.BookingDate   = TextBox14.Text;
            aRecord.CheckInDate   = TextBox15.Text;
            aRecord.CheckOutDate  = TextBox16.Text;
            aRecord.PaymentStatus = TextBox19.Text;

            Cost aCost = new Cost();

            aCost.TotalCost = 0;
            float.TryParse(TextBox18.Text, out aCost.TotalCost);
            aCost.Due = 0;
            float.TryParse(TextBox20.Text, out aCost.Due);
            aCost.LastPayment = 0;
            float.TryParse(TextBox19.Text, out aCost.LastPayment);


            if (aCost.Due == 0)
            {
                aRecord.PaymentStatus = " Clear ";
            }
            else if (aCost.Due > 0)
            {
                aRecord.PaymentStatus = "Due " + aCost.Due + "";
            }
            else
            {
                aRecord.PaymentStatus = "";
            }
            ReservationBLL aReservationBLL = new ReservationBLL();
            bool           Result          = aReservationBLL.cancelReservationInfBLL(aCustomer, aRecord, aCost);

            if (Result)

            {
                System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Reservation Cancelled Successfully')</SCRIPT>");
                Server.Transfer("Reservation.aspx", false);
            }
            else
            {
                System.Web.HttpContext.Current.Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Error when updateing Reservation')</SCRIPT>");
            }
        }
 public ReservationController(ReservationBLL reservationBLL)
 {
     this.reservationBLL = reservationBLL;
 }
        private void BtnSearch_Click_1(object sender, EventArgs e)
        {
            int  n;
            bool isNumeric = int.TryParse(txtSubscriberID.Text, out n);

            int  m;
            bool isMaterialId = int.TryParse(txtMaterialID.Text, out m);

            if (isNumeric && isMaterialId)
            {
                sbll = new SubscriberBLL();
                rbll = new ReservationBLL();
                mbll = new MaterialBLL();


                mbo = mbll.Get(m);
                sbo = sbll.Get(n);



                if (sbo != null && mbo.MaterialId > 0)
                {
                    re = rbll.GetReservationBySubscriberIdAndMaterialId(sbo.SubscriberId, mbo.MaterialId);

                    txtName.Text           = $"{sbo.Name} {sbo.LastName}";
                    txtAddress.Text        = sbo.Address;
                    txtEmail.Text          = sbo.Email;
                    txtPhoneNumber.Text    = sbo.PhoneNo;
                    txtPersonalNumber.Text = sbo.PersonalNo;

                    txtMaterialName.Text = mbo.Title;
                    txtMaterialType.Text = mbo._MaterialType._MaterialType;
                    txtAuthor.Text       = mbo._Author.AuthorName;
                    txtLocated.Text      = mbo._Shelf.Location;

                    if (re == null)
                    {
                        txtReserved.Text = "No";
                    }
                    else
                    {
                        txtReserved.Text = "Yes";
                    }



                    if (mbo.AvailableCoppies > 0)
                    {
                        txtAvailability.Text = "Yes";
                    }
                    else
                    {
                        txtAvailability.Text = "No";
                    }
                }
                else
                {
                    if (sbo == null && mbo.MaterialId < 1)
                    {
                        MessageBox.Show($"Material and Subscriber are not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (sbo == null)
                    {
                        MessageBox.Show($"Subscriber is not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (mbo.MaterialId < 1)
                    {
                        MessageBox.Show($"Material is not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            else if (txtMaterialID.Text == string.Empty && txtSubscriberID.Text == string.Empty)
            {
                MessageBox.Show($"Material and Subscriber are empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtMaterialID.Text == string.Empty)
            {
                MessageBox.Show($"Material ID field is empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtSubscriberID.Text == string.Empty)
            {
                MessageBox.Show($"Subscriber ID field is empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show($"Material or Subscriber is not valid", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #13
0
 public FormReservation()
 {
     InitializeComponent();
     _reservationBLL = new ReservationBLL();
 }