Esempio n. 1
0
        public Feedback GetFeedbackById(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetFeedbackById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader   = command.ExecuteReader();
                    Feedback      feedback = new Feedback();
                    feedback = UtilityManager.DataReaderMap <Feedback>(reader);
                    return(feedback);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public BookingConfirmed GetPropertyViewByPropertyIdnBookingId(long propertyId, long bookingId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GET_PROPERTY_BY_PROPERTYID_BOOKINGID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@propertyId", propertyId));
                command.Parameters.Add(new SqlParameter("@bookingId", bookingId));
                try
                {
                    connection.Open();
                    SqlDataReader    dataReader   = command.ExecuteReader();
                    BookingConfirmed propertyList = new BookingConfirmed();
                    propertyList = UtilityManager.DataReaderMap <BookingConfirmed>(dataReader);
                    return(propertyList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.User GetUserByUserNameNPassword(string username, string password)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetUserByUsernamePassword, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Username", username));
                command.Parameters.Add(new SqlParameter("@Password", password));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Models.User   user   = new Models.User();
                    user = UtilityManager.DataReaderMap <Models.User>(reader);
                    return(user);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public AdminPropertyList GetAdminPropertyListById(long propertyId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.Get_Admin_PropertyListById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@PropertyId", propertyId));

                try
                {
                    connection.Open();
                    SqlDataReader     reader   = command.ExecuteReader();
                    AdminPropertyList property = new AdminPropertyList();
                    property = UtilityManager.DataReaderMap <AdminPropertyList>(reader);
                    return(property);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public PropertyWorkingDays GetPropertyWorkingDaysByPropertyId(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GET_PROPERTY_WORKING_DAYS_BY_PROPERTY_ID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@PropertyId", Id));

                try
                {
                    connection.Open();
                    SqlDataReader       reader          = command.ExecuteReader();
                    PropertyWorkingDays workingDaysList = new PropertyWorkingDays();
                    workingDaysList = UtilityManager.DataReaderMap <PropertyWorkingDays>(reader);
                    return(workingDaysList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public News GetNewsById(long?id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                News       news    = new News();
                SqlCommand command = new SqlCommand(StoreProcedure.GetNewsById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", id));
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();

                    news = UtilityManager.DataReaderMap <News>(reader);
                    return(news);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(news);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Client.Client GetClientByEmailAndPassword(string email, string password)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.Get_Client_By_Email_And_Password, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Email", email));
                command.Parameters.Add(new SqlParameter("@Password", password));

                try
                {
                    connection.Open();
                    SqlDataReader        reader = command.ExecuteReader();
                    Models.Client.Client client = new Models.Client.Client();
                    client = UtilityManager.DataReaderMap <Models.Client.Client>(reader);
                    return(client);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.User.User GetUserById(long userID)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETUSERBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@UserID", userID));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Models.User.User user = new Models.User.User();
                    user = UtilityManager.DataReaderMap<Models.User.User>(reader);
                    return user;
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public CompanySetting GetCompanySettings(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetCompanySetting, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader  reader = command.ExecuteReader();
                    CompanySetting client = new CompanySetting();
                    client = UtilityManager.DataReaderMap <CompanySetting>(reader);
                    return(client);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public AboutUs GetAboutUs(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetAboutDetails, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader  = command.ExecuteReader();
                    AboutUs       aboutUs = new AboutUs();
                    aboutUs = UtilityManager.DataReaderMap <AboutUs>(reader);
                    return(aboutUs);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 11
0
        public OurService GetServiceById(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetServicesById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader  = command.ExecuteReader();
                    OurService    service = new OurService();
                    service = UtilityManager.DataReaderMap <OurService>(reader);
                    return(service);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Banner GetBannerDetails(long bannerId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetBannerById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", bannerId));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Banner        banner = new Banner();
                    banner = UtilityManager.DataReaderMap <Banner>(reader);
                    return(banner);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 13
0
        public Models.Testimonial.Testimonial GetTestimonialById(long testimonialId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETTESTIMONIALBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@TestimonialId", testimonialId));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Models.Testimonial.Testimonial testimonial = new Models.Testimonial.Testimonial();
                    testimonial = UtilityManager.DataReaderMap <Models.Testimonial.Testimonial>(reader);
                    return(testimonial);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Transaction.Transaction GetTransactionById(long transactionId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETTRANSACTIONSBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@TransactionId", transactionId));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Models.Transaction.Transaction transaction = new Models.Transaction.Transaction();
                    transaction = UtilityManager.DataReaderMap <Models.Transaction.Transaction>(reader);
                    return(transaction);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Product GetGalleryItemById(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetProductGalleryById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader  = command.ExecuteReader();
                    Product       Product = new Product();
                    Product = UtilityManager.DataReaderMap <Product>(reader);
                    return(Product);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public PropertyView GetPropertyViewById(int id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETPROPERTYDETAILSBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@PropertyId", id));

                try
                {
                    connection.Open();
                    SqlDataReader reader          = command.ExecuteReader();
                    PropertyView  propertyDetails = new PropertyView();
                    propertyDetails = UtilityManager.DataReaderMap <PropertyView>(reader);
                    return(propertyDetails);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Booking.Booking GetBookingById(long bookingId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETBOOKINGSBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@BookingId", bookingId));

                try
                {
                    connection.Open();
                    SqlDataReader          reader  = command.ExecuteReader();
                    Models.Booking.Booking booking = new Models.Booking.Booking();
                    booking = UtilityManager.DataReaderMap <Models.Booking.Booking>(reader);
                    return(booking);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Property.Property GetPropertyById(long propertyId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETPROPERTYSBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@PropertyId", propertyId));

                try
                {
                    connection.Open();
                    SqlDataReader            reader   = command.ExecuteReader();
                    Models.Property.Property property = new Models.Property.Property();
                    property = UtilityManager.DataReaderMap <Models.Property.Property>(reader);
                    return(property);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public ImageGallery GetImageGalleryById(long id)
        {
            ImageGallery list = new ImageGallery();

            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetImageGalleryById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", id));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    list = UtilityManager.DataReaderMap <ImageGallery>(reader);
                    return(list);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(list);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Client.Client GetClientById(long clientId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETCLIENTBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@ClientId", clientId));

                try
                {
                    connection.Open();
                    SqlDataReader        reader = command.ExecuteReader();
                    Models.Client.Client client = new Models.Client.Client();
                    client = UtilityManager.DataReaderMap <Models.Client.Client>(reader);
                    return(client);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }