Commit c5aa5620a171f7d321e68ede7dc1799285ccf83a

Authored by Nikita Kulshreshtha
1 parent 6af76ba3

opening connection before assigning to SQLCommand

400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -328,8 +328,8 @@ namespace AIAHTML5.API.Models
328 328 {
329 329 conn = new SqlConnection(dbConnectionString);
330 330 cmd = new SqlCommand();
331   - cmd.Connection = conn;
332 331 conn.Open();
  332 + cmd.Connection = conn;
333 333 cmd.CommandText = DBConstants.UPDATE_USER_PASSWORD;
334 334 cmd.CommandType = CommandType.StoredProcedure;
335 335 cmd.Parameters.AddWithValue("@sLoginId", loginId);
... ... @@ -483,8 +483,8 @@ namespace AIAHTML5.API.Models
483 483 {
484 484 conn = new SqlConnection(dbConnectionString);
485 485 cmd = new SqlCommand();
486   - cmd.Connection = conn;
487 486 conn.Open();
  487 + cmd.Connection = conn;
488 488 cmd.CommandText = DBConstants.UPDATE_LICENSE_TERM_STATUS;
489 489 cmd.CommandType = CommandType.StoredProcedure;
490 490 cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber);
... ... @@ -543,8 +543,8 @@ namespace AIAHTML5.API.Models
543 543 {
544 544 conn = new SqlConnection(dbConnectionString);
545 545 cmd = new SqlCommand();
546   - cmd.Connection = conn;
547 546 conn.Open();
  547 + cmd.Connection = conn;
548 548 cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL;
549 549 cmd.CommandType = CommandType.StoredProcedure;
550 550 cmd.Parameters.AddWithValue("@iUserId", userId);
... ... @@ -572,8 +572,8 @@ namespace AIAHTML5.API.Models
572 572 {
573 573 conn = new SqlConnection(dbConnectionString);
574 574 cmd = new SqlCommand();
575   - cmd.Connection = conn;
576 575 conn.Open();
  576 + cmd.Connection = conn;
577 577 cmd.CommandText = DBConstants.INSERT_INCORRECT_LOGIN_ATTEMPTS;
578 578 cmd.CommandType = CommandType.StoredProcedure;
579 579 cmd.Parameters.AddWithValue("@iUserId", userId);
... ... @@ -637,8 +637,8 @@ namespace AIAHTML5.API.Models
637 637 {
638 638 conn = new SqlConnection(dbConnectionString);
639 639 cmd = new SqlCommand();
640   - cmd.Connection = conn;
641 640 conn.Open();
  641 + cmd.Connection = conn;
642 642 cmd.CommandText = DBConstants.UPDATE_INCORRECT_LOGIN_ATTEMPTS;
643 643 cmd.CommandType = CommandType.StoredProcedure;
644 644 cmd.Parameters.AddWithValue("@iUserId", userId);
... ... @@ -665,8 +665,8 @@ namespace AIAHTML5.API.Models
665 665 {
666 666 conn = new SqlConnection(dbConnectionString);
667 667 cmd = new SqlCommand();
668   - cmd.Connection = conn;
669 668 conn.Open();
  669 + cmd.Connection = conn;
670 670 cmd.CommandText = DBConstants.DELETE_INCORRECT_LOGIN_ATTEMPTS;
671 671 cmd.CommandType = CommandType.StoredProcedure;
672 672 cmd.Parameters.AddWithValue("@iUserId", userId);
... ... @@ -724,8 +724,8 @@ namespace AIAHTML5.API.Models
724 724 {
725 725 conn = new SqlConnection(dbConnectionString);
726 726 cmd = new SqlCommand();
727   - cmd.Connection = conn;
728 727 conn.Open();
  728 + cmd.Connection = conn;
729 729 cmd.CommandText = DBConstants.INSERT_LOGIN_ERROR_LOG;
730 730 cmd.CommandType = CommandType.StoredProcedure;
731 731 cmd.Parameters.AddWithValue("@nvAccountNumber", accountNumber);
... ...