public SelectList getCountry(string selectedcountry = "") { SMARTService smartService = new SMARTService(); string[] countries = smartService.Countries("", 999, true); //setting to false prevents any response at all return(new SelectList(countries, selectedcountry)); }
public ActionResult ForgottenPassword(string email) { SMARTService smartService = new SMARTService(); bool result = true; bool fail = true; try { smartService.ForgottenLogin(email, out result, out fail); // not sure this is right, docs not clear. if (result == true) { TempData["Message"] = "New Password sent successfully."; } else { TempData["Message"] = "Failed to send new password."; } } catch (Exception ex) // apparently not throwing the expected fault exception. handling argument exception instead. { if (ex is FaultException) { TempData["Error"] = "Error Message: " + ex.Message; } if (ex is ArgumentException) { TempData["Error"] = "Error Message: " + ex.Message; } } return(View("Login")); }
public ActionResult AddTermAuto(string term) { List <string> AccountTerms = new List <string>(); try { SMARTService smartService = new SMARTService(); List <string> recdrug = new List <string>(smartService.Drugs(term, 99999, true)); //recdrug.Insert(0, "<div class='selectlistlabel'>Drugs</div>"); if (recdrug.Count() > 0) { AccountTerms.AddRange(recdrug); } List <string> indications = new List <string>(smartService.Indications(term, 99999, true)); //indications.Insert(0, "<div class='selectlistlabel'>Indications</div>"); if (indications.Count() > 0) { AccountTerms.AddRange(indications); } List <string> manufact = new List <string>(smartService.Manufacturers(term, 99999, true)); //manufact.Insert(0, "<div class='selectlistlabel'>Manufacturers</div>"); if (manufact.Count() > 0) { AccountTerms.AddRange(manufact); } List <string> devices = new List <string>(smartService.Devices(term, 99999, true)); //manufact.Insert(0, "<div class='selectlistlabel'>Manufacturers</div>"); if (devices.Count() > 0) { AccountTerms.AddRange(devices); } } catch (Exception ex) // apparently not throwing the expected fault exception. handling argument exception instead. { if (ex is FaultException) { TempData["Error"] = "Error Message: " + ex.Message; } if (ex is ArgumentException) { TempData["Error"] = "Error Message: " + ex.Message; } } AccountTerms.Sort(); return(Json(AccountTerms.ToArray(), JsonRequestBehavior.AllowGet)); }
public ActionResult Login(User user, string search, string roid) { //if (User.Identity.IsAuthenticated) //{ //} if (ModelState.IsValid) { // curently uses the username / password supplied for testing /*user.Password = "******"; // remove line when live * user.UserName = "******"; // remove line when live*/ // Call to webservice SMARTService smartService = new SMARTService(); TempData["Message"] = ""; //set it to an empy string. string password = MD5Helper.GetMd5Hash(MD5.Create(), user.Password); try { TempData["Message"] = smartService.Login(user.UserName, password); } catch (Exception ex) // apparently not throwing the expected fault exception. handling argument exception instead. { if (ex is FaultException) { TempData["Error"] = "Error Message: " + ex.Message; //TempData["ErrorDetail"] = "Error Detail: " + ex.Detail.errorDetails; } if (ex is ArgumentException) { TempData["Error"] = "Error Message: " + ex.Message; } } // it woulld be better if the web service returned true / false // not a string message which could be changed and break the login! if (TempData["Message"].ToString() == "Login Successful.") { TempData["Message"] = ""; FormsAuthentication.SetAuthCookie(user.UserName, user.RememberMe); if (search != "" && search != null) { return(RedirectToAction("BasicSearch", "Home", new Search { freetext = search })); } if (roid != null && roid != "") { //errrr i can't redirect to a post method. needs a rebuild? //redirect to post page if (Request.UrlReferrer.Query.Contains("addToFav=True")) { return(RedirectToAction("AddToFavourites", "User", new { roid = roid })); } return(RedirectToAction("requestQuoteviaURL", "Home", new { roid = roid })); } return(RedirectToAction("Index", "Home")); // If we got this far, and we where successful, return home. } else { ModelState.AddModelError("", "Login data is incorrect!"); } } return(View(user)); }
public SmartService() { this.smartService = new SMARTService(); }