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 void Create() { MySqlCommand Command = new MySqlCommand(); DalModel objDAL = new DalModel(); string sql = @"INSERT INTO soue_tb_log_register_token(id_client, token_number, data_access) value (@Id_Client, @Token_Number, @Data_Access)"; Command.CommandText = sql; Command.Parameters.AddWithValue("@Id_Client", DataClient.Id); Command.Parameters.AddWithValue("@Token_Number", Token); Command.Parameters.AddWithValue("@Data_Access", ConvertAccessUserJSON(DataClient)); objDAL.ExecuteCommandSQL(Command); objDAL.CloseConnection(); }
public void Create() { MySqlCommand Command = new MySqlCommand(); DalModel objDAL = new DalModel(); string sql = @"INSERT INTO soue_tb_register_client(name, cpf, email, phoneNumber, address) value (@Name, @Cpf, @Email, @PhoneNumber, @Address)"; Command.CommandText = sql; Command.Parameters.AddWithValue("@Name", Name); Command.Parameters.AddWithValue("@Cpf", Cpf); Command.Parameters.AddWithValue("@Email", Email); Command.Parameters.AddWithValue("@PhoneNumber", PhoneNumber); Command.Parameters.AddWithValue("@Address", Address); objDAL.ExecuteCommandSQL(Command); objDAL.CloseConnection(); }