init commit

This commit is contained in:
2011-03-23 11:58:56 +02:00
commit 356079222a
315 changed files with 71380 additions and 0 deletions
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Types;
using MyFriendsAround.Common.Entities;
namespace MyFriendsAround.Data.BLL
{
public static class FriendsRepository
{
public static List<Friend> GetFriends()
{
using (MyFriendsModelContainer ctx = new MyFriendsModelContainer())
{
ctx.ContextOptions.ProxyCreationEnabled = false;
List<Friend> list = ctx.Friends.ToList();
list.ForEach((f) =>
{
SqlGeometry geom = SqlGeometry.Parse(f.LocationStr);
f.Latitude = geom.STX.Value;
f.Longitude = geom.STY.Value;
});
return list;
}
}
public static bool PublishLocation(Friend friend)
{
using (MyFriendsModelContainer ctx = new MyFriendsModelContainer())
{
Friend locateFriend = ctx.Friends.SingleOrDefault(f => f.Id == friend.Id);
if (locateFriend == null)
{
ctx.Friends.AddObject(friend);
ctx.ObjectStateManager.ChangeObjectState(friend, System.Data.EntityState.Added);
}
else
{
//update
locateFriend.FriendName = friend.FriendName;
locateFriend.FriendImageUrl = friend.FriendImageUrl;
locateFriend.LastUpdated = friend.LastUpdated;
locateFriend.LocationStr = friend.LocationStr;
ctx.ObjectStateManager.ChangeObjectState(locateFriend, System.Data.EntityState.Modified);
}
bool success = ctx.SaveChanges() > 0;
if (success)
{
//update gegraphy field
ctx.ExecuteFunction("UpdateFriendLocationById", new ObjectParameter[]
{
new ObjectParameter("FriendID", friend.Id),
});
}
return success;
}
}
}
}
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C78D400C-204A-4FAE-B63E-4D86A9871641}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyFriendsAround.BLL</RootNamespace>
<AssemblyName>MyFriendsAround.BLL</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Tests|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Tests\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\MyFriendsAround.BLL.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\Libs\Sql\Microsoft.SqlServer.Types.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FriendsRepository.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyFriendsAround.Common\MyFriendsAround.Common.csproj">
<Project>{80664694-C63F-4653-B3FC-617AEC468B3C}</Project>
<Name>MyFriendsAround.Common</Name>
</ProjectReference>
<ProjectReference Include="..\MyFriendsAround.Data\MyFriendsAround.Data.csproj">
<Project>{C3D31B22-BFF4-4DF1-A1EC-C8F158DEEB33}</Project>
<Name>MyFriendsAround.Data</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyFriendsAround.Data.BLL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("MyFriendsAround.Data.BLL")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6049f622-346d-4114-8458-12628b3592e4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]