Skip to content

Commit

Permalink
user change.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Nov 28, 2014
1 parent 18c8ee6 commit 9f436c4
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 1,154 deletions.
4 changes: 2 additions & 2 deletions FSDTS/Common/CustomValidators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public class UniqueAttribute : ValidationAttribute
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
FSDTSContext fsdtsContext = new FSDTSContext();

User userFromObject = (User) validationContext.ObjectInstance;
if (validationContext.DisplayName.Equals("UserEmail"))
{
User user = new User();
user = fsdtsContext.User.SingleOrDefault(usr => usr.UserEmail == value.ToString());
user = fsdtsContext.User.SingleOrDefault(usr => usr.UserEmail == value.ToString() && usr.UserId != userFromObject.UserId);

if (user != null)
{
Expand Down
39 changes: 27 additions & 12 deletions FSDTS/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public IQueryable<User> GetUser()
return db.User.OrderBy(user => user.UserLastName);
}

[Route("Api/GetUserInfo")]
public List<User> GetUserInfo()
[Route("Api/GetUserInfoByUserType")]
public List<User> GetUserInfoByUserType(string UType)
{
cmd = new SqlCommand();
List<User> lstUser = new List<User>();
Expand All @@ -94,8 +94,25 @@ public List<User> GetUserInfo()

cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "FSDTD_GetUserInfo";

reader = cmd.ExecuteReader();

SqlParameter param = new SqlParameter();
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
param.ParameterName = "@UserType";
param.Precision = 10;
param.SqlDbType = SqlDbType.Text;
param.SqlValue = UType;
param.Value = UType;
cmd.Parameters.Add(param);

if (UType != null)
{
reader = cmd.ExecuteReader();
}
else
{
throw new NullReferenceException("User Type you have entered is not correct.");
}
while (reader.Read())
{
objuser = new User();
Expand Down Expand Up @@ -341,17 +358,11 @@ public HttpResponseMessage PatchUser(int id, Delta<User> user)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
<<<<<<< Updated upstream



//var EncryptedPassword = UserBO.SymmetricEncryptData(doc.UserPassword);
//doc.UserPassword = EncryptedPassword;
>>>>>>> Stashed changes
=======
//var EncryptedPassword = UserBO.SymmetricEncryptData(doc.UserPassword);
//doc.UserPassword = EncryptedPassword;
>>>>>>> Stashed changes

user.Patch(doc);
objContext.Entry(doc).State = EntityState.Modified;
Expand Down Expand Up @@ -445,10 +456,14 @@ private bool UserExists(int id)
/// <param name="userName">string userName</param>
/// <param name="userPassword">string userPassword</param>
/// <returns>HttpResponseMessage Success/Failure</returns>
=======

[ResponseType(typeof(User))]
>>>>>>> Stashed changes
[FsdtsExceptionHandler]
<<<<<<< Updated upstream
=======
[Route("Api/Login")]
[HttpPost]
[HttpPost]
public HttpResponseMessage Login(User userobj)
{
HttpResponse response = HttpContext.Current.Response;
Expand Down
24 changes: 5 additions & 19 deletions FSDTS/FSDTS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,9 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Migrations\201411181324112_initiald.cs" />
<Compile Include="Migrations\201411181324112_initiald.Designer.cs">
<DependentUpon>201411181324112_initiald.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201411201157401_initiale.cs" />
<Compile Include="Migrations\201411201157401_initiale.Designer.cs">
<DependentUpon>201411201157401_initiale.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201411210713476_initialf.cs" />
<Compile Include="Migrations\201411210713476_initialf.Designer.cs">
<DependentUpon>201411210713476_initialf.cs</DependentUpon>
<Compile Include="Migrations\201411280652397_initialr.cs" />
<Compile Include="Migrations\201411280652397_initialr.Designer.cs">
<DependentUpon>201411280652397_initialr.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\AccountBindingModels.cs" />
Expand Down Expand Up @@ -360,14 +352,8 @@
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201411181324112_initiald.resx">
<DependentUpon>201411181324112_initiald.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201411201157401_initiale.resx">
<DependentUpon>201411201157401_initiale.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201411210713476_initialf.resx">
<DependentUpon>201411210713476_initialf.cs</DependentUpon>
<EmbeddedResource Include="Migrations\201411280652397_initialr.resx">
<DependentUpon>201411280652397_initialr.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
Expand Down
29 changes: 0 additions & 29 deletions FSDTS/Migrations/201410311151044_Reset.Designer.cs

This file was deleted.

241 changes: 0 additions & 241 deletions FSDTS/Migrations/201410311151044_Reset.cs

This file was deleted.

Loading

0 comments on commit 9f436c4

Please sign in to comment.