Exemple #1
0
        public bool Add(FloorBO model)
        {
            try
            {
                using (IDbConnection connection = DBConfig.GetConnection())
                {
                    connection.Open();
                    String sql = "Add_Floor";
                    using (IDbCommand command = DBConfig.Command(connection, sql, CommandType.StoredProcedure))
                    {
                        DAO.AddParameter(command, "block_code", model.Block_Code);
                        DAO.AddParameter(command, "floor_code", model.Floor_Code);
                        DAO.AddParameter(command, "is_Floor_Full", model.is_Floor_Full);
                        DAO.AddParameter(command, "is_Reserved", model.is_Reserved);
                        DAO.AddParameter(command, "number_of_slots", model.Number_of_slots);

                        var result = command.ExecuteNonQuery();
                        return(result >= 0);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemple #2
0
        public bool Add(ReservationBO model)
        {
            try
            {
                using (IDbConnection connection = DBConfig.GetConnection())
                {
                    String sql = "dbo.usp_Employee_Insert";
                    using (IDbCommand command = DBConfig.Command(connection, sql, CommandType.StoredProcedure))
                    {
                        DAO.AddParameter(command, "vehicle_number", model.vehicle_number);
                        DAO.AddParameter(command, "reservation_date", model.reservation_date);
                        DAO.AddParameter(command, "parking_slot_code", model.SlotCode);

                        var result = command.ExecuteNonQuery();
                        return(result >= 0);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public bool Add(ParkingSlotsBO model)
        {
            try
            {
                using (IDbConnection connection = DBConfig.GetConnection())
                {
                    connection.Open();
                    String sql = "Add_ParkingSlot";
                    using (IDbCommand command = DBConfig.Command(connection, sql, CommandType.StoredProcedure))
                    {
                        DAO.AddParameter(command, "slot_code", model.SlotCode);
                        DAO.AddParameter(command, "floor_code", model.FloorCode);
                        DAO.AddParameter(command, "is_reserved", model.is_reserved);

                        var result = command.ExecuteNonQuery();
                        return(result >= 0);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemple #4
0
        public bool Add(BlockBO model)
        {
            try
            {
                using (IDbConnection connection = DBConfig.GetConnection())
                {
                    String sql = "dbo.usp_Employee_Insert";
                    using (IDbCommand command = DBConfig.Command(connection, sql, CommandType.StoredProcedure))
                    {
                        // DAO = Data Access Object
                        DAO.AddParameter(command, "number_of_floors", model.Number_of_floors);
                        DAO.AddParameter(command, "block_code", model.BlockCode);
                        DAO.AddParameter(command, "is_block_full", model.is_Block_full);

                        var result = command.ExecuteNonQuery();
                        return(result >= 0);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }