Skip to content

Commit

Permalink
Modif Constring
Browse files Browse the repository at this point in the history
  • Loading branch information
Max1991 committed Oct 31, 2014
1 parent 66fa760 commit b507548
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion InTime/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ActionResult Login(LoginModel model, string returnUrl)
con = RequeteSql.ConnexionBD(con);
int id = RequeteSql.RechercheID(con, model.UserName);

Cookie.CreationCookie(model.UserName, Convert.ToString(id), InTime.Models.Cookie.Heure);
InTime.Models.Cookie.CreationCookie(model.UserName, Convert.ToString(id), InTime.Models.Cookie.Heure);
}
catch (Exception ex)
{
Expand Down
3 changes: 0 additions & 3 deletions InTime/Controllers/ConsulterTacheController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ public ActionResult Taches(string strMessValidation)

public ActionResult SuppTache(int? id)
{
SqlConnection con = null;
try
{
//SqlCommand cmd = new SqlCommand(SqlDelete, con);
//cmd.ExecuteNonQuery();
string SqlDelete = "DELETE FROM Taches WHERE UserId=@UserId AND IdTache=@IdTache";
List<SqlParameter> Parametres = new List<SqlParameter>
{
Expand Down
2 changes: 1 addition & 1 deletion InTime/Filters/InitializeSimpleMembershipAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SimpleMembershipInitializer()
((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
}
}
WebSecurity.InitializeDatabaseConnection("ConnString2", "UserProfile", "UserId", "UserName", autoCreateTables: true);
WebSecurity.InitializeDatabaseConnection("ConnString", "UserProfile", "UserId", "UserName", autoCreateTables: true);
}
catch (Exception ex)
{
Expand Down
14 changes: 10 additions & 4 deletions InTime/Models/RequeteSql.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace InTime.Models
{
public static class RequeteSql
{
public const string connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=EQUIPE-02;Integrated Security=True";
public const string connectionString = @"Data Source=EQUIPE-02\SQLEXPRESS;Initial Catalog=InTime;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False";

public static SqlConnection ConnexionBD(SqlConnection con)
{
Expand All @@ -27,10 +27,16 @@ public static int RechercheID(SqlConnection con, string username)
string SqlrId = "SELECT * FROM UserProfile where UserName=@NomUtilisateur;";

SqlCommand cmdId = new SqlCommand(SqlrId, con);
cmdId.Parameters.Add(new SqlParameter("@NomUtilisateur", SqlDbType.VarChar)
{ Value = username ?? (object)DBNull.Value });
List<SqlParameter> Parametres = new List<SqlParameter>
{
new SqlParameter("@NomUtilisateur",username)
};

return (Int32)cmdId.ExecuteScalar();
if (Parametres != null)
{
cmdId.Parameters.AddRange(Parametres.ToArray<SqlParameter>());
}
return (Int32)cmdId.ExecuteScalar();
}

public static SqlDataReader Select (string Query, List<SqlParameter> Parametres)
Expand Down

0 comments on commit b507548

Please sign in to comment.