Esempio n. 1
0
        public CadastroModel SearchForCpf(string cpf)
        {
            string sql = @"SELECT * FROM soue_tb_register_client WHERE cpf = @Cpf ORDER BY id ASC LIMIT 1";

            MySqlCommand Command = new MySqlCommand();
            DalModel     objDAL  = new DalModel();

            Command.CommandText = sql;
            Command.Parameters.AddWithValue("@Cpf", cpf);

            DataTable dt = objDAL.ReturnDataTable(Command);

            objDAL.CloseConnection();

            if (dt.Rows.Count > 0)
            {
                CadastroModel RegisterClient = new CadastroModel()
                {
                    Id          = Convert.ToInt32(dt.Rows[0]["id"]),
                    Name        = dt.Rows[0]["name"].ToString(),
                    Cpf         = dt.Rows[0]["cpf"].ToString(),
                    Email       = dt.Rows[0]["email"].ToString(),
                    PhoneNumber = dt.Rows[0]["phonenumber"].ToString(),
                    Address     = dt.Rows[0]["address"].ToString()
                };

                return(RegisterClient);
            }

            return(null);
        }
        public bool Validate()
        {
            CadastroModel cadastroModel = new CadastroModel();

            cadastroModel = cadastroModel.SearchForCpf(Cpf);

            return(false);
        }
 private object ConvertAccessUserJSON(CadastroModel cadastro)
 {
     return(JsonConvert.SerializeObject(cadastro));
 }