Advertisement
Guest User

Untitled

a guest
Mar 21st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. CS0234: The type or namespace name 'Models' does not exist in the namespace 'TestProject' (are you missing an assembly reference?)
  2. Line 73:
  3. Line 74: [WebMethod]
  4. Line 75: public Int32 InsertUser(TestProject.Models.User u)
  5. Line 76: {
  6. Line 77: int userId = 0;
  7.  
  8. Source File: c:UsersEricDesktopTestProjectApp_CodeWebService1.asmx.cs Line: 75
  9.  
  10. namespace TestProject.Models
  11. {
  12. public class User
  13. {
  14. private int _userid;
  15. private string _username;
  16. private string _password;
  17.  
  18.  
  19. // get set
  20. public int userid
  21. {
  22. get { return _userid; }
  23. set { _userid = value; }
  24. }
  25.  
  26. public string username
  27. {
  28. get { return _username; }
  29. set { _username = value; }
  30. }
  31.  
  32. public string password
  33. {
  34. get { return _password; }
  35. set { _password = value; }
  36. }
  37. }
  38. }
  39.  
  40. [WebMethod]
  41. public Int32 InsertUser(TestProject.Models.User u)
  42. {
  43. int userId = 0;
  44. string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
  45. SqlConnection con = new SqlConnection(constr);
  46.  
  47. try
  48. {
  49. SqlCommand cmd = new SqlCommand("RegisterUser");
  50. cmd.CommandType = CommandType.StoredProcedure;
  51. cmd.Parameters.AddWithValue("@Username", u.username);
  52. cmd.Parameters.AddWithValue("@Password", u.password);
  53. cmd.Connection = con;
  54. if (con.State == ConnectionState.Closed)
  55. {
  56. con.Open();
  57. }
  58. userId = Convert.ToInt32(cmd.ExecuteScalar());
  59.  
  60.  
  61. switch (userId)
  62. {
  63. case -1:
  64. return -1;
  65.  
  66. case -2:
  67. return -2;
  68.  
  69. default:
  70. return 0;
  71. }
  72. }
  73.  
  74. TestProject.App_Code.WebService1 service = new TestProject.App_Code.WebService1();
  75. Models.User u = new Models.User();
  76. u.username = txtUsername.Text.Trim();
  77. u.password = txtPassword.Text.Trim();
  78. u.email = txtEmail.Text.Trim();
  79. u.firstname = txtF.Text.Trim();
  80. u.lastname = txtF.Text.Trim();
  81. u.birthdate = Convert.ToDateTime(BashkoDaten());
  82. u.gender = RadioButtonList1.SelectedValue;
  83. u.photo_path = RadioButtonList1.SelectedValue;
  84. int retVal = service.InsertUser(u);
  85.  
  86. //....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement