public static List <GeoFenceModel> Geofence_Active(string AccountNo) { List <GeoFenceModel> _Value = new List <GeoFenceModel>(); SqlConnection _SQLConnection = SQLConnectionString.BuildConnection(); using (SqlConnection _DBConnection = _SQLConnection) { SqlCommand _SQLCommand = new SqlCommand(); _SQLCommand.CommandType = System.Data.CommandType.StoredProcedure; _SQLCommand.CommandTimeout = 0; using (_SQLCommand) { try { _SQLCommand.Connection = _DBConnection; _SQLCommand.CommandText = "Geofence_Active"; _SQLCommand.Parameters.AddWithValue("@AccountNo", AccountNo); _DBConnection.Open(); SqlDataReader _SQLDataReader = _SQLCommand.ExecuteReader(); GeoFenceModel _result; while (_SQLDataReader.Read()) { _result = new GeoFenceModel(); _result.TrackID = _SQLDataReader["TrackID"].ToString(); _result.TrackItem = _SQLDataReader["TrackItem"].ToString(); _result.IsOutOfFence = _SQLDataReader["IsOutOfFence"].ToString(); _result.OutOfFenceRespond = _SQLDataReader["OutOfFenceRespond"].ToString(); _Value.Add(_result); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { _DBConnection.Close(); } } } return(_Value); }
public static List <GeoFenceModel> Geofence_Select(string AccountNo, string TrackID) { List <GeoFenceModel> _Value = new List <GeoFenceModel>(); SqlConnection _SQLConnection = SQLConnectionString.BuildConnection(); using (SqlConnection _DBConnection = _SQLConnection) { SqlCommand _SQLCommand = new SqlCommand(); _SQLCommand.CommandType = System.Data.CommandType.StoredProcedure; _SQLCommand.CommandTimeout = 0; using (_SQLCommand) { try { _SQLCommand.Connection = _DBConnection; _SQLCommand.CommandText = "Get_Geofence"; _SQLCommand.Parameters.AddWithValue("@AccountNo", AccountNo); _SQLCommand.Parameters.AddWithValue("@TrackID", TrackID); _DBConnection.Open(); SqlDataReader _SQLDataReader = _SQLCommand.ExecuteReader(); GeoFenceModel _result; while (_SQLDataReader.Read()) { _result = new GeoFenceModel(); _result.ID = Convert.ToInt32(_SQLDataReader["ID"].ToString()); _result.AccountNo = _SQLDataReader["AccountNo"].ToString(); _result.TrackID = _SQLDataReader["TrackID"].ToString(); _result.TrackItem = _SQLDataReader["TrackItem"].ToString(); _result.Fencelenght = _SQLDataReader["Fencelenght"].ToString(); _result.FencePath = _SQLDataReader["FencePath"].ToString(); _result.ShapeType = _SQLDataReader["ShapeType"].ToString(); _result.FenceAlertemail = _SQLDataReader["FenceAlertemail"].ToString(); _result.FenceAlertemail2 = _SQLDataReader["FenceAlertemail2"].ToString(); _result.FenceAlertemail3 = _SQLDataReader["FenceAlertemail3"].ToString(); _result.FenceAlertPhone = _SQLDataReader["FenceAlertPhone"].ToString(); _result.FenceAlertPhone2 = _SQLDataReader["FenceAlertPhone2"].ToString(); _result.FenceAlertPhone3 = _SQLDataReader["FenceAlertPhone3"].ToString(); _result.Createdby = _SQLDataReader["Createdby"].ToString(); _result.Createddate = _SQLDataReader["Createddate"].ToString(); _result.CreatedOS = _SQLDataReader["CreatedOS"].ToString(); _result.FenceStatus = _SQLDataReader["FenceStatus"].ToString(); _result.SendAlertStatus = _SQLDataReader["SendAlertStatus"].ToString(); _result.SenderEmail = _SQLDataReader["SenderEmail"].ToString(); _result.Senderphone = _SQLDataReader["Senderphone"].ToString(); _result.ModifiedDate = _SQLDataReader["ModifiedDate"].ToString(); _result.ModifiedBy = _SQLDataReader["ModifiedBy"].ToString(); _result.FenceName = _SQLDataReader["FenceName"].ToString(); _Value.Add(_result); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { _DBConnection.Close(); } } } return(_Value); }