public bool IdPresent(string Id)
        {
            string sp_Name = "Check_Id";

            string[] param = { "std_Id" };
            string[] value = { Id };

            if (_sql.Get_Count(sp_Name, param, value) >= 1)
            {
                return(true);
            }

            return(false);
        }
        private bool CheckReservation()
        {
            bool flag = false;

            string ReserveCheckSp = "Check_Reservation";

            string[] param = { "Date", "Time", "Device" };
            object[] value = { tp_Date.Value.ToShortDateString(), cmb_TimeSlot.SelectedIndex + 1, cmb_Device.SelectedIndex + 1 };


            _reservation = _sql.checkReservation(ReserveCheckSp, param, value);

            if (_reservation.Date.ToShortDateString() == tp_Date.Value.ToShortDateString() &&
                _reservation.Slot == (cmb_TimeSlot.SelectedIndex + 1) &&
                _reservation.Device == (cmb_Device.SelectedIndex + 1))
            {
                flag = true;
                MessageBox.Show("Slot is already Reserverd");
            }
            else
            {
                string spName = "Reservation_Count_Approved";
                int    id     = _student.ID;

                string[] _param = { "std_ID" };
                object[] _value = { id };

                int reserverCount = _sql.Get_Count(spName, _param, _value);
                if (reserverCount > 2)
                {
                    MessageBox.Show("You already have 2 reservations");
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }
            return(flag);
        }
Exemplo n.º 3
0
        public void InitLabels()
        {
            string dates  = "";
            string status = "";

            lbl_ProfID.Text        = lbl_ProfID.Text + _student.RegID.ToString();
            lbl_ProfName.Text      = lbl_ProfName.Text + _student.FName + " " + _student.LName;
            lbl_ProfDesig.Text     = lbl_ProfDesig.Text + "Student";
            lbl_ReservationNo.Text = lbl_ReservationNo.Text + _sql.Get_Count("Count_Reservations", new string[] { "std_Id" }, new string[] { _student.ID.ToString() }).ToString();

            foreach (DataRow row in ReservationsDT.Rows)
            {
                dates  = dates + " & " + row["r_date"].ToString();
                status = status + " & " + row["r_status"].ToString();
            }

            lbl_ReservationDates.Text  = lbl_ReservationDates.Text + " " + dates;
            lbl_ReservationStatus.Text = lbl_ReservationStatus.Text + " " + status;
        }