protected void Submit(object sender, EventArgs e) { string Name = txtName.Value.ToString(); string Surname = txtSurname.Value.ToString(); string Password = txtPassword.Value.ToString(); string ConfirmedPassword = txtCPassword.ToString(); string Email = txtEmail.Value.ToString(); //SFMConsultingWebService SFMService = new SFMConsultingWebService(); //Add Reference of the Webservice to the web application. SFM.SFMWebservice.SFMConsultingWebServiceSoapClient SFMWebservice = new SFM.SFMWebservice.SFMConsultingWebServiceSoapClient(); if (SFMWebservice.RegisterVisitorUser(Name, Surname, Name, Password, Email, ConfirmedPassword) > 1) { Response.Redirect("~/SFM_Login.aspx"); } else { Response.Redirect("~/SFM_Home.aspx"); } //Before the SQL code is executed validation of user data needs to be done //It would be smart to hash the user password using the Crypto class and then add a salt to the password. //Each salt would be unique for each password and thus would have to be saved in database for each user as [SaltID] attribute. //Connection string, is the string of a database hosted on the cloud. }
protected void Login(object sender, EventArgs e) { string Username = txtUsername.Value; string Password = txtPassword.Value; SFM.SFMWebservice.SFMConsultingWebServiceSoapClient SFMWebservice = new SFM.SFMWebservice.SFMConsultingWebServiceSoapClient(); if (SFMWebservice.LoginUser(Username, Password) == 2) { Response.Redirect("~/SFM_Home.aspx"); } else if (SFMWebservice.LoginUser(Username, Password) == 0) { if (SFMWebservice.LoginAdmin(Username, Password) == 3) { Response.Redirect("~/Director_Dashboard.aspx"); } else if (SFMWebservice.LoginAdmin(Username, Password) == 0) { if (SFMWebservice.LoginManager(Username, Password) == 4) { Response.Redirect("~/Manager_Dashboard.aspx"); } else if (SFMWebservice.LoginManager(Username, Password) == 0) { if (SFMWebservice.LoginConsultant(Username, Password) == 5) { Response.Redirect("~/Consultant_Dashboard.aspx"); } else if (SFMWebservice.LoginConsultant(Username, Password) == 0) { if (SFMWebservice.LoginCustomer(Username, Password) == 6) { Response.Redirect("~/Client_Dashboard.aspx"); } else if (SFMWebservice.LoginCustomer(Username, Password) == 0) { Response.Redirect("~/SFM_Home.aspx"); //End of the nested if. Means the user is not registered and needs to register first. } } } } } }
protected void Add(object sender, EventArgs e) { SFM.SFMWebservice.SFMConsultingWebServiceSoapClient SFMWebservice = new SFM.SFMWebservice.SFMConsultingWebServiceSoapClient(); string EmployeeType = Type.Value; string Name = txtName.Value; string Surname = txtSurname.Value; string Email = txtEmail.Value; SFMWebservice.RegisterEmployee(EmployeeType, Name, Surname, Email); if (SFMWebservice.RegisterEmployee(EmployeeType, Name, Surname, Email) == 2) { Response.Redirect("~/SFM_Home.aspx"); } }