Ejemplo n.º 1
0
 public string PropertyListI(string buyorrent, string type, string address, string neighborhood, string startArea, string startRate, string endArea, string endRate)
 {
     try
     {
         PropertyBAL oPropertyBAL = new PropertyBAL();
         PropertyBO oPropertyBO = new PropertyBO();
         PropertyBO oIPropertyBO = new PropertyBO();
         oPropertyBO.address = address;
         oPropertyBO.type = type;
         oPropertyBO.buyorrent = buyorrent;
         oPropertyBO.neighborhood = neighborhood;
         oPropertyBO.size = long.Parse(startArea);
         oPropertyBO.rate = long.Parse(startRate);
         oIPropertyBO.size = long.Parse(endArea);
         oIPropertyBO.rate = long.Parse(endRate);
         DataTable dt = new DataTable();
         dt = oPropertyBAL.FindProperty(oPropertyBO, oIPropertyBO);
         JSONClass objJSONClass = new JSONClass();
         return objJSONClass.CreateJSONParameters(dt);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
    public string PropertyList(string buyorrent, string type, string address)
    {
        try
        {
            PropertyBAL oPropertyBAL = new PropertyBAL();
            PropertyBO oPropertyBO = new PropertyBO();
            oPropertyBO.buyorrent = buyorrent;
            oPropertyBO.type = type;
            oPropertyBO.address = address;
            DataTable dt = new DataTable();
            dt = oPropertyBAL.FindProperty(oPropertyBO);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
            Dictionary<string, object> row = null;

            foreach (DataRow dr in dt.Rows)
            {
                row = new Dictionary<string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    row.Add(col.ColumnName.Trim(), dr[col]);
                }
                rows.Add(row);
            }
            return serializer.Serialize(rows);
        }
        catch
        {
            return "Time Out";
        }
    }
Ejemplo n.º 3
0
 public DataTable FindProperty(PropertyBO oPropertyBO)
 {
     try
     {
         cmd = new SqlCommand("SearchProperty", con);
         cmd.CommandType = CommandType.StoredProcedure;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd.Parameters.AddWithValue("@type", oPropertyBO.type);
         cmd.Parameters.AddWithValue("@buyorrent", oPropertyBO.buyorrent);
         cmd.Parameters.AddWithValue("@address", oPropertyBO.address);
         SqlParameter message = cmd.Parameters.Add("@message", SqlDbType.VarChar, 500);
         message.Direction = ParameterDirection.Output;
         dad = new SqlDataAdapter(cmd);
         dt = new DataTable();
         dad.Fill(dt);
         return dt;
     }
     catch
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Ejemplo n.º 4
0
    public DataTable FindImagesByPropertyID(PropertyBO oPropertyBO)
    {
        try
        {
            query = "SELECT * FROM PropertyImage WHERE propertyID = @propertyID";
            cmd = new SqlCommand(query, con);
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@propertyID", oPropertyBO.propertyID);

            dad = new SqlDataAdapter(cmd);
            dt = new DataTable();
            dad.Fill(dt);
            return dt;
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
        }
    }
Ejemplo n.º 5
0
 public DataTable FindSimilarPropertyByAddress(PropertyBO oPropertyBO)
 {
     try
     {
         return oPropertyDAL.FindSimilarPropertyByAddress(oPropertyBO);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 6
0
 public DataTable FindPropertyByID(PropertyBO oPropertyBO)
 {
     try
     {
         return oPropertyDAL.FindPropertyByID(oPropertyBO);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 7
0
 public string PropertyList(string buyorrent, string type, string address)
 {
     try
     {
         PropertyBAL oPropertyBAL = new PropertyBAL();
         PropertyBO oPropertyBO = new PropertyBO();
         oPropertyBO.address = address;
         oPropertyBO.type = type;
         oPropertyBO.buyorrent = buyorrent;
         DataTable dt = new DataTable();
         dt = oPropertyBAL.FindProperty(oPropertyBO);
         JSONClass objJSONClass = new JSONClass();
         return objJSONClass.CreateJSONParameters(dt);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 8
0
 public DataTable InsertProperty(PropertyBO oPropertyBO, PropertyImageBO oPropertyImageBO, AgentBO oAgentBO)
 {
     try
     {
         return oPropertyDAL.InsertProperty(oPropertyBO, oPropertyImageBO, oAgentBO);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 9
0
    public DataTable InsertProperty(PropertyBO oPropertyBO, PropertyImageBO oPropertyImageBO, AgentBO oAgentBO)
    {
        try
        {
            cmd = new SqlCommand("InsertProperty", con);
            cmd.CommandType = CommandType.StoredProcedure;
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@pName", oPropertyBO.name);
            cmd.Parameters.AddWithValue("@description", oPropertyBO.description);
            cmd.Parameters.AddWithValue("@address", oPropertyBO.address);
            cmd.Parameters.AddWithValue("@city", oPropertyBO.city);
            cmd.Parameters.AddWithValue("@neighborhood", oPropertyBO.neighborhood);
            cmd.Parameters.AddWithValue("@latitude", oPropertyBO.latitude);
            cmd.Parameters.AddWithValue("@longitude", oPropertyBO.longitude);
            cmd.Parameters.AddWithValue("@zipCode", oPropertyBO.zipCode);
            cmd.Parameters.AddWithValue("@type", oPropertyBO.type);
            cmd.Parameters.AddWithValue("@buyorrent", oPropertyBO.buyorrent);
            cmd.Parameters.AddWithValue("@size", oPropertyBO.size);
            cmd.Parameters.AddWithValue("@rate", oPropertyBO.rate);
            cmd.Parameters.AddWithValue("@totalImages", oPropertyBO.totalImages);
            cmd.Parameters.AddWithValue("@parkings", oPropertyBO.parkings);
            cmd.Parameters.AddWithValue("@toilets", oPropertyBO.toilets);
            cmd.Parameters.AddWithValue("@kitchens", oPropertyBO.kitchens);
            cmd.Parameters.AddWithValue("@hasReception", oPropertyBO.hasReception);
            cmd.Parameters.AddWithValue("@isFurnished", oPropertyBO.isFurnished);
            cmd.Parameters.AddWithValue("@image", oPropertyImageBO.image);
            cmd.Parameters.AddWithValue("@name", oAgentBO.name);
            cmd.Parameters.AddWithValue("@business", oAgentBO.business);
            cmd.Parameters.AddWithValue("@email", oAgentBO.email);
            cmd.Parameters.AddWithValue("@phone", oAgentBO.phone);
            cmd.Parameters.AddWithValue("@status", oAgentBO.status);

            dad = new SqlDataAdapter(cmd);
            dt = new DataTable();
            dad.Fill(dt);
            return dt;
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
        }
    }
Ejemplo n.º 10
0
    public DataTable FindSimilarPropertyByAddress(PropertyBO oPropertyBO)
    {
        try
        {
            query = @"SELECT TOP 2 [Property].propertyID, SUBSTRING ([Property].description, 0 , 100) + '..' AS description, [Property].address, [Property].size, [Property].rate, RTRIM(LTRIM([PropertyImage].image)) AS image
                        FROM [dbo].[Property]
                        LEFT JOIN [dbo].[PropertyImage]
                        ON [Property].propertyID = [PropertyImage].propertyID
                        AND
                        [PropertyImage].ID IN (SELECT MIN(ID) FROM [PropertyImage] GROUP BY [PropertyImage].propertyID)
                        WHERE [Property].address LIKE @address
                        AND [Property].type = (SELECT type FROM property WHERE propertyID = @propertyID)
                        AND [Property].buyorrent = (SELECT buyorrent FROM property WHERE propertyID = @propertyID)
                        AND [Property].propertyID != @propertyID ORDER BY RAND()";
            cmd = new SqlCommand(query, con);
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@propertyID", oPropertyBO.propertyID);
            cmd.Parameters.AddWithValue("@address", "%" + oPropertyBO.address + "%");
            SqlParameter message = cmd.Parameters.Add("@message", SqlDbType.VarChar, 500);
            message.Direction = ParameterDirection.Output;

            dad = new SqlDataAdapter(cmd);
            dt = new DataTable();
            dad.Fill(dt);
            return dt;
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
        }
    }
Ejemplo n.º 11
0
    public DataTable FindPropertyByID(PropertyBO oPropertyBO)
    {
        try
        {
            query = @"SELECT *, y.name AS agentName FROM Property x
                    INNER JOIN Agent y
                    ON x.agentID = y.agentID WHERE x.propertyID = @propertyID";

            cmd = new SqlCommand(query, con);
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd.Parameters.AddWithValue("@propertyID", oPropertyBO.propertyID);
            SqlParameter message = cmd.Parameters.Add("@message", SqlDbType.VarChar, 500);
            message.Direction = ParameterDirection.Output;

            dad = new SqlDataAdapter(cmd);
            dt = new DataTable();
            dad.Fill(dt);
            return dt;
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
        }
    }