Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added GeekHunterV2.sqlite
Binary file not shown.
49 changes: 49 additions & 0 deletions GeekRegistrationSystem.Common/GeekRegistrationSystem.Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{269B347C-EFDD-434F-B5F1-61F207FCAEBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GeekRegistrationSystem.Common</RootNamespace>
<AssemblyName>GeekRegistrationSystem.Common</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TransactionUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
36 changes: 36 additions & 0 deletions GeekRegistrationSystem.Common/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("GeekRegistrationSystem.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GeekRegistrationSystem.Common")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("269b347c-efdd-434f-b5f1-61f207fcaebe")]

// 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")]
23 changes: 23 additions & 0 deletions GeekRegistrationSystem.Common/TransactionUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;

namespace GeekRegistrationSystem.Common
{
public class TransactionUtils
{
public static TransactionScope CreateTransactionScope()
{
var transactionOptions = new TransactionOptions()
{
IsolationLevel = IsolationLevel.ReadCommitted,
Timeout = TransactionManager.MaximumTimeout,
};

return new TransactionScope(TransactionScopeOption.Required, transactionOptions);
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\bin\Debug\GeekRegistrationSystem.Common.dll
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\bin\Debug\GeekRegistrationSystem.Common.pdb
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\obj\Debug\GeekRegistrationSystem.Common.csprojAssemblyReference.cache
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\obj\Debug\GeekRegistrationSystem.Common.csproj.CoreCompileInputs.cache
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\obj\Debug\GeekRegistrationSystem.Common.dll
C:\Users\mohammadh\source\repos\GeekRegistrationSystem\GeekRegistrationSystem.Common\obj\Debug\GeekRegistrationSystem.Common.pdb
67 changes: 67 additions & 0 deletions GeekRegistrationSystem.Core.BLL/Context.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using GeekRegistrationSystem.Core.BLL.Models;

namespace GeekRegistrationSystem.Core.BLL
{
public class Context
{
#region Class field and properties

#region Singleton
private static Context _instance = null;
/// <summary>
/// Singleton context
/// </summary>
public static Context Instance
{
get
{
if (_instance == null)
_instance = new Context();
return _instance;
}
}
#endregion

#region Model
private Candidate _candidate = null;
public Candidate Candidate
{
get
{
_candidate = new Candidate();
_candidate.Load();
return _candidate;
}
}

private Skill _skill = null;
public Skill Skill
{
get
{
_skill = new Skill();
_skill.Load();
return _skill;
}
}

private CandidateSkill _candidateSkill = null;
public CandidateSkill CandidateSkill
{
get
{
_candidateSkill = new CandidateSkill();
_candidateSkill.Load();
return _candidateSkill;
}
}
#endregion

#endregion

#region Initialize
private Context() { }
#endregion

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EC1D07C1-1078-4A59-A438-20A4599021B0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GeekRegistrationSystem.Core.BLL</RootNamespace>
<AssemblyName>GeekRegistrationSystem.Core.BLL</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Context.cs" />
<Compile Include="Helper.cs" />
<Compile Include="Interfaces\ICandidate.cs" />
<Compile Include="Interfaces\ICandidateSkill.cs" />
<Compile Include="Models\Candidate.cs" />
<Compile Include="Models\CandidateSkill.cs" />
<Compile Include="Models\Skill.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GeekRegistrationSystem.Core.DAL\GeekRegistrationSystem.Core.DAL.csproj">
<Project>{481e5428-ee53-4ccf-a711-1d3429555543}</Project>
<Name>GeekRegistrationSystem.Core.DAL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
68 changes: 68 additions & 0 deletions GeekRegistrationSystem.Core.BLL/Helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using GeekRegistrationSystem.Core.BLL.Models;
using GeekRegistrationSystem.Core.DAL;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace GeekRegistrationSystem.Core.BLL
{
public class Helper
{
//PrintSkills(skills)
//Helper function to display all the avilable skills in the system to the DB.
public static void PrintSkills(Entities<Skill> skills)
{
foreach (var skill in skills)
{
Console.WriteLine($"{skill.Id}.{skill.Name}");
}
Console.WriteLine("Enter skill(s): Type skill id. Use comma character ',' to select multiple skills then press Enter )");
}

//IsValidString(stringValue)
//Returns true if the string contains valid english charcaters only, otherwise, returns false.
public static bool IsValidString(string stringValue)
{
string pattern = @"^\w+$";
Regex regex = new Regex(pattern);

// Compare a string against the regular expression
return regex.IsMatch(stringValue);
}

//IsValidLength(stringValue)
//Returns true if the string had a valid lenght as configured
public static bool IsValidLength(string stringValue)
{
return stringValue.Length >= int.Parse(ConfigurationManager.AppSettings["MinimumStringLength"])
&& stringValue.Length <= int.Parse(ConfigurationManager.AppSettings["MaximumStringLength"]);
}

//ValidateString(stringValue)
//Check if string is valid
//Returns error messages if not a valid string.
public static List<string> ValidateString(string stringValue)
{
List<string> errorMessages = new List<string>();
if (!IsValidLength(stringValue))
errorMessages.Add($"Invalid Length: Length must be between " +
$"{int.Parse(ConfigurationManager.AppSettings["MinimumStringLength"])} " +
$" And {int.Parse(ConfigurationManager.AppSettings["MaximumStringLength"])}.");
if (!IsValidString(stringValue))
errorMessages.Add($" Invalid String: must be a valid english characters");
return errorMessages;
}

//PrintList(values)
//Print all strings to the consol
public static void PrintList(List<string> messages)
{
foreach (string message in messages)
Console.WriteLine($"ERROR: {message}");
}
}
}
16 changes: 16 additions & 0 deletions GeekRegistrationSystem.Core.BLL/Interfaces/ICandidate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GeekRegistrationSystem.Core.BLL.Interfaces
{
public interface ICandidate
{
void ViewAllCandidates();
void AddCandidate();
bool Add(Candidate candidate);
void ViewCandidatesBySkill();
}
}
14 changes: 14 additions & 0 deletions GeekRegistrationSystem.Core.BLL/Interfaces/ICandidateSkill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using GeekRegistrationSystem.Core.BLL.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GeekRegistrationSystem.Core.BLL.Interfaces
{
public interface ICandidateSkill
{
bool Add(CandidateSkill candidateSkill);
}
}
Loading