public Boolean AuthenticateLicense(RealLicenseWCF obj) { string sel = "SELECT * FROM License WHERE License_No = '"+ obj.LicenseNumber+"'"; SqlCommand cmd = new SqlCommand(sel, new SqlConnection(this.getConnectionString())); cmd.Connection.Open(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { obj.LicenseNumber = dr.GetString(0); obj.Expiry = dr.GetDateTime(1); if (DateTime.Now > obj.Expiry) { return false; } else { return true; } } return false; }
public Boolean AuthenticateLicense(RealLicenseWCF obj) { try { IAuthenticationSvc svc = (IAuthenticationSvc)this.getService(typeof(IAuthenticationSvc).Name); return svc.AuthenticateLicense(obj); } catch (ServiceLoadException ex) { throw ex; } }
protected void btnLicense_Click(object sender, EventArgs e) { ServiceWCFClient client = new ServiceWCFClient(); RealLicenseWCF obj = new RealLicenseWCF(); obj.LicenseNumber = TextBox1.Text; Session["User"] = client.AuthenticateLicense(obj); client.Close(); if (((Boolean)Session["User"] == true)) { Response.Redirect("~/Success.aspx"); } else { Response.Redirect("~/Expired.aspx"); } }
public Boolean AuthenticateLicense(RealLicenseWCF obj) { AuthenticationLicenseManager mgr = new AuthenticationLicenseManager(); return mgr.AuthenticateLicense(obj); }