Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Beacon in API

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 36
    Comment on it

    While working with API you comes with different and new words so first you need to make sure what these words mean then before started working on it.

     

    Beacon is one of that word which is used while making API and applications in programming.

     

    Beacon is the company location where the employee is in right now . Like in company we have many section like boiler the production section and many more so the beacon is like a location that is being termed to the particular location in the company. Employee receives and sent message according to the beacons they are in right now.

     

    This is my stored procedure to fetch the beacon list of the company. This will show the number of locations company have.

     

    ALTER PROC [dbo].[uspGetBeacons]
    	@AccessToken VARCHAR(100)
    
    AS
    	
    BEGIN
    	SELECT ID, CompanyID, Location, BeaconUUID, BeaconMajor, BeaconMinor 
    	FROM LOCATION
    	WHERE CompanyID = (SELECT [COMPANYID] FROM [dbo].[User] WHERE AccessToken = @AccessToken AND IsDeleted = 0)
    END
    

     

    And this is my  WCF service to fetch and display the location list

     public LocationListResponse GetLocation(string accessToken)
            {
                SqlDataReader reader = null;
                LocationListResponse locationResponse = new LocationListResponse();
                List<LocationList> locDetailsList = new List<LocationList>();
                try
                {
                    using (SqlConnection sqlConnection = new SqlConnection(ConnectionString))
                    {
                        if (sqlConnection.State == ConnectionState.Closed)
                        {
                            sqlConnection.Open();
                        }
                        List<SqlParameter> parameterList = new List<SqlParameter>();
                        parameterList.Add(new SqlParameter("@AccessToken", accessToken));
                        reader = SqlHelper.ExecuteReader(sqlConnection, CommandType.StoredProcedure, "uspGetNudgeLocations", parameterList.ToArray());
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                locDetailsList.Add(new LocationList
                                {
                                    ID = reader["ID"] != null ? !string.IsNullOrEmpty(Convert.ToString(reader["ID"])) ? Convert.ToInt32(Convert.ToString(reader["ID"]).Trim()) : 0 : 0,
                                    Location = reader["Location"] != null ? Convert.ToString(reader["Location"]).Trim() : string.Empty
                                });
                            }
                        }
                        else
                        {
                            locDetailsList.Add(new LocationList
                            {
                                Location = "No Location"
                            });
                        }
                        locationResponse.Message = "Locations successfully fetched.";
                        locationResponse.status = true;
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex);
                    locationResponse.Message = ex.Message;
                    locationResponse.status = false;
                }
                locationResponse.data = locDetailsList;
                return locationResponse;
            }
    

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: