public List <VehicleParkingFee> GetLocationParkingLotVehicleParkingFee(VehicleParkingFee obj)
        {
            List <VehicleParkingFee> lstVehicleParkingFee = new List <VehicleParkingFee>();

            try
            {
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_GetLocationParkingLotVehicleParkingFeeDetails", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@ParkingHours", (obj.ParkingHours == null || obj.ParkingHours == 0) ? (object)DBNull.Value : obj.ParkingHours);
                        sqlcmd_obj.Parameters.AddWithValue("@PaidAmount", (obj.PaidAmount == null || obj.PaidAmount == 0) ? (object)DBNull.Value : obj.PaidAmount);
                        sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeCode", string.IsNullOrEmpty(obj.VehicleTypeCode) ? (object)DBNull.Value : obj.VehicleTypeCode);
                        sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", obj.LocationParkingLotID);
                        sqlconn_obj.Open();
                        SqlDataAdapter sqldap   = new SqlDataAdapter(sqlcmd_obj);
                        DataTable      resultdt = new DataTable();
                        sqldap.Fill(resultdt);
                        if (resultdt.Rows.Count > 0)
                        {
                            for (var i = 0; i < resultdt.Rows.Count; i++)
                            {
                                VehicleParkingFee objVehicleParkingFee = new VehicleParkingFee();
                                objVehicleParkingFee.Fees                 = resultdt.Rows[i]["PRICE"] == DBNull.Value ? 0 : Convert.ToDecimal(resultdt.Rows[i]["PRICE"]);
                                objVehicleParkingFee.Duration             = resultdt.Rows[i]["Duration"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["Duration"]);
                                objVehicleParkingFee.LocationParkingLotID = resultdt.Rows[i]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[i]["LocationParkingLotID"]);
                                objVehicleParkingFee.LotOpenTime          = Convert.ToString(resultdt.Rows[i]["LotOpenTime"]);
                                objVehicleParkingFee.LotCloseTime         = Convert.ToString(resultdt.Rows[i]["LotCloseTime"]);
                                objVehicleParkingFee.DayOfWeek            = Convert.ToString(resultdt.Rows[i]["DayOfWeek"]);
                                objVehicleParkingFee.VehicleTypeCode      = Convert.ToString(resultdt.Rows[i]["VehicleTypeCode"]);
                                objVehicleParkingFee.IsFullDay            = resultdt.Rows[i]["IsFullDay"] == DBNull.Value ? false : Convert.ToBoolean(resultdt.Rows[i]["IsFullDay"]);
                                lstVehicleParkingFee.Add(objVehicleParkingFee);
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALCheckIn", "Proc: " + "OPAPP_PROC_GetLocationParkingLotVehicleParkingFeeDetails", "GetLocationParkingLotVehicleParkingFee");
            }
            return(lstVehicleParkingFee);
        }
        public List <VehicleParkingFee> GetLocationParkingLotVehicleParkingFees(string accessToken, string VehicleTypeCode, int ParkingHours, int LocationParkingLotID, decimal paidParkingFees)
        {
            VehicleParkingFee        objVehicleParkingFee  = new VehicleParkingFee();;
            List <VehicleParkingFee> lstParkingFeesDetails = new List <VehicleParkingFee>();

            try
            {
                objVehicleParkingFee.VehicleTypeCode      = VehicleTypeCode;
                objVehicleParkingFee.ParkingHours         = ParkingHours;
                objVehicleParkingFee.LocationParkingLotID = LocationParkingLotID;
                objVehicleParkingFee.PaidAmount           = paidParkingFees;
                string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]);
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseUrl);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    // Add the Authorization header with the AccessToken.
                    client.DefaultRequestHeaders.Add("Authorization", "bearer  " + accessToken);
                    // create the URL string.
                    string url = "api/InstaOperator/postOPAPPGetLocaitonParkingLotVehicleParkingFee";
                    // make the request
                    var json    = JsonConvert.SerializeObject(objVehicleParkingFee);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    HttpResponseMessage response = client.PostAsync(url, content).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        string jsonString = response.Content.ReadAsStringAsync().Result;
                        if (jsonString != null)
                        {
                            APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString);

                            if (apiResult.Result)
                            {
                                lstParkingFeesDetails = JsonConvert.DeserializeObject <List <VehicleParkingFee> >(Convert.ToString(apiResult.Object));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(lstParkingFeesDetails);
        }
        public VehicleParkingFee GetVehicleParkingFee(VehicleParkingFee obj)
        {
            VehicleParkingFee objVehicleParkingFee = new VehicleParkingFee();

            try
            {
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_GetVehicleParkingFeeDetails", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@ParkingHours", obj.ParkingHours);
                        sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeCode", obj.VehicleTypeCode);
                        sqlcmd_obj.Parameters.AddWithValue("@VehicleTypeID", obj.VehicleTypeID);
                        sqlcmd_obj.Parameters.AddWithValue("@LocationParkingLotID", obj.LocationParkingLotID);
                        sqlcmd_obj.Parameters.AddWithValue("@ParkingStartTime", obj.ParkingStartTime);
                        sqlconn_obj.Open();
                        SqlDataAdapter sqldap   = new SqlDataAdapter(sqlcmd_obj);
                        DataTable      resultdt = new DataTable();
                        sqldap.Fill(resultdt);
                        if (resultdt.Rows.Count > 0)
                        {
                            objVehicleParkingFee.Fees                 = Convert.ToDecimal(resultdt.Rows[0]["PRICE"]);
                            objVehicleParkingFee.ParkingHours         = obj.ParkingHours;
                            objVehicleParkingFee.LocationParkingLotID = obj.LocationParkingLotID;
                            objVehicleParkingFee.SpotExpireTime       = Convert.ToString(resultdt.Rows[0]["SpotExpireTime"]);
                            objVehicleParkingFee.VehicleTypeID        = Convert.ToInt32(resultdt.Rows[0]["VehicleTypeID"]);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALCheckIn", "Proc: " + "OPAPP_PROC_GetVehicleParkingFeeDetails", "GetVehicleParkingFee");
            }
            return(objVehicleParkingFee);
        }