public AuthenticateCustomerResult AuthenticateCustomer(AuthenticateCustomerRequest request) { AuthenticateCustomerResult response = new AuthenticateCustomerResult(); //test // This is to test the MachineID, SiteId, UserCredentials, and CredentialTypes are receiving // the correct corresponding attributes from request. // // Notice: the order of request in xml matters! // The order of attributes are alphabetical. // In this case: // CredentialType, MachineID, SiteID, and UserCredential // but class "request" in practical won't pass in the correct order, // // to tell system to neglect the order, // go to IVNService.cs // replace with "[ServiceContract(Namespace = "http://vendnovation.com/"), XmlSerializerFormat]" as the first line // for [ServiceContract(Namespace = "http://vendnovation.com/")] // "XmlSerializerFormat" would tell system to neglect the default alphabetical order // this will make the testing tool from Vendnovation to work // K:\Curly\TaskApps\VendNovationToolkitForTesting // but WcfTestClient would expect a string of xml, // // to tell system to maintain the order, // go to IVNService.cs // replace with "[ServiceContract(Namespace = "http://vendnovation.com/")]" as the first line // for "[ServiceContract(Namespace = "http://vendnovation.com/"), XmlSerializerFormat]" // the default alphabetical order would be set. // this will make WcfTestClient to expect a list of individual attributes, not a string of xml for all. // but the testing tool from Vendnovation wouldn't work. // K:\Curly\TaskApps\VendNovationToolkitForTesting // as the testing toolkit provides with an attribute order different from the default alphabetical one on request. LogDump.Log("MachineID: " + request.MachineID); LogDump.Log("SiteID: " + request.SiteID); LogDump.Log("UserCredentials: " + request.UserCredentials); LogDump.Log("CredentialType: " + request.CredentialType); response.Error += "<br>" + LogDump.LogContentString; LogDump.clearLog(); //test Mailer.send("*****@*****.**", "*****@*****.**", null, "Test from VN, Test auth Customer", response.Error); return(new AuthenticateCustomerResult()); }
//first method sent by VendNovation. Checks if the given student is allow to make vending purchases //will be rejected if: student not found in system or student is marked inactive public AuthenticateCustomerResult AuthenticateCustomer(AuthenticateCustomerRequest request) {// under request parameters, // UserCredentials ---> student id_number // SiteID ------------> school name (school column in student table) // //I beleive SiteID will be the school name and machineID wil be the number of the unit in the school. AuthenticateCustomerResult response = new AuthenticateCustomerResult(); if (request == null) { response.Error = "No Data"; response.Approved = false; return(response); } string[] output_params = { "lactive", "present", "student", "last_name", "pin" }; Dictionary <string, string> outputs = SQL.findRow("student", request.UserCredentials, Parse.readSchool(request.SiteID), output_params); //Dictionary<string, string> outputs = SQL.findRow("student", userCredentials, //Parse.readSchool(machineID), output_params); response.Approved = Convert.ToBoolean(outputs["lactive"]); if (!response.Approved) { response.Error = "Not an active account."; } response.Balance = Convert.ToDouble(outputs["present"]); response.FirstName = outputs["student"]; response.LastName = outputs["last_name"]; response.PINNumber = outputs["pin"]; //test LogDump.Log("UserCredentials: " + request.UserCredentials); LogDump.Log("MachineID: " + request.MachineID); LogDump.Log("CredentialType: " + request.CredentialType); LogDump.Log("SiteID: " + request.SiteID); response.Error += "<br>" + LogDump.LogContentString; LogDump.clearLog(); //test Mailer.send("*****@*****.**", "*****@*****.**", null, "Test from VN, auth Customer", response.Error); return(response); }