Example #1
0
        private void TBEmailSearch_TextChanged(object sender, EventArgs e)
        {
            string txt = TBEmailSearch.Text.Trim();

            if ((!String.IsNullOrEmpty(txt)) && (txt.Length >= 3))
            {
                List <CustomerModel> lm = CustomerDA.GetCustomerByName(Config.VBR4000Connection, txt);
                BindList(lm);
            }
        }
        public void GetCustomerByFirstName()
        {
            //var customer = new Customer();
            //customer.FirstName = "Leonie";
            //Tim Goyer
            //Frank Ralston
            var p             = "Tim";
            var da            = new CustomerDA();
            var customerValor = da.GetCustomerByName(p);

            Assert.IsTrue(customerValor.LastName == "Goyer");
        }
        public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            string       mode     = context.UserName.Substring(0, 1);
            Organisation o        = null;
            bool         fail     = true;
            string       username = context.UserName.Substring(1);

            switch (mode)
            {
            case "m":
                o = OrganisationDA.CheckCredentials(username, context.Password);
                if (o != null)
                {
                    fail = false;
                }
                break;

            case "s":
                o = OrganisationDA.GetOrganisation(Int32.Parse(username));
                Employee employee = EmployeeDA.GetEmployeeByName(context.Password, o);
                if (o != null && employee != null)
                {
                    fail = false;
                }
                break;

            case "r":
                o = OrganisationDA.GetOrganisation(Int32.Parse(username));
                Customer customer = CustomerDA.GetCustomerByName(context.Password, o);
                if (o != null && customer != null)
                {
                    fail = false;
                }
                break;
            }
            if (fail)
            {
                context.Rejected();
                return(Task.FromResult(0));
            }

            var id = new ClaimsIdentity(context.Options.AuthenticationType);

            id.AddClaim(new Claim("userid", o.ID.ToString()));
            id.AddClaim(new Claim("dbname", o.DbName));
            id.AddClaim(new Claim("dblogin", o.DbLogin));
            id.AddClaim(new Claim("dbpass", o.DbPassword));

            context.Validated(id);
            return(Task.FromResult(0));
        }
Example #4
0
        public void GetCustomerByFirstName()
        {
            //var customer = new Customer();
            //customer.FirstName = "Leonie";
            //Tim Goyer
            //Frank Ralston
            var p             = "Tim";
            var da            = new CustomerDA();
            var customerValor = da.GetCustomerByName(p);

            Assert.IsTrue(customerValor.LastName == "Goyer");

            ////Actualizando el Artista
            //artist.Name = "Artist prueba nuevo actualiado";
            //artist.ArtistId = codigoGenerado;
            //var updated = da.UpdateArtist(artist);
            //Assert.IsTrue(updated);


            //var artitaUpdate = da.GetArtistById(codigoGenerado);
            //Assert.IsTrue(artitaUpdate. == "Artist prueba nuevo actualiado");
        }
        public Customer GetByName([FromBody] string name)
        {
            ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal;

            return(CustomerDA.GetCustomerByName(p.Claims, name));
        }