Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CS0234: The type or namespace name 'Models' does not exist in the namespace 'TestProject' (are you missing an assembly reference?)
- Line 73:
- Line 74: [WebMethod]
- Line 75: public Int32 InsertUser(TestProject.Models.User u)
- Line 76: {
- Line 77: int userId = 0;
- Source File: c:UsersEricDesktopTestProjectApp_CodeWebService1.asmx.cs Line: 75
- namespace TestProject.Models
- {
- public class User
- {
- private int _userid;
- private string _username;
- private string _password;
- // get set
- public int userid
- {
- get { return _userid; }
- set { _userid = value; }
- }
- public string username
- {
- get { return _username; }
- set { _username = value; }
- }
- public string password
- {
- get { return _password; }
- set { _password = value; }
- }
- }
- }
- [WebMethod]
- public Int32 InsertUser(TestProject.Models.User u)
- {
- int userId = 0;
- string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
- SqlConnection con = new SqlConnection(constr);
- try
- {
- SqlCommand cmd = new SqlCommand("RegisterUser");
- cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.AddWithValue("@Username", u.username);
- cmd.Parameters.AddWithValue("@Password", u.password);
- cmd.Connection = con;
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }
- userId = Convert.ToInt32(cmd.ExecuteScalar());
- switch (userId)
- {
- case -1:
- return -1;
- case -2:
- return -2;
- default:
- return 0;
- }
- }
- TestProject.App_Code.WebService1 service = new TestProject.App_Code.WebService1();
- Models.User u = new Models.User();
- u.username = txtUsername.Text.Trim();
- u.password = txtPassword.Text.Trim();
- u.email = txtEmail.Text.Trim();
- u.firstname = txtF.Text.Trim();
- u.lastname = txtF.Text.Trim();
- u.birthdate = Convert.ToDateTime(BashkoDaten());
- u.gender = RadioButtonList1.SelectedValue;
- u.photo_path = RadioButtonList1.SelectedValue;
- int retVal = service.InsertUser(u);
- //....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement