Guest User

Untitled

a guest
Aug 18th, 2018
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. silverlight enabled wcf service retuning value
  2. [OperationContract]
  3.  
  4. public bool LoginCheck(string username, string password)
  5. {
  6. RoadTransDataContext db = new RoadTransDataContext();
  7.  
  8. var _Pass = (from d in db.users where d.username == username select d.password).SingleOrDefault();
  9.  
  10. if (_Pass == password)
  11. {
  12. return true;
  13. }
  14. else
  15. {
  16. return false;
  17. }
  18. }
  19.  
  20. private void LoginCheckCompleted(object sender, ServiceReference.LoginCheckCompletedEventArgs e)
  21. {
  22. _Log = e.Result;
  23. }
  24.  
  25. private void OKButton_Click(object sender, RoutedEventArgs e)
  26. {
  27. ServiceReference.ServiceClient webservice = new ServiceReference.ServiceClient();
  28.  
  29. webservice.LoginCheckCompleted += new EventHandler<ServiceReference.LoginCheckCompletedEventArgs>(LoginCheckCompleted);
  30. webservice.LoginCheckAsync(txtUserName.Text, txtPassword.Password);
  31.  
  32. if (_Log == true)
  33. {
  34. this.DialogResult = true;
  35. this.Close();
  36. }
  37. }
  38.  
  39. private void LoginCheckCompleted(object sender, ServiceReference.LoginCheckCompletedEventArgs e)
  40. {
  41. _Log = e.Result;
  42.  
  43. if (_Log == true)
  44. {
  45. this.DialogResult = true;
  46. this.Close();
  47. }
  48. }
  49.  
  50. private void OKButton_Click(object sender, RoutedEventArgs e)
  51. {
  52. ServiceReference.ServiceClient webservice = new ServiceReference.ServiceClient();
  53.  
  54. webservice.LoginCheckCompleted += new EventHandler<ServiceReference.LoginCheckCompletedEventArgs>(LoginCheckCompleted);
  55. webservice.LoginCheckAsync(txtUserName.Text, txtPassword.Password);
  56. }
RAW Paste Data